Skip to main content

What are Internal Transactions?

tokenviewAbout 2 min

What are Internal Transactions?

Internal transactions are transactions that occur within the context of a smart contract execution on a blockchain network. It involves the transfer of cryptocurrency tokens from one address to another, and most importantly, it involves interactions between smart contracts and can result in state changes within the blockchain's decentralized ledger.
When a user initiates a transaction that interacts with a smart contract or call the interface of a smart contract, the contract's code is executed, this is triggering internal transactions and state changes within the contract or other contracts it interacts with. That's those "Internal Transactionsopen in new window" or "Call Transfersopen in new window" showed on blockchain explorers.

Internal Transactions

Call Transfers

Where will the Internal Transactions happen?

Internal transactions occur in various scenarios, primarily involving interactions between smart contracts.

  1. DeFi Protocols: In decentralized exchanges (DEXs), lending protocols, automated market makers (AMMs), and other DeFi applications, smart contracts are called to facilitate activities such as token swaps, liquidity provision, lending, borrowing, yield farming, and more.
  2. Token Transfers and Exchanges: When users trade tokens, provide liquidity to liquidity pools, or interact with token swap protocols, internal transactions occur to transfer tokens between users, smart contracts, and liquidity pools.
  3. Games and NFTs: In gaming platforms and NFT marketplaces, smart contracts govern game mechanics, manage virtual assets, and facilitate trades of NFTs, resulting in internal transactions within the game environment.
  4. Governance and Voting: In DAOs, internal transactions are used to facilitate voting processes, governance proposals.
  5. Cross-Chain Interoperability: In cross-chain interoperability, atomic swaps, cross-chain bridges, and interoperability protocols enable assets to be transferred seamlessly between different blockchain networks.

How to track Internal Transactions?

To track internal transactions, you have to connect with archive node to get trace log, then analyze the log one by one. This requires additional resources and need extra node services.
Fortunately, you can use Tokenview APIsopen in new window to easily track the internal transactions happened on blockchain.

Endpoints:

/vipapi/{network}/address/calltrans/{address}/{page}/

Code Examples

import requests

# Tokenview APIs endpoint for retrieving token information
url = "https://services.tokenview.io/vipapi/{}/address/calltrans/{}/{}/{}?apikey={}"

# Network to query
network = "eth"

# Address for the desired internal transactions
address = "0x..."

# Tokenview API key for authentication
api_key = "YOUR_API_KEY"

# page
page = 1

# page size retrieving in this api
page_size = 10

# Construct API request URL
request_url = url.format(network,address,page,page_size,api_key)

# Send GET request to Tokenview API
response = requests.get(request_url)

# Parse JSON response
data = response.json()

# Extract relevant internal transactions data
internal_transactions = data["data"]

# Utilize data as needed
for internal_transaction in internal_transactions:
    print("Internal Transaction, from:", internal_transaction["from"])
    print("Internal Transaction, to:", internal_transaction["to"])
    print("Internal Transaction, value:", internal_transaction["value"])

For more on transactions of an address, please refer to address part on Tokenview Blockchain APIsopen in new window.

About Tokenview Blockchain APIs & Data Service Platform:

Tokenview blockchain APIs & data service platform contained 120+ blockchains has powerful endpoints that simplify complex blockchain data into single API calls. Code for all supported blockchains using unified API calls. From here to easily get transaction, address, gas, contract, token, NFT, logs and any information from chain. And Yes you can also send tx to chain. One-click configuration with APIKey helps developers to Use, to Create, to Build.
Last update: