Cover photo

Inside an Ethereum Transaction

Follow the Flow of ETH in this Easy-To-Understand Walkthrough of an Ethereum Transaction

When you send ETH to a friend, or exchange tokens on Uniswap, or even participate in a DAO vote, various things happen in the background to make it all possible. To better understand that process, it’s important to remember how the Ethereum network operates. The Ethereum blockchain is a distributed state machine, which means that every node in the Ethereum network maintains an up-to-date state of all the accounts.

What Happens When You Send 1 ETH to a Friend?

Let’s say I hold 3 ETH and I want to send 1 ETH to my friend Anne. Once my transaction is complete, the state of my account will reduce by 1 ETH and Anne’s account will show 1 ETH.

Example of a blockchain’s state pre- and post-transaction

As shown above, the state of both our accounts is updated in the subsequent block once the transaction is complete. If this transaction were to fail, there would not be any state change. A successful transaction just updates the state of the blockchain. It’s very common to think that ETH actually flows between accounts, but this is not the case. In our example, one account is debited and the next is credited. This is made possible by the transaction.

Understanding a Transaction Structure

A transaction is a cryptographically signed set of instructions that tells Ethereum what to do. So in our example above, using MetaMask as an interface, I am able to create a transaction that tells the blockchain to give Anne 1 ETH of mine. The transaction would include the following information:

  1. from: This is the ETH address of the sender who will sign the transaction. In this case, this is my wallet address. The more technical term is “externally owned account” (EOA).

  2. recipient: This field specifies the receiving ETH address. If the recipient is an externally owned account, the transaction will transfer the token value (ETH). If it is a contract account, the transaction will execute the code of the contract. In our example, this is a simple EOA.

  3. signature: The signature serves as the identifier of the sender. It is generated by the sender's private key when signing the transaction, ensuring that the sender has authorized this particular transaction.

  4. nonce: The nonce is a counter that increases sequentially and indicates the transaction number associated with the sender's account. So if this is my second transaction from this account, the nonce will likely be 2.

  5. value: This denotes the amount of ETH to be transferred from the sender to the recipient, expressed in WEI units.

  6. input data: This is an optional field that allows for the inclusion of supplementary data if needed. It could be a random message. Some people already use this field to send messages onchain.

  7. gasLimit: The gas limit specifies the maximum amount of gas units that the transaction can consume. The Ethereum Virtual Machine (EVM) defines the gas units required for each computational step.

  8. maxPriorityFeePerGas: This represents the maximum price of gas consumed, which is included as a tip to the validator.

  9. maxFeePerGas: This field indicates the highest fee the sender is willing to pay for each unit of gas during the transaction (inclusive of baseFeePerGas and maxPriorityFeePerGas).

In order for me to send Anne 1 ETH, the transaction instructions look something like this:

from: “0x5f2e4AEFa7E042d3cC01E5DA41828EAe547CDbbb”,
to: “0xac03bb73b6a9e108530aff4df5077c2b3d481e5a”
gasLimit: “21000”,
maxFeePerGas: “300”,
maxPriorityFeePerGas: “10”,
nonce: “2”, value: “10000000000”
input: “here’s 1 ETH Anne, enjoy!”

When you send funds from your MetaMask to another wallet, you’re essentially constructing this set of instructions. MetaMask is simply providing an interface to make the process user friendly.

Once these instructions have been defined and submitted, the following actions take place:

  1. A transaction hash is generated. We commonly refer to this as “tx hash” or “tx ID”.

  2. The transaction is broadcast to the network and put into a pool with other pending transactions. This pool is not organized.

  3. A validator or “block builder” within the network selects the transaction and includes it in a block for verification. When they are including it in the block this is where they organize them. During this process, a user can pay a higher gas fee to ensure they get priority in this block ordering process (this is generally where MEV comes in).

  4. Once verified, the block containing your transaction goes through two stages: “justified” and then “finalized.” In these stages, the blockchain’s state is updated. This is when a transaction is fully confirmed.

Diagram of the Ethereum transaction process.

A transaction’s basic lifecycle

And that’s how you’re able to transfer funds to another wallet!

There are other steps in the process that are not detailed in this article as they require a more technical understanding of the Ethereum system. If you would like to dive into this I recommend checking out the Ethereum development documentation.

This article was published in collaboration with the BanklessDAO Writers Cohort.

Author Bio

0xKimberly is investing in DeFi with Bankless Ventures, building for fun at buildspace, and is here for research and personal amusement.

Editor Bio

trewkat is a writer, editor, and designer at BanklessDAO. She’s interested in learning about crypto and NFTs, with a particular focus on how best to communicate this knowledge to others.

Designer Bio

Chameleon is a designer and creator in the web3 space.

BanklessDAO is an education and media engine dedicated to helping individuals achieve financial independence.

This post does not contain financial advice, only educational information. By reading this article, you agree and affirm the above, as well as that you are not being solicited to make a financial decision, and that you in no way are receiving any fiduciary projection, promise, or tacit inference of your ability to achieve financial gains.

Bankless Publishing is always accepting submissions for publication. We’d love to read your work, so please submit your article here!

Collect this post to permanently own it.
IndyPen CryptoMedia logo
Subscribe to IndyPen CryptoMedia and never miss a post.