Ethereum Transactions

In this article, we learn about Ethereum Transactions, their components, how they are initiated and verified.

Table of Contents.

  1. Introduction.
  2. Components of an Ethereum Transaction.
  3. Initiating Transactions.
  4. Verifying Transactions.
  5. Summary.
  6. References.


Cryptography and Bitcoin.
Hashing Securely


To make sure that the transactions are valid, we need the following;

  • First, we need accounts and account addresses that are unique, this enables easy identification of participants on the blockchain network. On the bitcoin blockchain, wallet addresses are used to identify a participant.
  • We also need to make sure transactions are signed by the sender by means of digital signatures which are generated using asymmetric public-key cryptography.
  • Finally we need to make sure that the transactions are immutable, meaning they cannot be changed or that two transaction hashes don't result in a similar hash.

The above can be implemented by a combination of hashing and public-key cryptography which we have discussed in the prerequisite article.

The following image shows how hashing is used in Bitcoin to maintain the integrity of the blockchain.


Above, we can see three blocks, each block except the first links to its predecessor. We can also see a Merkle tree which is comprised of transactions that are also hashed. The root of the tree is a combination of all transaction data in the block. This means that if a single transaction is mutated, the root hash of the tree changes. If the root hash of the tree changes, the block header hash also changes, and since it is not what the subsequent block(previous hash) knows, the block with the mutated transaction is invalidated and can no longer participate in the blockchain until the transaction is rectified.

Components of an Ethereum Transaction.

As we know, using the blockchain is not free, this is used as a security measure to prevent infinite loops. For example, in Bitcoin, every transaction on the blockchain pays fees, in the same way, all transactions on the Ethereum blockchain pay fees in terms of gas.

Gas is the measurement for computing power that is used to execute smart contract code. In a decentralized system such as a blockchain, miners maintain the blockchain and in turn, are paid for their efforts. On Ethereum, miners are paid in Eth to process all transactions on the network.

For example, sending ETH to a recipient changes the network state to reflect that ownership is transferred from the sender to the recipient. For this transaction to go through, a miner's participation is required and the sender has to include the needed fees in the transaction otherwise it won't be processed. This means that the parties that initiate the transactions pay the fees for the transaction.

Components of an Eth transaction
For someone to initiate a transaction on the Ethereum blockchain, he/she would have to include the following information;

  • Recipient - the address of the person who will receive the funds being sent to him/her.
  • Signature - this is the digital fingerprint of the sender that serves as proof that the sender indeed initiates the transaction.
  • Value - the amount of Eth being sent to the recipient.
  • Data - this is arbitrary data that the sender wishes to include in the transaction e.g company name, user name, or any message.
  • Gas Limit - this is the maximum amount of gas units the transaction can consume.
  • MaxPriorityFeePerGas - this is the maximum amount of gas that can be given to the miner as an incentive for his/her efforts.
  • MaxFeePerGas - this is the maximum amount of gas that can be offered in exchange for the transaction.

Initiating Transactions.

In Ethereum, accounts can be EOAs(Externally Owned Accounts) or contracts accounts.

Externally owned account(EOA)
The creation of an EOA is free and these accounts can be used to initiate transactions on the blockchain or trigger the execution of smart contract code on the blockchain.
Also, transactions between EOAs can only be in ETH token transfers.
This account does not have a smart contract code associated with them.
It is controlled using a private key.

Contract Accounts.
The creation of a contract account has a cost because of the storage provided by the network. These accounts can only send transactions as a response to receiving transactions.
In addition to this, a transaction from an EOA to a contract account triggers smart contract code that can perform operations on the blockchain. Operations include creating a new contract or initiating the transfer of tokens.

Both these accounts also have similarities, for example;

  • Both accounts are generated using a combination of digital private keys, Ethereum addresses, and digital signatures.
  • Both accounts can send, receive and hold Ether on the Ethereum blockchain.
  • Both accounts can interact with the smart contracts deployed on the blockchain.

To generate an account address, first, we generate a 256-bit private key, the private key is locked using a passphrase. We then use the ECDSA(Elliptic Curve Algorithm) algorithm to generate a public key. Finally, a hashing function is applied to the public key, this results in an account address.

Now, to be able to transfer value to other parties, the transaction should be;
authorized - a transaction must be authorized by the sender. The sender's private key should remain secret.
non-repudiable - non-repudiation is important to the blockchain, to handle this issue digital signatures are used. This makes sure that transactions are valid.
Unmodifiable - we have seen two hashing methods, simple hashing, and keccak hashing, these are used to prevent transactions from tampering, this is achieved through a tree whose root is a result of the collective hashing of original input grouped into leaf nodes.

Once a receiver receives a transaction, he/she can recompute the hash of the original data and compare it with the received hash. This makes sure the document is valid and upholds integrity. In our case, the data is the transaction, first, we hash the data fields of the transaction, next we encrypt the hash using the private key of a participant who initiates the transaction, and now we have digitally signed the transaction to authorize and make it non-repudiable. The hash is included in the transaction and can be verified by other participants who decrypt it using the sender's public key and the recomputing the transaction hash. We then compare the computed hash with the hash received as a digital signature.

If they match, the transaction is valid and accepted otherwise it is rejected.

Verifying Transactions.

On the Ethereum blockchain, to make sure that transactions are valid, the following are checked;
timestamp, these show that the transaction existed at a specified time. It also proves the event took place.
nouce, which stands for 'number only used once* is a number that is added to a hashed transaction, meaning when the transaction is rehashed, it should meet the difficulty levels.
Account balances as mentioned, for a transaction to go through the sender, must have the funds he/she intends to send.
Sufficient fees, miners who maintain the network also have to be paid a fee, this is also included in the transaction.

Other criteria include;

  • The transaction syntax and data structure are valid.
  • Valid transaction inputs and outputs.
  • The transaction should be smaller than the MAX_BLOCK_SIZE.
  • The transaction size should also be greater than or equal to 100 bytes.
  • None of the inputs have a hash equal to 0 or 1.
  • Number of signatures in the transactions is less than the signature operation limit.
  • A matching transaction in the pool or block in the main branch must exist.
  • For all inputs, if the referenced output exists in another transaction, the transaction is rejected.
  • Also if the sum of input values is less than the sum of output values, the transaction is rejected.
  • If the gas fees are too low than required.
  • Unlocking scripts validate their corresponding locking scripts.

These among many other criteria are checked to ensure a transaction is valid.


Ethereum accounts can be EOAs(Externally Owned Accounts) or contracts accounts.
For a transaction to be executed on the Ethereum blockchain it has to be authorized meaning that the sender must consent to funds being transferred from his/her account to a recipients account, non-repudiable, meaning that the sender cannot later deny sending the funds to the recipient, to ensure this, digital signatures which are a generated using the sender's privately owned key are used to sign the transaction, finally, the transaction has to be unmodifiable, the hashing and cryptography used to generate blocks on Ethereum make sure that if a transaction has been modified, the block is invalidated and the modifier pays for his/her actions by losing the reward or stake.
Digital signing in blockchains involves the hashing of data and then encrypting the hashed data using a private key.


How safe blockchains are