Inside an Ethereum transaction

0xKimberly
4 min readAug 2, 2023

When you send ETH to a friend, make a swap on uniswap, or even participate in a DAO vote, various things happen in the background to make it all possible. In this article, we will uncover what those things are.

Before we get to that, it’s important to remember how the Ethereum network works. 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 want to send 1 ETH to my friend Anne. Once my transaction is complete, the state of my account will show -1 ETH and Anne’s account will show +1 ETH.

As shown below, 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. It’s important to understand that 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 meta mask as an interface, I would be 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 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 address. If the recipient is an externally-owned account, the transaction will transfer value (ETH). If it is a contract account, the transaction will execute the code of the contract. In our case, 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 2nd transaction from this account, my nonce will probably 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 arbitrary data if needed. It could be a random message!
  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)

With this, in order for me to send Anne 1 ETH, I would need to construct a transaction that looks something like this:

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

When you send funds from your meta mask to another wallet, you’re essentially constructing this set of instructions. Metamask is simply an interface to make the process more 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 broadcasted to the network and put into a pool with other pending transactions. This pool is not organized.
  3. A validator or a “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 block ordering.
  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

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

There are a lot of nuances in the process that is not captured in this article. That requires a bit more technical understanding of the Ethereum system. If you would like to dive into this I recommend checking out https://ethereum.org/en/developers/docs/.

--

--

0xKimberly

Full time thinker - Investments & Research @ Bankless Ventures