0%
HomeBlogTechnical
Internal Transactions: Notify Your Users About All Their Crypto Transactions

Internal Transactions: Notify Your Users About All Their Crypto Transactions

Author: Elan Halpern

Reviewed by Brady Werkheiser


Published on March 30, 20213 min read

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?

Illustration of user receiving push notifications on mobile for My Ether Wallet DApp.
With Alchemy Notify, users can receive push notifications for internal application transactions.

Internal Transaction Notification

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

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

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.  

  1. First, she interacts with the Sushi smart contract, sending the smart contract her Sushi tokens, through a token transfer. 

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

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

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

  1. Sign up for Alchemy

  2. Create a webhook with a URL and relevant addresses (we also have an API to create new webhooks)

  3. Alchemy sends you notifications

  4. Your users stop worrying about the state of their crypto trades

Section background image

Build blockchain magic with Alchemy

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.

Get your API key