- Ethereum is a world computer.
- Ethereum is a combination of A Singular World State+ A Virtual Machine.
- World State is a collection of all States.
- A State is a collection of Blocks.
- The World State is stored as a Patricia Merkle Trie as per Recursive Length Prefix(RLP) spec in a mini Database.
- Only a Virtual Machine can add a new State.
- The Virtual Machine needs fuel to execute instructions and the fuel is ‘Ether’ to prevent rogue actions.
- RLP-E is a set of rules to encode a item or a list of items.
- RLP-E has different set of rules based on the size of the payload.
- Strings are denoted as byte arrays.
- Empty strings, lists have a predefined value.
- RLP-E is used due its capability to compact data and is simple.
- Encoding "dog" with RLP-E will be [ 83 64 6F 67 ]. 80->: String,length = 83-80
- RLP-D is the opposite of Encoding.
- RLP-D converts RLP-E to its original.
- [ 83, 64, 6F, 67 ] -> "dog".
- Key in ethereum can be thought of as a map .
- Follow the path layed out by the Key to get to a Value.
- Key Value pair can be represented as { k, v }.
- E.g: { a77712345, 0.02 }, where k->: "a77712345" and v->: "0.02"
- Trie is a data structure used by Ethereum.
- Value(RLP-E) is stored as Trie for faster retrieval and search.
- Real life use case for Trie is Auto-Lookup or Auto-Correct feature.
- Ethereum uses a specilized Trie like datastructure called Patricia Merkle Trie(PMT).
- Think of PMT as special and powerful version of Trie.
- Hashing is ideal for speed and uses low disk space.
- { key, value } table search using a hash function is faster and uses less disk space.
- A cryptographic hash function is a particular type of hash function.
- Ethereum currently implements the “Keccak” Cryptographic hash function.
- Keccak is a sponge-like function with Absorb and Release features.
- A block is a data structure comprised of {Block Header, Transaction List, Ommers List}.
- A Block header is comprised of of 15 fields,some being { ParentHash,Root of {state,txns,recipts} }.
- The root fields e.g: stateRoot is a trie data structure.
- The root field is a 256 byte Keccak hash.
- A series of blocks creates a Blockchain.
- LogsBloom is a Block Header field.
- LogsBloom field is a global event indicator for the Block Header.
- Bloom Filter algorithm is the mechanism for the LogsBloom field.
- Ethereum specifies a specialized Bloom Filter algorithm.
- A Genesis Block is the Block 0 state of the Blockchain.
- Genesis Block has pre-defined values, agreed by the ecosystem.
- A Transaction in Ethereum has sender and reciever.
- Transaction Trie root points to all the transactions in that Block.
- Transactions fields v,r,s identify the sender address.
- A transaction has sender and reciever.