Podcast
Questions and Answers
Which of the following programming languages is Turing-complete and designed for writing smart contracts on Ethereum?
Which of the following programming languages is Turing-complete and designed for writing smart contracts on Ethereum?
- Go
- Solidity (correct)
- Bitcoin Script
- JavaScript
What is the primary role of miners in the Ethereum network?
What is the primary role of miners in the Ethereum network?
- Validating transactions and producing blocks (correct)
- Executing smart contracts
- Maintaining account balances
- Storing the entire blockchain ledger
Approximately how long does it take to generate each block in the Ethereum blockchain?
Approximately how long does it take to generate each block in the Ethereum blockchain?
- 1 minute
- 10 minutes
- 1 hour
- 15 seconds (correct)
What metadata is contained within a block header in the Ethereum blockchain?
What metadata is contained within a block header in the Ethereum blockchain?
What is the 'nonce' in the context of a block header?
What is the 'nonce' in the context of a block header?
What role does the Ethereum Virtual Machine (EVM) serve in the Ethereum ecosystem?
What role does the Ethereum Virtual Machine (EVM) serve in the Ethereum ecosystem?
What is the purpose of EVM bytecodes?
What is the purpose of EVM bytecodes?
What is the maximum number of decimal places to which 1 ETH can be subdivided?
What is the maximum number of decimal places to which 1 ETH can be subdivided?
What term is used to describe the 'fuel' required to perform any transaction on the Ethereum network?
What term is used to describe the 'fuel' required to perform any transaction on the Ethereum network?
To whom do transaction fees go?
To whom do transaction fees go?
What happens if a transaction requires more gas than the specified limit?
What happens if a transaction requires more gas than the specified limit?
If a transaction uses less gas than the specified limit, what happens to the excess gas?
If a transaction uses less gas than the specified limit, what happens to the excess gas?
In what unit is the gas price always defined?
In what unit is the gas price always defined?
How do miners decide whether to process a transaction?
How do miners decide whether to process a transaction?
What is the fixed gas limit required for a simple ether transfer transaction?
What is the fixed gas limit required for a simple ether transfer transaction?
What term is used to describe the accounts a wallet can hold?
What term is used to describe the accounts a wallet can hold?
Which of the following is true of both Externally Owned Accounts and Contract Accounts?
Which of the following is true of both Externally Owned Accounts and Contract Accounts?
How long is an Ethereum account address, in bytes?
How long is an Ethereum account address, in bytes?
What does 'off-chain' mean in the context of wallet creation?
What does 'off-chain' mean in the context of wallet creation?
Which type of account needs an EOA account to be created or used?
Which type of account needs an EOA account to be created or used?
What is the purpose of Abstract Binary Interfaces (ABIs) in the context of Ethereum smart contracts?
What is the purpose of Abstract Binary Interfaces (ABIs) in the context of Ethereum smart contracts?
Which of the following initiates the transaction first, so that contracts can initiate other transactions?
Which of the following initiates the transaction first, so that contracts can initiate other transactions?
What is the term used to describe transactions initiated by contracts?
What is the term used to describe transactions initiated by contracts?
What happens when transferring ETH from one EOA to another EOA?
What happens when transferring ETH from one EOA to another EOA?
What is specified by the 'Nonce' transaction field?
What is specified by the 'Nonce' transaction field?
What is the role of the transaction hash?
What is the role of the transaction hash?
What happens when a transaction initiator sets the gas price too low?
What happens when a transaction initiator sets the gas price too low?
What is a 'successful transaction'?
What is a 'successful transaction'?
Which of the following are true about 'mainnet'?
Which of the following are true about 'mainnet'?
What is required to deploy and test contracts on Testnets?
What is required to deploy and test contracts on Testnets?
What characteristic defines smart contract code after its deployment on the blockchain?
What characteristic defines smart contract code after its deployment on the blockchain?
What type of transactions does storage space have limitations?
What type of transactions does storage space have limitations?
What should the transaction initiator pay, to execute a smart contract's logic?
What should the transaction initiator pay, to execute a smart contract's logic?
What is a result of DAO Smart Contract hack?
What is a result of DAO Smart Contract hack?
What is the current Ethereum's consensus algorithm as of July 2024?
What is the current Ethereum's consensus algorithm as of July 2024?
To become a validator, what does the Stake ETH do?
To become a validator, what does the Stake ETH do?
What is the approximate Ethereum's block time?
What is the approximate Ethereum's block time?
Approximately how long does it take to finalize blocks?
Approximately how long does it take to finalize blocks?
What is the purpose of the miners/validators' ability to vote to increase or decrease the gas limit?
What is the purpose of the miners/validators' ability to vote to increase or decrease the gas limit?
How much gas is required for a simple ETH transfer?
How much gas is required for a simple ETH transfer?
What are Gas Costs for Opcodes?
What are Gas Costs for Opcodes?
Flashcards
What is Ethereum?
What is Ethereum?
Ethereum is an open source, public, and decentralized computing platform that is an implementation of blockchain technology.
Bitcoin Scripts Functionality
Bitcoin Scripts Functionality
Scripts in Bitcoin have limited functionalities, making complex scripts difficult to write.
Solidity's Capability
Solidity's Capability
Ethereum's scripting language, Solidity, is Turing-complete and allows for the creation of complex smart contracts.
Full Node in Blockchain
Full Node in Blockchain
Signup and view all the flashcards
What are Miners?
What are Miners?
Signup and view all the flashcards
What is the genesis block?
What is the genesis block?
Signup and view all the flashcards
What is Block Header?
What is Block Header?
Signup and view all the flashcards
What is Parent Hash?
What is Parent Hash?
Signup and view all the flashcards
What is Nonce?
What is Nonce?
Signup and view all the flashcards
What is Timestamp?
What is Timestamp?
Signup and view all the flashcards
What is Transactions Root?
What is Transactions Root?
Signup and view all the flashcards
What is EVM?
What is EVM?
Signup and view all the flashcards
What is Wei?
What is Wei?
Signup and view all the flashcards
What is gas in Ethereum?
What is gas in Ethereum?
Signup and view all the flashcards
What are bytecodes?
What are bytecodes?
Signup and view all the flashcards
What is gas price?
What is gas price?
Signup and view all the flashcards
What is gas limit?
What is gas limit?
Signup and view all the flashcards
What is extra gas?
What is extra gas?
Signup and view all the flashcards
What is the gas price?
What is the gas price?
Signup and view all the flashcards
Fixed gas limit
Fixed gas limit
Signup and view all the flashcards
What are EOAs?
What are EOAs?
Signup and view all the flashcards
What are Contract Accounts (CA)?
What are Contract Accounts (CA)?
Signup and view all the flashcards
What do the accounts hold?
What do the accounts hold?
Signup and view all the flashcards
How are keys made?
How are keys made?
Signup and view all the flashcards
What is a transaction's main purpose?
What is a transaction's main purpose?
Signup and view all the flashcards
What are internal transactions?
What are internal transactions?
Signup and view all the flashcards
What does Nonce specify?
What does Nonce specify?
Signup and view all the flashcards
What is Transaction Hash?
What is Transaction Hash?
Signup and view all the flashcards
What is Pending Status?
What is Pending Status?
Signup and view all the flashcards
What is a Successful Transaction?
What is a Successful Transaction?
Signup and view all the flashcards
What is Fail status?
What is Fail status?
Signup and view all the flashcards
What is Dropped Status?
What is Dropped Status?
Signup and view all the flashcards
Change Transaction Fields
Change Transaction Fields
Signup and view all the flashcards
Cancel Transactions
Cancel Transactions
Signup and view all the flashcards
What are testnets?
What are testnets?
Signup and view all the flashcards
What is mainnet?
What is mainnet?
Signup and view all the flashcards
What are faucets?
What are faucets?
Signup and view all the flashcards
What is etherscan.io?
What is etherscan.io?
Signup and view all the flashcards
What do Smart Contracts allow users?
What do Smart Contracts allow users?
Signup and view all the flashcards
What is Contract Code? (Immutable)
What is Contract Code? (Immutable)
Signup and view all the flashcards
Study Notes
Introduction to Ethereum
- Proposed in 2013 by Vitalik Buterin.
- First production release was in 2015.
- Ethereum is an open source, public, decentralized computing platform.
- It's popular due to the features of its smart contracts.
Smart Contracts and Solidity
- Bitcoin scripts are not Turing-complete, and Bitcoin scripts have limited functionalities making complex scripts difficult to write
- Ethereum makes writing complex smart contracts easy.
- Solidity: Turing-complete language used for writing smart contracts.
Nodes
- Full nodes maintain the complete blockchain ledger data structure.
- Full nodes verify every block and transaction using defined consensus rules.
- Lightweight nodes verify transactions using Simple Payment Verification (SPV).
- SPV doesn't require downloading the entire blockchain because it only downloads header info.
- Miners execute and verify transactions.
- Miners contribute computing/storage resources and receive block rewards and transaction fees.
Blocks
- The blockchain maintains a series of blocks, linked together.
- The first block is called the "genesis block."
- Blocks contain multiple transactions
- Blocks are generated using a consensus algorithm.
- Each block is generated in approximately 15 seconds.
- Miners who generate blocks are rewarded.
- Each block has a defined gas limit.
- Transactions in a block cannot exceed the block's gas limit. The blockheader contains metadata about the block and the previous block.
Block Header Fields
- Parent Hash: Points to the previous block.
- Nonce: Number found that solves the cryptographic puzzle
- Timestamp: The time the block was added to the blockchain.
- Transactions Root: Keccak 256-bit hash of the root node of the tree structure (populated with each transaction).
Ethereum Virtual Machine (EVM)
- EVM: Runtime environment for smart contracts.
- Ethereum supports multiple scripting languages.
- Smart contracts compile/convert to EVM bytecodes.
- Bytecodes are executed by EVM to perform smart contract operations.
Ether (ETH)
- Ether is a fungible coin, and is divisible into smaller units.
- 1 ETH has a maximum of 18 decimal places and the smallest value is called wei.
- Ether fuel for the Ethereum network.
- Gas is paid in ether, which is consumed when a transaction is executed
- Transaction fees go to the miners.
- Solidity supports wei, finney, szabo, and ether units.
Gas
- Gas is the fuel used on the Ethereum blockchain and it is paid in ether.
- Gas price and limit must be specified for each transaction.
- The network calculates the transaction fee based on gas price and limit.
- Each EVM bytecode operation has fixed gas units.
- Executing operations consumes a fixed quantity of gas.
- If a transaction uses less gas than the limit, excess gas is refunded.
- Transactions consuming all gas that need more, will fail and gas will be consumed as part of the transaction fees.
- Gas price is the cost per gas unit is defined in gwei.
- Miners process transactions based on gas price.
- An ETH transfer requires 21,000 gas limit per transaction.
Accounts
- Two account types exist: Externally Owned Accounts (EOA) and Contract Accounts (CA).
- Both EOAs and CAs can hold ETH balances.
- Account addresses are written in hexadecimal (starting with "0x") and are 20 bytes (160 bits) long.
- Ethereum wallets can hold multiple EOAs.
- New private keys are generated using specific algorithms by wallet creation services.
- Public keys are derived from private keys.
- The combination of public and private keys is an EOA.
- EOAs are controlled by private keys, which are used to start transactions.
- Wallets are created via off-chain wallet generation algorithms.
- Contracts only have public addresses, and their code logic controls funds' flow
- An EOA account is necessary to create/interact with a contract.
- Contract accounts have Solidity code that defines behavior.
- Contract accounts can only be created on-chain.
- Contract bytecode is included in block during successful deployment.
Transaction
- Transactions transfer ETH from EOA for smart contracts.
- They can change state, perform actions, or read contract states.
- Transactions can only be initiated from an EOA and then initiate other internal transactions.
- Users first complete required fields to create a tx.
- Then they sign the transaction with the EOA's private key.
Transaction Fields
- From: Public address of EOA initiating the transaction.
- Transactions initiated by contracts are internal transactions.
- To: Public address of an EOA or contract.
- Value: Transactions can have zero or nonzero value.
- Set to nonzero when sending ETH to an EOA.
- When initiating a transaction to a contract, the value field either has a zero or nonzero based on the contract function.
- Gas limit and gas price must be specified
- Nonce: Starts at zero for an EOA and increases by one for each transaction, specifying execution order.
- Data: It will be empty when transferring ETH one EOA to another EOA.
- To execute another method the data field will hold hexadecimal value of the method and its arguments.
- Transaction Hash is the SHA-256 hash of the signed transaction data.
- The transaction can be tracked with this ID and dropped before it gets executed.
Transaction Status
- A transaction can have below statuses:
- Pending: Waiting to be executed; may take longer if gas price is too low.
- Transaction initiators are allowed to change transaction fields by sending a new transaction with the same nonce.
- Successful: Executed successfully w/o failure.
- Fail: Executed with a contract method execution error or due to low gas limit.
- Dropped: Transactions get dropped for different reasons that includes pending status and low gas price.
- Gas and ETH are returned to wallets with a dropped transaction.
Pending Transaction Operations
- To change initiated transaction fees/ fields, the value can be changed and keeping the same gas price.
- A transaction can be canceled by initiating self transaction.
- New transactions must have higher gas to be given priority over older one.
Testnets
- Testnets replicate the mainnet (production) Ethereum blockchain.
- Ether is required to deploy and test contracts on testnets.
- Testnet ethers can be acquired from a faucet for free.
- Contracts can locally tested by Private Testnet setup or Ganache.
Smart Contracts
- Nick Szabo coined the term "smart contract" in 1994.
- Smart contracts eliminate intermediaries, allowing direct P2P transactions.
- They automatically enforce some obligations.
- Smart contract code is immutable once deployed.
- A different mindset is required for smart contract creation.
Immutable Code
- Smart contract code cannot be changed. However, states and variables can be.
- Smart contract code behavior changes based on states and variables.
- There is no way to the reverse a state change of a smart contract.
Storage and Gas
- Smart contract storage is costly.
- The ethereum blockchain cannot handle large amounts of data.
- Execution of transactions is limited by gas limit per block.
- Every transaction that sends ether consumes gas.
- Transaction initiators must pay gas in ether for executing smart contract logic
Hacks
- DAO Smart Contract hack that occurred in June 2016, which lead to 3.6 million ETH theft worth $50 million.
- The hack lead to Ethereum (ETH) and Ethereum Classic (ETC).
- Parity Multisignature Wallet Hack that happened in 2017 resulted in millions of dollars lost, due to vulnerability in the Parity wallet.
Consensus
- Ethereum's consensus algorithm is Proof of Stake (PoS), specifically Gasper - effective as of July 2024.
- To become a validator lock up 32 ETH.
- Operate a Beacon Chain and Execution Layer client.
Block Time and Block Reward
- Ethereum's block time (PoS) is about 12 seconds.
- Blocks must be finalized after 12.8 minutes.
- Block reward in PoS is dynamic and is based on the amount of ETH staked and validator participation.
- The base reward is estimated as ~0.025 ETH per block (dependent upon total ETH staked).
Gas Limit
- This is a consensus parameter defined to limit the amount of computation that can be included in a block, it's known as Gas Limit per Block.
- The gas limit is defined in a range of 30 millio gas (as of 2024).
- The gas limit per block is defined to balance network throughput, resource usage, and decentralization.
- This can be manually adjusted by Miners/validators that can vote increase or decrease it.
Transaction Fee
- Gas for ETH Transfer: is estimated 21,000 gas.
- Extra gas for data or smart contract interactions is defined as Additional Costs.
- Gas Costs for Opcodes such as EVM operations are also components that increase the amount of gas required
- In order to ensure fair pricing, prevent abuse, as well as maintain network stability gas is measured as a fee.
- Opcodes in general have variable costs based on input size or context which also affect gas consumption.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.