What are Internal Transactions?

Tokenview.io
3 min readApr 19, 2024

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 Transactions” or “Call Transfers” showed on blockchain explorers.

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 APIs to easily track the internal transactions happened on blockchain.

Endpoints:

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

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 APIs.

--

--

Tokenview.io

Our mission is to build Freedom Safe Easy Web3/Crypto world. visit us at https://tokenview.io for General Multi-chain Explorer and Blockchain APIs entrance.