Podcast
Questions and Answers
Which of the following best describes Ethereum's primary function?
Which of the following best describes Ethereum's primary function?
- A decentralized platform that executes programs called smart contracts. (correct)
- A digital currency designed to be a peer-to-peer electronic cash system.
- A secure network for transferring traditional financial assets.
- A distributed ledger for recording Bitcoin transactions.
What is the purpose of 'ether' in the Ethereum network?
What is the purpose of 'ether' in the Ethereum network?
- To meter and constrain execution resource costs. (correct)
- To reward developers who contribute to the Ethereum codebase.
- To serve as the primary voting mechanism for network governance.
- To provide a discount on transaction fees.
According to Nick Szabo's definition, what is a key component of a smart contract?
According to Nick Szabo's definition, what is a key component of a smart contract?
- A handshake agreement to foster good business relationships.
- A set of promises specified in digital form, including protocols for execution. (correct)
- An informal understanding between parties to collaborate on a project.
- A legally binding agreement enforced by a court of law.
What is a critical characteristic of smart contracts that is enabled by blockchain technology?
What is a critical characteristic of smart contracts that is enabled by blockchain technology?
In the context of Ethereum, what is an EOA?
In the context of Ethereum, what is an EOA?
Which component is NOT considered a part of the data associated with an External Account (EOA) in Ethereum?
Which component is NOT considered a part of the data associated with an External Account (EOA) in Ethereum?
What distinguishes a Contract Account from an Externally Owned Account in Ethereum?
What distinguishes a Contract Account from an Externally Owned Account in Ethereum?
What is the significance of the storageRoot
in an Ethereum Contract Account?
What is the significance of the storageRoot
in an Ethereum Contract Account?
In Ethereum, what is the purpose of a transaction?
In Ethereum, what is the purpose of a transaction?
Which action can an Ethereum transaction NOT perform?
Which action can an Ethereum transaction NOT perform?
What does the 'nonce' represent in the context of an Ethereum transaction?
What does the 'nonce' represent in the context of an Ethereum transaction?
What is the role of 'gas' in Ethereum transactions?
What is the role of 'gas' in Ethereum transactions?
What happens if a transaction runs out of gas before completing its execution?
What happens if a transaction runs out of gas before completing its execution?
How is the gasCost
of an Ethereum transaction calculated?
How is the gasCost
of an Ethereum transaction calculated?
What is the destination address for a 'Contract Creation' special transaction?
What is the destination address for a 'Contract Creation' special transaction?
What must an originator do to sign a transaction in Ethereum?
What must an originator do to sign a transaction in Ethereum?
What does it mean for transactions on Ethereum to be 'atomic'?
What does it mean for transactions on Ethereum to be 'atomic'?
What is the primary role of a Solidity compiler?
What is the primary role of a Solidity compiler?
What does the pragma solidity ^0.5.7;
statement specify in a Solidity contract?
What does the pragma solidity ^0.5.7;
statement specify in a Solidity contract?
What is the significance of the constructor
keyword in a Solidity contract?
What is the significance of the constructor
keyword in a Solidity contract?
What is the purpose of a modifier
in Solidity?
What is the purpose of a modifier
in Solidity?
What is the purpose of payable
keyword in a Solidity function definition?
What is the purpose of payable
keyword in a Solidity function definition?
In Solidity, what is a mapping
?
In Solidity, what is a mapping
?
What security risk is Ethereum's 'Gas' mechanism primarily designed to mitigate?
What security risk is Ethereum's 'Gas' mechanism primarily designed to mitigate?
What is a key difference between Bitcoin's Script language and Ethereum's smart contract languages?
What is a key difference between Bitcoin's Script language and Ethereum's smart contract languages?
What problem is overcome in Ethereum by charging a fee per computational step?
What problem is overcome in Ethereum by charging a fee per computational step?
In Proof-of-Stake (PoS) systems, what primarily determines a node’s chance of minting new digital tokens?
In Proof-of-Stake (PoS) systems, what primarily determines a node’s chance of minting new digital tokens?
What potential issue can arise from Proof-of-Stake consensus mechanisms?
What potential issue can arise from Proof-of-Stake consensus mechanisms?
Which of the following is the smallest denomination of Ether?
Which of the following is the smallest denomination of Ether?
If someone sends ether to your Ethereum address, which component of your account is directly incremented?
If someone sends ether to your Ethereum address, which component of your account is directly incremented?
What is the first step to take in order to create a transaction on the Ethereum network?
What is the first step to take in order to create a transaction on the Ethereum network?
After building a transaction data structure but before broadcasting, what cryptographic operation must be performed?
After building a transaction data structure but before broadcasting, what cryptographic operation must be performed?
Why does every transaction on Ethereum need to specify an estimate (gasLimit
) of the amount of gas it will spend?
Why does every transaction on Ethereum need to specify an estimate (gasLimit
) of the amount of gas it will spend?
Once a smart contract is deployed on the Ethereum blockchain, can its code be changed?
Once a smart contract is deployed on the Ethereum blockchain, can its code be changed?
Which language is specifically designed for developing smart contracts on the Ethereum blockchain and is also the most popular?
Which language is specifically designed for developing smart contracts on the Ethereum blockchain and is also the most popular?
Serpent is a language similar to which language for developing smart contracts and compiling to EVM bytecode?
Serpent is a language similar to which language for developing smart contracts and compiling to EVM bytecode?
What is the purpose of the require
keyword in a Solidity Modifier?
What is the purpose of the require
keyword in a Solidity Modifier?
Flashcards
Ethereum
Ethereum
Ethereum is an open source, globally decentralized computing infrastructure that executes programs called smart contracts. It uses a blockchain to synchronize and store the system's state changes, along with a crypto-currency called ether to meter and constrain execution resource costs.
Smart Contract
Smart Contract
A set of promises, specified in digital form, including protocols within which the parties perform on these promises.
Ethereum Blockchain and Gas
Ethereum Blockchain and Gas
Halting Problem (infinite loop): Cannot tell whether or not a program will run infinitely from compiled code. Solution: charge fee per computational step to limit infinite loops and stop flawed code from executing
Proof-of-Stake
Proof-of-Stake
Signup and view all the flashcards
Contract Account
Contract Account
Signup and view all the flashcards
Gas Price
Gas Price
Signup and view all the flashcards
Fee paid by a transaction
Fee paid by a transaction
Signup and view all the flashcards
Gas Limit
Gas Limit
Signup and view all the flashcards
Ethereum Transactions
Ethereum Transactions
Signup and view all the flashcards
Study Notes
Seminar 4: Blockchain Technology Basics II – Ethereum and Smart Contract
- Readings: Mastering Ethereum Ch 1, 2 & 7
Agenda
- Quick introduction of Ethereum
Ethereum History
- An open-source and globally decentralized computing infrastructure which executes programs called smart contracts.
- It uses a blockchain to synchronize and store the system's state changes.
- Ether is a crypto-currency used to meter and constrain execution resource costs on the Ethereum network.
Smart Contract
- A set of promises, specified in digital form, including protocols within which the parties perform on these promises (Nick Szabo, 1996)
Creating a Wallet
- Creating a password is required for Metamask.
Ethereum vs. Bitcoin
- Next section in the slide deck compares Ethereum and Bitcoin.
Bitcoin Performance Bottleneck
- Consensus latency: 60 minutes.
- TPS: 7 transactions per second (TPS) based on a block size of 1MB.
- Visa: average 2,000TPS with a peak of 56,000 TPS.
- Solutions to performance bottlenecks include speeding up block generation, and increasing block size.
Turing-Complete
- Bitcoin blockchain's programming language: Script.
- Script expressions use reverse polish notation.
- Processed using stacks and postfix algorithm.
- Limited to only Boolean output (e.g., either true or false).
- Script language is also known as a non-Turing Complete language.
- The language is designed without complex constructs such as loops and conditions, which limits its ability to create general purpose programs.
- This is by design as it avoids the risks of bad programming such as infinite loop from bringing down the entire network.
- Turing completeness is a mathematical concept and is a measure of the computability of a programming language.
Ethereum Blockchain - Gas
- Halting Problem (infinite loop): cannot tell whether or not a program will run infinitely from compiled code.
- Solution: charge fee per computational step to limit infinite loops and stop flawed code from executing.
Proof-of-Stake vs. Proof-of-Work
- Increasing the chance of a node's success in minting new digital tokens in proportion with the number of digital tokens already owned by the node.
Proof of Stake
- This approach does not require large expenditures on computing and energy.
- Miners are now "validators" and post a deposit in an escrow account.
- The more escrow you post, the higher the probability you will be chosen to nominate the next block.
- If you nominate a block with invalid transactions, you lose your escrow.
- One issue with this approach is that those that have the most Ethereum will be able to get even more.
- This leads to centralization eventually.
- It reduces the chance of a 51% attack and allows for near instant transaction approvals.
Important Concepts
- Next section in the slide deck discusses important concepts.
Ethereum Blockchain - Ether Denominations
- Wei (lowest denomination) is named after Wei Dai, author of b-money paper (1998) and core concepts used in BTC implementation, it is 1/1,000,000,000,000,000,000 (quintillion).
- Szabo is the denomination after Wei, named after Nick Szabo, the author of Bit-Gold
- Finney is the 2nd highest denomination and is named after Hal Finney
- Hal Finney received the first Tx from Nakamoto.
Ethereum Blockchain – Accounts and Wallets
- Accounts: can be external or contract accounts, consist of a public/private keypair, and allow for interaction with the blockchain.
- Wallets: a set of one or more external accounts used to store/transfer ether
Ethereum Blockchain – Accounts and Wallets, External Account (EOA, Valid Ethereum Address)
- Has an associated nonce (amount of transactions sent from the account) and a balance
- codeHash - Hash of associated account code, i.e. a computer program for a smart contract (hash of an empty string for external accounts, EOAs)
- Storage Root is root hash of Merkle-Patricia trie of associated account data
Ethereum Blockchain – Accounts and Wallets, Contract Account
- Ethereum accounts can store and execute code
Example Account
- Private Key: 0x2dcef1bfb03d6a950f91c573616cdd778d9581690db1cc43141f7cca06fd08ee. Ethereum private keys are 66 character strings (with Ox appended). Case is irrelevant. Same derivation through ECDSA as BTC.
- Address: 0xA6fA5e50da698F6E4128994a4c1ED345E98Df50. Ethereum Private keys map to addresses directly. Simply the last 40 characters of the Keccak-256 hash of the public key. Address is 42 characters total (append Ox to front).
Ethereum Blockchain – Transactions
- A request to modify the state of the blockchain.
- Can run code (contracts) which change global state
- Contrasts only balance updates in BTC.
- Signed by originating account.
- Types of transactions: send value from one account to another, create a smart contract and execute smart contract code.
Ethereum Blockchain - Transactions
- Nonce is Scalar value equal to the number of transactions sent from this address or, in the case of accounts with associated code, the number of contract-creation made by this account, a sequence number, issued by the originating EOA, used to prevent message replay.
- Gas price: the price of gas (in wei) the originator is willing to pay
- The recipient is the destination Ethereum address
- Value: the amount of ether to send to the destination
Ethereum Blockchain - Gas
- Gas issues from the Halting problem (infinite loop) as it cannot tell whether or not a program will run infinitely from compiled code
- Solution: Charge fee per computational step to limit infinite loops and stop flawed code from executing.
- Every transaction needs to specify an estimate of the amount of gas it will spend.
- Essentially a measure of how much one is willing to spend on a transaction, even if buggy.
- Gas Price: current market price of a unit of Gas (in Wei)
- Check gas price:
- https://ethgasstation.info/ (retired); https://etherscan.io/gastracker
- Is always set before a transaction by user
- Gas Limit: maximum amount of Gas user is willing to spend
- For simple payments that transfer ether from one EOA to another EOA, it is fixed at 21,000 gas units. 21,000 * gasPrice = fee.
- If the destination address is a contract -> fuel tank in your car/ credit account for a gas station
- Gas Cost (used when sending transactions) is calculated by gasLimit*gasPrice.
- All blocks have a Gas Limit (maximum Gas each block can use)
Ethereum Blockchain - Transaction
- Transmitting Value to EOAs and Contracts
- To EOAs: update state
- To contract: EVM will execute the contract and will attempt to call the function named in the data payload of your transaction
- Transmitting a Data Payload to an EOA or Contract most likely addressed to a contract address - data will be interpreted by the EVM as a contract invocation
- Special Transaction: Contract Creation sent to a special destination address called the zero address 0x000000000000000000000000000000000000dEaD
Ethereum Blockchain- transaction signing
- To sign a transaction in Ethereum, the originator must:
- Create a transaction data structure, containing nine fields: nonce, gasPrice, gas Limit, to, value, data, chainID, 0, 0.
- Produce an RLP-encoded serialized message of the transaction data structure.
- Compute the Keccak-256 hash of this serialized message.
- Compute the ECDSA signature, signing the hash with the originating EOA's private key.
- Append the ECDSA signature's computed v, r, and s values to the transaction.
Transaction Facts
- Transactions are signed messages originated by an externally owned account, transmitted by the Ethereum network, and recorded on the Ethereum blockchain.
- Transactions are the only things that can trigger a change of state, or cause a contract to execute in the EVM.
- Ethereum is a global singleton state machine, and transactions are what make that state machine "tick," changing its state.
- Contracts do not run on their own. Everything starts with a transaction.
- Transactions are atomic, and execute in their entirety, with any changes in the global state recorded only if all execution terminates successfully.
Smart Contract Programming
- Solidity: a language similar to JavaScript which allows you to develop contracts and compile to EVM bytecode. It is currently the flagship language of Ethereum and the most popular.
- Solidity Documentation - Solidity is the flagship Ethereum high level language that is used to write contracts, as well as offer a Solidity online realtime compiler
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.