L6 - Ethereum Basics Flashcards
Who invented Ethereum?
Vitalik Buterin
Since when does Ethereum exist?
2014
What is the yellow paper?
technical specifications of Ethereum
How many more Ethereum transactions are there per day compared to Bitcoin?
6x more
How many wallets are there in Ethereum and in Bitcoin with at least 1 incoming or outgoing transaction?
Ethereum 188m
Bitcoin 81m
Is the world computer owned by a single entity?
No
q
q
What is a virtual machine?
VMs are mechanisms for creating instances of software that imitate real machines.
What is stored on the EVM?
All Ethereum accounts and smart contracts are stored on this virtual machine.
How can an EVM be specified?
By the tuple:
block_state, transaction, message, code, memory, stack, pc, gas
What is block_state?
block_state represents the global state of the whole blockchain including all accounts (controlled by private key), smart contracts and their storage
Does Ethereum use an account-based ledger?
Yes. Each distinct address represents a separate unique account
Two types of Ethereum accounts and what they are controlled by.
- Accounts that are controlled by private keys and owned externally
- Smart contract accounts which are controlled by their code
How are the accounts called that are controlled by a private key?
Externally Owned Accounts (EOA)
What is always the origin of a transaction?
An EOA
properties of EOA
- do not have any code stored on the blockchain.
- the default wallet of a user. It can :
- sign transactions
- issue smart contract
- function calls
What are the properties of smart contracts?
- treated as account entities with their own, unique address
- can send messages to other accounts, both externally controlled and smart contracts
- can’t issue a transaction themselves
- they have persistent internal storage for reading and writing
4-tuple account properties
(nonce, balance, contract_code, storage)
nonce = an increasing number that is attached to any transaction to prevent replay attacks balance = the current account balance of the account in Ether contract_code = bytecode representation of the account. If no contract code is present, then the account is externally controlled (EOA). storage = only contract accounts can have their own storage
What is a transaction in Ethereum?
signed data package that is always sent by a EOA
What does a transaction contain?
- recipient of the transaction
- signature identifying the sender
- amount of ether to be transferred
- optional data field - used for function call arguments
- GASLIMIT
- GASPRICE
What is the GASLIMT
representing the maximum amount of gas you are willing to consume on a transaction
GASPRICE
represents the fee the sender pays per computational step
Two types of transactions
From EOA to EOA & from EOA to smart contract
What is the difference between a message and a transaction?
Messages are only sent by contracts and exist only virtually. i.e. they are not minted into a block like transactions are.
Whenever a contract calls a method on another contract, a virtual message is sent.
What does a message contain?
- sender of the message (implicit)
- recipient of the message
- amount of ether to transfer
- optional data field
- GASLIMIT
What is send when an EOA calls a method on a contract?
A transaction is sent.
How does bytecode look like? (code representing the contract in EVM)
For the EVM a smart contract is a sequence of opcodes similar to assembly code
what is memory in EVM like?
an infinitely expandable byte array that is non-persistent and used as temporal storage during execution
what is stack in EVM like?
The stack is also used as a fast, non-persistent buffer to which 32 byte values can be pushed and popped during execution.
what is pc in EVM like?
the program counter is always initialized with 0 and points to the position of the current opcode instruction.
how to free up space from the blockchain?
By using the opcode selfdestruct (address). Negative gas is used because it frees up space from the blockchain.
Is the size of a block limited in Ethereum?
No. Instead the miner sets the gaslimit that defines how much computational resources he is willing to provide for each block.
According to the new EIP-1559 Transaction how is the gas price calculated?
It is now divided into two parts:
- base fee: calculated by the network based on the demand level (burnt)
- priority fee (tip): determined by the transaction sender (received by the miner)
transaction fee = gas * (basefee + tip)
How high is the transaction fee round about in %?
1%
What does ASIC resistancy mean?
The mining algorithm the coin is using does not have an ASIC solution that is superior to the traditional CPU and graphics card solution for mining.
How is the PoW algorithm called in Ethereum?
Ethash
How high is the mining reward in Ethereum?
2 ether (ETH). The reward is a digital token called ether. The block reward is the transaction fee + mining reward.
When is the mining difficulty adjusted?
After each block
Are blocks orphaned in Ethereum?
No. Correctly mined blocks that are outpaced by a block of another miner are not orphaned like in Bitcoin but added as uncle blocks.
- The idea behind this is to counter mining centralization because miners who mine a correct block are still rewarded
- transactions in the uncle block are invalid
Average block time in Ethereum?
12-14 seconds
Does each smart contract have its own address?
Yes. It is an account holding object.
What information is publicly accessible from a smart contract?
- Address of the smart contract
- OPCODE
- Number of public functions and their hash signature
- whole transaction history is accessible (function calls + actual arguments)
- cannot be patched once deployed
Can smart contracts access data from outside the blockchain themselves?
No. This is on purpose to prevent non-deterministic behavior.
How can smart contracts use external data?
By using oracles.
What is an oracle?
Third-party service that verifies data from web services and writes data via a special smart contract to the blockchain. Other smart contracts can now call the oracle to get the data.
Is the oracle contract on chain?
Yes. The oracle service which is connected to an external web API however is off-chain. The oracle service writes data to the oracle contract.
4 use cases for smart contracts
- Fungible token systems
- non-fungible tokens (NFTs)
- Play-to-Earn Games
- Decentralized Autonomous Organization (DAO)
What is a DAO?
- non-hierarchical business models that are collectively owned by a group of members. Like a generalization of multi-sig wallets.
Full node
Full nodes are the foundation of the Ethereum network. Each full node holds a copy of the entire blockchain and syncs with other nodes. Transactions must be sent to a full node which distributes it among the network participants.
Light node
A light node is a client connected to a full node for the sake of not having to sync and download the entire blockchain. For most private people, light nodes are the most comfortable way to interact with the blockchain.
Solo miner
Entity that tries to mine a block on its own. At the current hash rate it is practically impossible.
Do all nodes use the same code base in Ethereum?
No, since the specification for an Ethereum node is open source.
What are the two major Ethereum implementations?
Geth:
- most commonly used implementation. Implemented in Go
OpenEthereum:
- browser based
How does peer discovery work in Geth and OpenEthereum?
- They both have a maintained list of default peers hardcoded into their source code. Otherwise, it would be possible that no nodes are found.