Ethereum Mastery Flashcards

A fundamental understanding of the ethereum blockchain from first principles. You will gain the rudimentary knowledge needed to build a solid foundation as a blockchain engineer.

1
Q

What is mining ?

A

The process of creating a block of transactions to be added to a proof of work blockchain

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the purposes of mining ?

A
  1. To enforce consensus rules
  2. Currency issuance as a reward to incetivize those who secure the system
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a consensus mechanism ?

A

A set of rules that determine how nodes on the blockchain network, come to agree on the final state of the blockchain.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How is the target difficulty determined in a proof of work blockchain ?

A

The target difficulty is determined by how fast the network is able to produce blocks. The specification determined by the bitcoin standard is 2016 blocks every 2 weeks. If it takes lesser that the 2week period to produce 2016 blocks, it means the difficulty is low and hence is adjusted to a much higher value. The converse is also true.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Briefly describe the mining algorithm

A

Miners run an automated software that solves some computational difficult problem. The algorith is as follows:

  • Get the previous block header and new transactions that should be added to the blockchain
  • Append a nonce counter starting from zero to the data above
  • Hash the data and compare the hash to the target difficulty
  • If the hash is less than the target difficulty, submit the new block
  • Else repeat steps 2 incrementing the nonce at each unsuccessful step
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is proof of work ?

A

It is the mechanism used to ensure security of a blockchain network, by ensuring that miners provide some proof that they expended energy to secure the network mostly, against forgery. This proof is in form of a cryptographic hash, which should be lesser than or equal to some target hash. The proof gurantees that a new block is secure and can be safely added to the blockchain.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What’s the formula or calculating the target in bitcoin ?

A

Since the target is represented in a field called bits as packed hexadecimal, the formula to get the full target is thus

target = coefficient * 2^(8 * (index - 3))
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is Byzantine fault tolerance ?

A

The ability of a decentralized network to continue operating even if some of its nodes fail or act maliciously.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a block chain confirmation ?

A

A confirmation is the process of adding a valid block to the blockchain. For a transaction to be regarded a immutable (tamper proof) it should have additional blocks linked to it. These additional blocks gurantee that the transaction cannot be reversed. Each of these successfully mined blocks counts as a confirmation.

Eg Bitcoin network has a recommended confirmation of 6 which means 6 blocks taking an average time of 1hr. Since a new block is mined every 10mins

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does UTXO stand for ?

A

Unspent Transaction Output, it is the model used by bitcoin to keep track of user balances. UTXO’s are like denominations in a legal tender. You could have N number of bills of different denominations with a combined value of Y. Similarly you cant have X number of UTXO’s with a combined BTC value of Z.

Each UTXO has its own value in BTC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the coinbase param in the bitcoin block ?

A

It is the content of the input for a generation transaction (genesis block)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a Binary Search Tree ?

A

It’s a binary tree with the following properties
1. The keys of nodes to the left of a node are lesser than its key
2. The keys of nodes to the right of a node a greater than its key
3. The left and right subtrees of each node are themselves BSTs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a Merkle Tree ?

A

Also called a hash tree is a binary tree with the following properties;
1. Every leaf node store the hash of some data
2. Every node that is not a leaf, store the hash of its child nodes

The merkle tree provides a way to do efficient verification of data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Why are Merkle Trees useful ?

A

The allow for efficient verification of data, ie finding if some item belongs in a large dataset.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a Merkle root ?

Blockchain !

A

Its the hash derived from the hash of a set of transactions in a block

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the Merkle path ?

A

It is the information required by a user to generate the expected root hash, from the hash of their transaction in a block.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is a Merkle proof ?

A

A Merkle proof verifies the existence of a transaction in a specified block, without the need to examine all the transactions in the block.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is a trie ?

A

A type of search tree that is used for locating specific keys in a set, keys are usually strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is a Radix trie (Patricia Trie) ?

A

A space-optimized trie where every node that is an only child is merged with its parent. The effect is that every internal node has a most r children, where r is the radix of the trie.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is a Patricia merkle trie ?

A

A cryptographically secure datastructure that can be used to store key value bindings. It combines the properties of Merkle trees and patricia tries.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What does Patricia stand for ?

A

Practical algorithm to retrieve information coded in alphanumeric

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What 3 properties are of importance to the etherum in the block header ?

A
  1. state root
  2. transaction root
  3. receipts root
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Where is the state root derived from and what is it’s function ?

A

The state root is derived from the keccack-256 bit hash of the root of the state trie. The state trie stores a mapping of addresses to account state (balance, nonce, codeHash etc)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Where is the transaction root derived from and what is its function ?

A

The transaction root is derived from the keccack-256 bit hash of the root of the transaction trie. The transaction trie stores transactions on the etherum blockchain. It is never updated once a block is validated.

25
Q

Where is the receipts root derived from and what is its function ?

A

The receipts root is derived from the keccack-256 bit hash of the root of the receipts trie. The receipts trie stores the receipts of transactions in the ethereum blockchain.

26
Q

Briefly explain what the Recursive Length Prefix serialization is

A

RLP is a serialization format used by the ethereum blockchain to standardize the transfer of data between nodes in a space efficient manner.

It is a binary encoding format that encodes lists and data, buy encoding their length before the data.

It only encodes structures and leaves the encoding of primitives (strings, integers etc) to higher level protocols

Its

27
Q

What is a state machine ?

A

Its a mathematical model of computation used to describe a system that can be in any of a set of finite states given some inputs.

28
Q

What is Ethereum ?

Technical definition

A

Ethereum is an unbounded state machine that provides access to a singleton global state, with a virtual machine that applies changes to that state.

29
Q

What is Ethereum ?

Practical definition

A

Ethereum is a decentralized computing infrastructure that executes programs called smart contracts;
* It uses a blockchain to synchronize and store system state
* and a currency called ether to meter and constrain execution costs

30
Q

What are 3 properties of the Ethereum blockchain ?

A
  1. Ubiquitous and accessible
  2. Censorship resistant
  3. Verifiable and Auditable
31
Q

What is an abstract machine ?

A

It is a mathematical model of computation used to describe and anaylze how a computer system works.

32
Q

What is a virtual machine ?

A

It as software system that emulates some hardware and allows one to run programs in a platform independent way.

33
Q

Briefly explain the concept of Turing completeness

A

It’s used to describe the property of a system to be able to compute any class of problems that a Turing machine can compute.

34
Q

What is gas in ethereum ?

A

Gas is a unit that measures the computational effort required to execute specific operations on the Ethereum network.

It is payed for using eth.

35
Q

Ethereum’s move to proof of stake was meant to achieve three things what are they ?

A
  1. Better security of the network
  2. More energy efficient
  3. Greater scalability
36
Q

What is Byzantine fault tolerance ?

A

The ability of a system to continue to function when some of its node fail or act maliciously

37
Q

What is finality ?

A

The gurantee that a transaction cannot be altered, reversed or cancelled after it has completed.

38
Q

Ethrereum after the switch to proof of stake introduced new finality states, what are they and briefly explain

A

The new finality states are finalized and safe.
* A finalized block that is crypto-economically secure usually after reaching a final state of 2 epochs (64 blocks)
* A safe block is one that is crypto-economically safe usually at 1 epoch (32 blocks)

39
Q

What is the gas fee in ethereum ?

A

It is the total amount of gas used to execute some operation multipled by the cost per unit gas

40
Q

What are the two types of account in ethereum ?

A
  1. Externally owned accounts
  2. Contract accounts
41
Q

What’s the key difference between an account in ethereum and a UTXO in bitcoin ?

A

The ethereum account has a balance, which is stored in the system’s global state.

42
Q

What is an active account in ethereum ?

A

It is an account that has interacted with the ethereum blockchain.

43
Q

What is a checksum ?

A

It’s a small sized block of data that is derived from some piece of data, for the purpose of detecting errors that could have been introduced during transmission or storage.

44
Q

What is the difference between a node and a client in ethereum ?

A

A node is a computer on the ethereum network that runs the ethereum client software. The ethereum client is an implementation of the evm specification. After the merge nodes are require to run two client software the execution client (Execution engine) and the consensus client (Beacon Node).

45
Q

What are the 3 types of nodes available in ethereum ?

A
  1. Full node
  2. Light node
  3. Archive node
46
Q

How does one change state in the ethereum machine

A

State is changed in ethereum through transactions. Transactions are grouped into blocks, validated and excecuted to create the new state of the system.

47
Q

What makes up the address of a contract account ?

A

The deployer address and the deployer nonce

48
Q

The contract account is made up of two key properties namely ?

A
  • The code hash which is the contract code stored in bytecode format
  • The storage hash which is the root hash of the Merkle Patricia Trie that holds information relevant to the contract
49
Q

What is a transaction ?

A

A transaction is a cryptographically signed intent to change state on the ethereum computer

50
Q

What is a smart contract ?

A

It is a program that runs on the ethereum virtual machine. I shares the following properties;
* Permissionless:meaning anyone can deploy one, the requirement is that some gas i needed to pay for the transaction creating the contract
* Composable: smart contracts can derive functionality from other smart contracts

51
Q

What is a Multisig contract ?

A

It is a smart contrat that requires multiple signatures before a transaction can be executed. It is typically used as a wallet, how ? one may ask. Well smart contracts store their balances on the blockchain and can hold funds, so adding the the ability for mulitple parties to sign a transaction makes it a multisig contract.

52
Q

What problems do Multisig contracts solve for ?

A

The main problem is a single point of failure introduce by having a single EOA (Externally Owned Account) sign transactions on a contract. If this account is compromised then, funds could be lost or stolen. Having multiple parties sign the transaction prevents this from happening, since majority of the required number of signatories will have to be corrrupt before this contract can be compromised.

53
Q

What is the ERC20 Token standard ?

A

The ERC20 token standard is a technical specification that serves as a basis for representing an asset on the Ethereum network.

54
Q

What’s the main aim of the ERC20 Token standard ?

A

The main aim is to increase compatibility in the ethereum ecosystem.

55
Q

What are the basic properties that an ERC20 compliant Token must provide ?

A
  1. name, symbol and decimals state variables
  2. transfer function used to transfer tokens between users
  3. balanceOf function which returns the balance of a user
  4. totalSupply function which returns the total supply of tokens
  5. transferFrom, allowance, and approve functions
56
Q

Whats the formula for computing the storage location of a value in a mapping in solidity.

A
keccac256(h(k) . p)

Where h is a padding function applied to the key k and p is the slot. The dot represents concatenation.

57
Q

How do you compute the storage location for arrays ?

A

We take the kecca256(p) where p is the slot.

58
Q

What is the purpose of delegatecall in solidity ?

A

To call library code that is stored in an external contract. It uses the current contract’s context (account, balances, msg… etc) to execute the external code.

59
Q
A