State, Transactions, and Blocks

Published by Mario Oettler on

Last Updated on 3. May 2023 by Martin Schuster

Since Ethereum is a blockchain, it contains blocks. Blocks contain the transactions, and due to their strict order, they represent the transaction history. Transactions in a block are ordered too.

The Block

An Ethereum block contains the following data: [Source: https://ethereum.org/en/developers/docs/blocks/]

Timestamp:  The time when the block was mined in seconds from unix epoch.

Block number:  The length of the blockchain in blocks when the block was created.

Difficulty:  The hashing or staking effort required to mine the block given in a hexadecimal number.

Nonce: A value that needs to be found in combined with the mixHash, to prove that the block was mined through proof of work.

mixHash: A unique identifier for that block.

Parent hash: The hash of the block that came before the current block.

Transactions root:  The hash of all transactions included in this block. A Merkle tree is used to calculate the hash.

State root: The hash of all account balances, contract storage, contract code, and account nonces. The hash is calculated using a Merkle/Patricia tree. The hash function is keccak256.

Receipt hash: The hash of the recipient information.

Source: https://www.lucassaldanha.com/ethereum-yellow-paper-walkthrough-2/

Transactions

Transactions contain several informations like:

Nonce: unique number of a transaction per account.

gasPrice: Amount of ETH paid for one unit of gas.

gasLimit: Max amount of gas a user is willing to spend in this transaction.

to: Recipient

value: Amount of ETH sent in this transaction to the recipient.

signature: v, r, s

init (optional): Used when a contract is created

data (optional): input data of the message call.

The State

In contrast to Bitcoin, Ethereum maintains a state. You can imagine the state as a large sheet of paper, where all balances, variables, and smart contracts are stored. A transaction changes the state.

We can express this as a formula:

Y(S, T)= S’

S is the old state

T is a transaction S’ is the new state

This is a major difference to bitcoin, where the “state” consists of unspent transaction outputs.

The state itself is a huge data structure that is called a modified Merkle-Patricia-Trie.

On the top of the Merkle-Patricia Trie, we have the root. And this root is part of the block that is confirmed by the miners.

Categories:

https://blockchain-academy.hs-mittweida.de/wp-content/uploads/2021/04/logo_bcam_rgb_gross.png

Welcome

Blockchain Academy

Continue with credential

No account yet?

Powered by Hidy

Register with Hidy


Register
Sign in

We need the following credential to register:

please select:

To create a new account, we need the following data from you:

We would appreciate the following additional information from you for the creation of your account:

Welcome

Blockchain Academy

Continue with credential

Already have an account?

Powered by Hidy

Sign in with Hidy


Register
Sign in

We need the following credential to log in:

please select:
Do you need assistance?
Click here to open chat.

Privacy Notice: This chat sends your questions to an external AI server.
How can we help you?
  • Please note: All questions, chat history, and feedback are sent to an external AI server for processing. Do not share sensitive personal information.

    All responses are generated by AI. Independently verify and fact-check all information before use.
  • No Chat History yet, start talking...