Unlocking Ethereum Transactions: Your Guide to Sending Value on the Blockchain

Nova Novriansyah
Novai-Blockchain 101
5 min readMay 7, 2024

--

In the realm of Ethereum, transactions play a crucial role in updating the network’s state. Whether you’re sending Ether (ETH) to a friend or interacting with a smart contract, understanding transactions is essential. Let’s dive into the basics in a simple and accessible way.

What is a Transaction?

Technically, transactions are cryptographically signed instructions from accounts. An account will initiate a transaction to update the state of the Ethereum network.

Imagine Ethereum transactions as signed instructions from accounts, initiating actions on the blockchain. These actions range from transferring ETH between accounts to executing complex smart contracts.

An Ethereum transaction refers to an action initiated by an externally-owned account, in other words an account managed by a human, not a contract

Transactions, which change the state of the EVM, need to be broadcast to the whole network. Any node can broadcast a request for a transaction to be executed on the EVM; after this happens, a validator will execute the transaction and propagate the resulting state change to the rest of the network.

Transactions require a fee and must be included in a validated block. To make this overview simpler we’ll cover gas fees and validation elsewhere

Understanding Gas

Gas is the fuel that powers transactions and smart contract executions on Ethereum. It represents the computational work required by validators to process transactions. Users pay a fee for this computation, with unused gas refunded.

Metamask wallet

Simple transfer transactions require 21000 units of Gas.

So for Bob to send Alice 1 ETH at a baseFeePerGas of 190 gwei and maxPriorityFeePerGas of 10 gwei, Bob will need to pay the following fee:

(190 + 10) * 21000 = 4,200,000 gwei
--or--
0.0042 ETH

Bob's account will be debited -1.0042 ETH (1 ETH for Alice + 0.0042 ETH in gas fees)

Alice's account will be credited +1.0 ETH

The base fee will be burned -0.00399 ETH

Validator keeps the tip +0.000210 ETH

Gas is required for any smart contract interaction too.

Types of Transactions

  1. Regular Transactions: Simple transfers of ETH from one account to another.
  2. Contract Deployment Transactions: Transactions used to deploy smart contracts, where the data field contains the contract code.
  3. Execution of a Contract: Interactions with deployed smart contracts, with the contract address specified in the transaction.

Transaction Lifecycle

Once submitted, a transaction undergoes several stages:

  1. Generation of Transaction Hash: A unique cryptographic identifier for the transaction. 0x97d99bc7729211111a21b12c933c949d4f31684f1d6954ff477d0477538ff222
  2. Broadcasting to the Network: The transaction joins a pool of pending transactions awaiting validation.
  3. Inclusion in a Block: Validators select transactions to include in blocks, verifying and executing them.
  4. Block Finalization: Blocks containing transactions are justified and finalized, ensuring their immutability on the blockchain.

Typed Transaction Envelope

Ethereum supports multiple transaction types, allowing for the implementation of new features without affecting legacy formats. This is facilitated by EIP-2718, which defines a structured envelope for transactions.

Breaking Down a Transaction

{
from: "0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8",
to: "0xac03bb73b6a9e108530aff4df5077c2b3d481e5a",
gasLimit: "21000",
maxFeePerGas: "300",
maxPriorityFeePerGas: "10",
nonce: "0",
value: "10000000000"
}

A typical Ethereum transaction involves:

  1. Sender and Receiver: The sender initiates the transaction, while the receiver is the intended recipient of the value being transferred. This value could be ETH or data for a smart contract.
  2. Signature: A unique identifier generated when the sender’s private key signs the transaction, ensuring its authenticity.
  3. Nonce: A counter indicating the transaction number from the sender’s account, preventing replay attacks.
  4. Value: The amount of ETH to be transferred, measured in wei (the smallest unit of ETH).
  5. Gas Limit: The maximum amount of computational work the transaction can perform, measured in gas units.
  6. Fee Parameters: Including maxFeePerGas and maxPriorityFeePerGas, determining the transaction fee paid to validators for processing the transaction.

Transaction object needs to be signed using the sender’s private key. This proves that the transaction could only have come from the sender and was not sent fraudulently. With the signature hash, the transaction can be cryptographically proven that it came from the sender and submitted to the network.

An Ethereum client like Geth will handle this signing process.

Example JSON-RPC call:

{
"id": 2,
"jsonrpc": "2.0",
"method": "account_signTransaction",
"params": [
{
"from": "0x1923f626bb8dc025849e00f99c25fe2b2f7fb0db",
"gas": "0x55555",
"maxFeePerGas": "0x1234",
"maxPriorityFeePerGas": "0x1234",
"input": "0xabcd",
"nonce": "0x0",
"to": "0x07a565b7ed7d7a678680a4c162885bedbb695fe0",
"value": "0x1234"
}
]
}

Example response:

{
"jsonrpc": "2.0",
"id": 2,
"result": {
"raw": "0xf88380018203339407a565b7ed7d7a678680a4c162885bedbb695fe080a44401a6e4000000000000000000000000000000000000000000000000000000000000001226a0223a7c9bcf5531c99be5ea7082183816eb20cfe0bbc322e97cc5c7f71ab8b20ea02aadee6b34b45bb15bc42d9c09de4a6754e7000908da72d48cc7704971491663",
"tx": {
"nonce": "0x0",
"maxFeePerGas": "0x1234",
"maxPriorityFeePerGas": "0x1234",
"gas": "0x55555",
"to": "0x07a565b7ed7d7a678680a4c162885bedbb695fe0",
"value": "0x1234",
"input": "0xabcd",
"v": "0x26",
"r": "0x223a7c9bcf5531c99be5ea7082183816eb20cfe0bbc322e97cc5c7f71ab8b20e",
"s": "0x2aadee6b34b45bb15bc42d9c09de4a6754e7000908da72d48cc7704971491663",
"hash": "0xeba2df809e7a612a0a0d444ccfa5c839624bdc00dd29e3340d46df3870f8a30e"
}
}
}

Data field

The vast majority of transactions access a contract from an externally-owned account. Most contracts are written in Solidity and interpret their data field in accordance with the application binary interface (ABI).

The first four bytes specify which function to call, in this case 0xa9059cbb

You can sometimes identify the function from the selector using this database(opens in a new tab).

Conclusion

Understanding Ethereum transactions empowers users to navigate the blockchain with confidence. Whether you’re sending value to a friend or interacting with decentralized applications, transactions are the backbone of Ethereum’s decentralized ecosystem. By grasping the fundamentals outlined here, you’re well-equipped to embark on your journey into the world of Ethereum transactions.

--

--

Nova Novriansyah
Novai-Blockchain 101

CEH, CC, CBP, Google Machine Learning Cert, Tensorflow, Unity Cert, Arduino Cert, AWS Arch Cert. A CTO, IT leaders, tech digital enthusiast. Platform owners