In this article, we learn about the structure of Ethereum accounts, transactions, and blocks.
Table of Contents.
- Accounts on the Eth Block.
- Breaking Down Etherium Transactions.
The bitcoin blockchain state was defined in terms of UTXOs - (Unspent Transaction Output) which we have discussed in this article.
Ethereum on the other hand introduced the concepts of accounts
On the Ethereum blockchain, an account is the source and target of a transaction. Unlike the bitcoin blockchain where every action initiates a transaction, on the Ethereum blockchain a transaction updates the balances on the accounts directly removing the need for an additional transaction.
This allows not only the transfer of value but also the transfer of data and messages between involved accounts. These messages may result in the state transition. Remember, transfers between accounts are implemented using transactions.
A message/transaction will include;
- Transaction nonce - Ethereum has a PoW nonce and a transaction nonce. The latter is incremented each time the account sends a transaction.
- Gas price - This is the price of Gas in Gwei.
- Gas Limit - The gas the sender is willing to pay for the transaction.
- Recipient - The account address of the recipient.
- Value - The amount that is being sent.
- Data - This field is for contract-related operations such as deployment or execution. It has messages which are used to call or execute functions. These messages contain;
** The sender of the message
** The recipient of the message
** The amount of Wei to transfer alongside the message to the contract address
** The contract input data
** The STARTGAS - this limits the maximum amount of gas that can be incurred when executing the contract.
- Digital Signature - This field holds components of the ECDSA(Elliptic Curve Digital Signature).
On Ethereum, there exist two types of accounts, namely; externally owned accounts and contract accounts
Accounts on the Eth Block.
Every account has a coin balance, and accounts can transfer value between themselves or invoke a specified smart contract code. For all these transactions, transferring value or code execution requires fees. This means that an account must have a specified minimum balance to execute code or be able to transfer value to other involved parties.
Fees on the Ethereum blockchain are paid in Wei.
Wei is a lower denomination of the Eth coin, that is, Wei is to the Eth, what cents is to a fiat currency note what.
We can also say that Wei is to Ethereum what satoshis is to Bitcoin, a lower denomination of the cryptocurrency.
1 Ether = 10 ^ 18 Wei
1 Wei = 0.000000000000000001 Ether.
Externally owned accounts.
These accounts are controlled by private keys.
Such accounts are mandatory for participation in the Ethereum blockchain as they are the ones used to interact with the blockchain through transactions.
These represent a smart contract.
These are controlled by solidity code and can only be activated by an externally owned account.
Breaking Down Etherium Transactions.
Every account has a coin balance. Participant nodes can send transactions for two reasons, the first involves the transfer of value in ether, and the second is to invoke smart contract code. The accounts can also do both of the above actions, send ether and execute code.
In either case, fees are required meaning that the account must have sufficient fees for a transaction or code to execute on the Ethereum blockchain.
A typical Ethereum transaction includes the following;
- A recipient of the message.
- A digital signature of the sender that authorizes the transfer.
- The amount of Wei to transfer.
- An optional payload containing a message to a contract.
- The startgas, is a value that represents the maximum number of computational steps the transaction is allowed to perform.
- The gas price, these are fees for computations on the blockchain.
Breaking down an Ethereum Transaction
We will be analyzing an Ethereum transaction that can be found here on the Ethereum blockchain.
We arrive at the above link by navigating to this link and pasting the transaction hash 0xd88b07ee5c3e53c113cb9f8a930a7d4f98dc108838fc468dfdf6774402f5e466. We can also opt to choose a random transaction and analyze it to get a better understanding of eth transactions;
From the transaction we have the following fields;
- A transaction hash - this is the hashing of all transaction details that is unique to this transaction. On Ethereum, the Keccak-256 hashing algorithm is used.
- The status of a transaction - successful transactions have a green success indicator.
- We also have the block height - this is the block in which the transaction is stored on the Ethereum blockchain. To get more information about a specific block, we can navigate to the link provided by the block height number.
- We have from and to account addresses owned by the sender and the recipient.
- The value transferred - in our case $53 was transferred from the sender to the recipient.
- We have the transaction fee - the fee for this transaction was $1. Notice how the fees are extremely low compared to the Bitcoin blockchain?
- Finally we have the gas price - this is the rate of executing such a transaction, in this case, it is 56 Gwei which is equivalent to $0.000000000000145.
Such a transaction usually invokes a smart contract whose execution requires a certain amount of fees - gas.
If you clicked on the block link, to feed your curiosity, let's proceed.
The Ethereum block comprises of;
- A block header.
- Runner up block headers.
Above we have the following important fields:
- The block height - On the Ethereum blockchain, this is the height at which this block is. On top of it, we will have block number 14799764 and below it, we will have 14799762.
- The timestamp - this is the exact time at which the block was mined by a miner whose address is in the mined by field.
- Transactions - This is the number of transactions and smart contracts included in this specific block.
- Mined by - The address of the miner who mined this particular block.
- Block reward - The block reward is awarded to the miner for mining this block. In our case, it is 2.917089559228222432 Ether which is equivalent to $3183.36.
- Difficulty - This is the difficulty of mining the block.
- Total Difficulty - This is the total network difficulty at this point in time or until this block.
- Size - This is the size of the block in bytes. In our case, the block is 173,820 which is equivalent to 0.17382 MBs.
- Gas Used - The total gas used for transactions in this block.
- Gas limit - This is the maximum price an Ethereum user is willing to pay when sending a transaction, or performing a smart contract function, in the Ethereum blockchain.
- Hash - this is the hash that is a summary of all transactions in this particular block. Remember hashing produces a unique fixed-length string regardless of the data passed in.
- Parent Hash - This is the hash of block number 14799762 - the previous block.
- Nonce - This is the number that solves the cryptographic puzzle for mining Ethereum blocks. It is discovered by the winner and other miners use it to validate a block after which a miner is rewarded. This is what miners compete to find to get incentivized.
Accounts are the basic units of the Ethereum protocol. On the Ethereum blockchain, we have two types of accounts, externally owned accounts, and smart contract accounts.
An Ethereum transaction includes not only the transfer of value but also a message that invokes a smart contract. They are invoked by accounts.
An Ethereum block similar to a bitcoin block holds a reference to its predecessor block hash and much more information such as gas fees, the state of the smart contract, and runner-up headers.
The Wei is the smallest denomination of Ethereum.