Ethereum Structure
Welcome crypto dummiez!
If you’re new here, the goal of this substack is educating those of you that know nothing about crypto and blockchain technology.
If that’s you, then you’ve come to the right place!
Last week we went over some of the basics about Ethereum, the EVM, smart contracts, and solidity.
Let’s dive in!
Ethereum Structure
A couple weeks ago we took a deep dive into blockchain tech, its use cases, and some of the structure behind it. Specifically the BTC blockchain and how it works as well as the elements that are involved. If you haven’t checked it out I suggest doing so (its still free!)
This week we will take a look at the Ethereum structure and cover some of the components involved.
The BTC blockchain was defined in terms of UTXO’s and reference implementation of wallet applications that held the account reference.
(Quick diagram to help you understand)
Ethereum formally introduced the concept of an account as being part of the protocol. This allowed for:
The account to be the originator + the target of a transaction
Transactions to directly update the balance of an account
Transfer of value, messages and data between accounts that may result in state transitions
Transfer being implemented using transactions
Formally implementing accounts made the space that much more personalized. Anyone with an account can interact with the Ethereum chain, and creating an account is easier than creating a Facebook account. Accounts give more power to the users as they explore the Ethereum ecosystem and the various dApps and services that are available on the network.
Account Types
There are essentially two different account types on the Ethereum network
Externally owned accounts (EOA)
Contract accounts
Externally owned accounts (EOA) are needed in order to participate in the Ethereum network in general. They are controlled by private cryptographic keys owned by the user. Externally owned account interact with the blockchain through transactions.
Contract accounts are controlled by code, and can only be activated by an externally owned account. Contract accounts represent smart contracts on the blockchain. Every smart contract has a unique address much like externally owned accounts so that users may access it.
Participant nodes (users) can send a transaction to invoke a transfer of ETH, interact with a smart contract, or both. Every account on the network has a coin balance and a unique address so they can interact with other nodes or contracts on the network.
Whether its transferring ETH, calling a smart contract, or interacting with a dApp, both types of transactions require fees.
Fees on the Ethereum network are paid in gwei.
What is GWEI?
To put it in simple terms, gwei is a denomination of the native token on the network, Ether.
1 Eth is equal to 10^18 gwei.
Therefore 1 gwei is equal to 0.000000000000000001 ETH
Ethereum Transactions
All transactions conducted on the Ethereum network must include the following:
Recipient address
Digital signature of the sender authorizing a transfer
Amount of gwei to transfer
An optional data field/message to a contract
STARTGAS (max # of computational steps)
GASPRICE( fee sender is willing to pay for computation)
The typical Ethereum transaction structure should look like this:
TxHash (transaction hash)
Nonce (transaction nonce)
Gas price (price of gas in gwei)
Gas limit (limit of the amount in ETH sender is willing to pay)
Recipient (either EOA or Contract account)
Value (amount of ether/gwei from sender to receiver)
Data (deployment/execution of a contract. Can execute CALL or DELEGATECALL opcodes. If empty typically means transaction was only transfer of value)
V,R,S
Lets take a step back and discuss ‘v, r, s’ in a little more detail.
Ethereum transactions use elliptic curve digital signature algorithm (ECDSA) as a digital signature for verification. V indicates chainID and recoveryID to help the recover function check the signature. R & S are inputs of the elliptic curve digital signature algorithm to generate a signature.
Ethereum Block Structure
To wrap things up for today lets take a look at the Ethereum block structure and break down some of the components. We’ve covered some of these already and some will be familiar to you from my previous post on BTC block structure, but lets dive in.
ETH block structure consists of:
Block Header
Transaction
Runner-up block headers
Block details
Block Height (current # block on the blockchain)
Size (maximum length of block storage in bytes)
Timestamp (timestamp of block)
Transaction hash (hash value of tx)
Gas used (gas used to initiate transfer/smart contract call)
Gas limit (gas limit sender is willing to pay)
Nonce (# added to hash block, when rehashed meet difficulty requirements)
Parent block hash (hash of parent block)
Difficulty (average block difficulty to find hash)
Total Difficulty (total difficulty of the chain up until current block)
Block reward (miner’s compensation)
Today we went into a little more detail on the Ethereum structure.
We discussed how Ethereum implemented accounts as a part of the protocol to allow others to interact with the various dApps on the chain. We covered gwei and transaction fees, and took a moment to break down transaction structure, block headers, block structure and the elements involved.
Next week we will dive into some of the basic Ethereum operations and take a look at the role nodes (users) have to play in the ecosystem.
Hope to see all you crypto dummiez next week!