Ethereum design

Ether

Ether (ETH) is the cryptocurrency generated in accordance with the Ethereum protocol as a reward to validators in a proof-of-stake system for adding blocks to the blockchain. Ether is represented in the state as an unsigned integer associated with each account, this being the account's ETH balance denominated in wei (1018 wei = 1 ether).[50] At the end of each epoch, new ETH is generated by the addition of protocol-specified amounts to the balances of all validators for that epoch, with the block proposers receiving the largest portion. Additionally, ether is the only currency accepted by the protocol as payment for the transaction fee. The transaction fee is composed of two parts: the base fee and the tip. The base fee is "burned" (deleted from existence) and the tip goes to the block proposer. The validator reward together with the tips provide the incentive to validators to keep the blockchain growing (i.e. to keep processing new transactions). Therefore, ETH is fundamental to the operation of the network. Ether may be "sent" from one account to another via a transaction, which simply entails subtracting the amount to be sent from the sender's balance and adding the same amount to the recipient's balance.[51]

Ether is often erroneously referred to as "Ethereum".[52]

Accounts

There are two types of accounts on Ethereum: user accounts (also known as externally-owned accounts) and contracts. Both types have an ETH balance, may send ETH to any account, may call any public function of a contract or create a new contract, and are identified on the blockchain and in the state by an account address.[53]

Contracts are the only type of account that has associated code (a set of functions and variable declarations) and contract storage (the values of the variables at any given time). A contract function may take arguments and may have return values. In addition to control flow statements, the body of a function may include instructions to send ETH, read from and write to the contract's storage, create temporary storage (memory) that vanishes at the end of the function, perform arithmetic and hashing operations, call the contract's own functions or public functions of other contracts, create new contracts, and query information about the current transaction or the blockchain.[54]

Addresses

Ethereum addresses are composed of the prefix "0x" (a common identifier for hexadecimal) concatenated with the rightmost 20 bytes of the Keccak-256 hash of the ECDSA public key (the curve used is the so-called secp256k1). In hexadecimal, two digits represent a byte, and so addresses contain 40 hexadecimal digits, e.g. 0xb794f5ea0ba39494ce839613fffba74279579268. Contract addresses are in the same format, however, they are determined by sender and creation transaction nonce.

Virtual machine

The number of daily confirmed Ethereum transactions as of April 2021

The Ethereum Virtual Machine (EVM) is the runtime environment for transaction execution in Ethereum. It includes, among other things, a stack, memory, gas balance, program counter, and the state (including contract code). The EVM is stack-based, in that most instructions pop operands from the stack and push the result to the stack. The EVM is designed to be deterministic on a wide variety of hardware and operating systems, so that given a pre-transaction state and a transaction, each node produces the same post-transaction state, thereby enabling network consensus. The formal definition of the EVM is specified in the Ethereum Yellow Paper.[25][55] EVMs have been implemented in C++, C#, Go, Haskell, Java, JavaScript, Python, Ruby, Rust, Elixir, Erlang, and soon[when?] WebAssembly.[citation needed]

Gas

Gas is a unit of account within the EVM used in the calculation of the transaction fee, which is the amount of ETH a transaction's sender must pay to the network to have the transaction included in the blockchain. Each type of operation which may be performed by the EVM is hardcoded with a certain gas cost, which is intended to be roughly proportional to the monetary value of the resources (e.g. computation and storage) a node must expend or dedicate to perform that operation.[citation needed]

When a sender is creating a transaction, the sender must specify a gas limit and gas price. The gas limit is the maximum amount of gas the sender is willing to use in the transaction, and the gas price is the amount of ETH the sender wishes to pay to the network per unit of gas used. A transaction may only be included in the blockchain at a block slot that has a base gas price less than or equal to the transaction's gas price. The portion of the gas price that is in excess of the base gas price is known as the tip and goes to the block proposer; the higher the tip, the more incentive a block proposer has to include the transaction in their block, and thus the quicker the transaction will be included in the blockchain. The sender buys the full amount of gas (i.e. their ETH balance is debited the amount: gas limit × gas price) up-front, at the start of the execution of the transaction, and is refunded at the end for any unused gas. If at any point the transaction does not have enough gas to perform the next operation, the transaction is reverted but the sender is still only refunded for the unused gas. In user interfaces, gas prices are typically denominated in gigawei (gwei), a subunit of ETH equal to 10−9 ETH.

https://opensea.io/assets/0xaDEE09a610FEC97C7425B02129D0ad612c56e08C/1