Eyes of the World

Share this post

Ethereum Transactions

eyesoftheworld.substack.com

Ethereum Transactions

How everything on Ethereum gets done

Daniel Schlabach
Jul 13, 2021
1
Share this post

Ethereum Transactions

eyesoftheworld.substack.com

Welcome back! Today is Part 1 of 2 in a miniseries on Ethereum transactions and gas fees. Today we're covering transactions. Next week we'll walk through gas fees and how you pay for transactions.

How do Transactions on Ethereum Work?

In some ways, Ethereum is like a giant database from which people can write and read data. Data is stored on blocks that are immutable (unable to be changed). Whenever you write data to the blockchain, you are submitting a transaction.

Some of these transactions are very straightforward. For example, a transaction can be as simple as sending 1 ETH from your wallet to your friend's.

The term transaction implies that you're moving money around from one account to another, but it's not always that way in Ethereum. Any time you interact with a contract to store data on the blockchain, it's a transaction.

Let's say you created a decentralized social media app that was built on Ethereum (not feasible currently due to costs and speed, but let's just pretend). On that social media platform, every time that a user updated their status, they would be making a transaction. The same goes for likes, shares, comments, friend requests, etc. All of this data would be written to the blockchain in the form of transactions.

All of these transactions are signed by the user's private key. Only the account owner can make transactions on the account’s behalf. No one can initiate a transaction from your account because they don't have your private key!

Once a transaction is initiated, it is broadcast to the entire Ethereum network. Anyone with an Ethereum node can broadcast a transaction. Obviously most of us aren't running our own Ethereum nodes, so how do we initiate transactions? If you're using MetaMask, you're actually using MetaMask's nodes to initiate the transaction (most wallet providers, in turn, outsource node management to services like Infura).

Once the transaction is broadcast, a miner (or soon, a validator) will execute the transaction or the smart contract’s code and transmit the result to the rest of the Ethereum network. Miners (or validators) validate transactions and create new blocks where they store the transaction’s data, permanently updating the blockchain. Importantly, for a transaction to be valid, it must be validated by a miner.

One really important thing to know is that it's not free to submit transactions! For a transaction to be processed, we must include some ETH to incentivize miners to include our transactions on their blocks.

Right now, Ethereum (pre-ETH 2.0) can handle around 30 transactions per second. Many more transactions than that are submitted, so miners must choose which transactions they want to include in their blocks. Naturally, they will choose to include the transactions whose fees will make them the most money. If you submit a transaction with a network fee that's too low, no miner will want to include it in their blocks and your transaction will fail.

More on gas fees next week! For now, let's take a closer look at the components of an Ethereum transaction.

What Makes Up an Ethereum Transaction?

From

The from field on a transaction is simply the address of the person initiating the transaction.

Recipient

The recipient field on a transaction is the address receiving the transaction.

The recipient can be either another person's address or a smart contract. If it's a person's address, ETH is simply transferred from one account to another. If the recipient is a smart contract, then the transaction will execute whatever code is contained by the smart contract.

Signature

The signature field is a complex string of numbers and letters that's generated with the sender's private key. The technical details aren't relevant here, but this field is important because it ensures that the sender has approved the transaction.

Value

The value field lists the amount of ETH that is transferred from one address to another. When interacting with a contract, this value is often set to 0 (since you're not sending ETH to the contract itself).

Data

The data field is optional and can be used to include any relevant transaction data.

Gas Limit

The gasLimit helps you control the maximum amount of ETH that you're willing to spend on a transaction. More on this next week.

Gas Price

The gasPrice determines how much ETH you'll pay per unit of gas to execute the transaction. Again, we'll go into this more next week.

Exploring Ethereum Transactions

All of the data on the Ethereum network is public, so you can see all the transactions happening in real-time.

Etherscan is a fantastic website that lets you explore transactions and view the details of a particular transaction.

As an example, here's a transaction that Vitalik Buterin, the creator of Ethereum, recently made.

You can see that Vitalik sent 1,000 ETH (approximately $2.1 million) to the address 0x1aaf2f422f39687459031e6b9a788eccab84d214 on July 1, 2021. You're also able to see that he paid a tiny fraction of 1 ETH (the equivalent of 44 cents!) to execute the transaction.

Here’s a more complex transaction from the time I swapped some ETH for Bancor Network Token (BNT) on Uniswap:

You can look up transaction details for any transaction that's ever taken place on the Ethereum blockchain by going to Etherscan.io.

Next Week

Next week, we're continuing our miniseries on transactions and gas fees. I'll explain gas fees and gas limits in more detail so you can be better informed as you initiate transactions on Ethereum.

Share this post

Ethereum Transactions

eyesoftheworld.substack.com
Comments
TopNewCommunity

No posts

Ready for more?

© 2023 Daniel Schlabach
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing