Internal Transactions: Notify Your Users About All Their Crypto Transactions
March 30, 2021
Our Alchemy Notify suite now includes notifications for all ETH and Token transfers, including our newest addition: internal (smart contract) transactions — giving users full transparency into their transactions, every step of the way.
For a high-level overview of Ethereum Address Activity notifications, check out this blog post.
What are Internal Transactions?
To understand what internal transactions are, it's helpful to take a step back and look at the types of transactions we have on Ethereum. Transactions are state changes to the Ethereum chain, meaning they aren't reading data, they are writing data to the chain.
There are a handful of state changes that can occur on Ethereum, however, transactions are often what users care about the most. In order to notify users about their transactions, developers can plug into Address Activity notifications, which monitor transfers (exchange of value between two Ethereum accounts).
There are three types of transfers on Ethereum:
ETH transfers are the most basic type of transactions, using Ethereum's native currency.
Example transfer: Rishub sent 0.5 ETH to Paul.
The way you obtain them is by scanning each new block for transaction objects.
Token (ERC-20 and ERC-721) Transfers
Token transfers include any transfer associated with a ERC-20 token or with a Non-fungible ERC-721 token (NFT).
Example transfer: Omar purchases 10 AAVE from an exchange (smart contract) or another user.
The way you'd normally obtain these transfers is by looking through the event logs for the token contract you care about.
Internal transfers are Eth transfers where the sender (fromAddress) is an internal (smart contract) address. This includes a smart contract sending Eth to another smart contract, or a smart contract sending Eth to an external address.
Example transfer: Internal transfers are super complicated, but developers and users care about where their money starts and where it ends up, which is why they are important. Here's an example that shows two internal transactions:
Elan wants to exchange some of her Sushi tokens for ETH using Sushiswap. This is a multistep process that involves a variety of transfers.
First, she interacts with the Sushi smart contract, sending the smart contract her Sushi tokens, through a token transfer.
Then, the smart contract takes her Sushi and deposits it into the SUSHI/WETH pool, which is another smart contract, making this a token transfer. In return, the contract gets back an equal value of WETH.
Because Elan wants ETH not WETH, the Sushi smart contract then interacts with the WETH smart contract and exchanges the WETH for ETH (unwrapping it), creating an internal transaction since the WETH smart contract sent ETH to the Sushi smart contract.
Next, the Sushi contract sends this ETH back to Elan, as another internal transaction (Sushi smart contract sent ETH to external address, Elan).
(3) and (4) are internal transactions and not token transfers because ETH (not an ERC 20 token) is being exchanged, and they aren't external transfers because these are smart contracts sending the ETH (not account addresses).
Now that you have a sense of just how complex it is to explain what an internal transfer is, imagine trying to obtain them, in real time. Doesn't sound pretty.
Despite having significant implications, when it comes to obtaining internal transactions, things can get real tricky. Smart contracts can trigger many layers of internal contract calls under the hood, some that don't even have value associated with them.
In addition, internal transactions aren't stored on-chain in the same way that ETH and token transactions are, requiring users to trace each call from the parent transaction to each child in order to obtain them. Even worse, to execute this type of trace, developers need access to a specific kind of expensive and error prone software called a Parity Trace node, which takes weeks to sync.
Give users real-time insights into their transactions, every step of the way
With notifications for external, token, and internal transactions, users can get the complete picture of where their money is, at all times. Wallets now have the power to notify their users each time a transfer occurs that relates to their account even for complex internal transactions. These notifications also give developers more information about the smart contracts they are building and interacting with.
Setting up notifications for all three types of transactions is easy when you use Alchemy. Unlock access to Alchemy Notify in minutes by creating a free account here.
Take 3 Minutes to start getting transaction notifications (instead of 3 weeks)
Instead of syncing up your own Parity Trace nodes and waiting weeks to be able to use them, simply integrate with Alchemy in 3 minutes.