Podcast
Questions and Answers
Which of the following is NOT explicitly specified by a typical Bitcoin transaction, challenging the assumptions of deterministic transaction analysis?
Which of the following is NOT explicitly specified by a typical Bitcoin transaction, challenging the assumptions of deterministic transaction analysis?
- The amount of Bitcoin being transferred in the transaction.
- The input addresses from which the Bitcoin is being spent.
- The output addresses to which the Bitcoin is being sent.
- The exact geographical location of the sender at the time of transaction. (correct)
In the context of Ethereum, what critical role does 'Ether' play beyond being a mere cryptocurrency, particularly in relation to smart contract execution?
In the context of Ethereum, what critical role does 'Ether' play beyond being a mere cryptocurrency, particularly in relation to smart contract execution?
- Ether functions as a governance token, allowing holders to vote on protocol upgrades and changes to the Ethereum Virtual Machine.
- Ether is employed as 'gas' to meter and constrain the computational costs of executing smart contracts, preventing infinite loops and resource exhaustion. (correct)
- Ether is used to directly subsidize transaction fees, making decentralized applications free for users.
- Ether serves exclusively as a store of value, akin to digital gold.
How does Ethereum's design choice to be 'Turing-Complete' introduce a unique challenge not present in Bitcoin's 'non-Turing Complete' Script language, especially concerning resource management?
How does Ethereum's design choice to be 'Turing-Complete' introduce a unique challenge not present in Bitcoin's 'non-Turing Complete' Script language, especially concerning resource management?
- Bitcoin's non-Turing complete nature makes it impossible to implement complex financial instruments, limiting its potential applications. in decentralized finance (DeFi).
- Turing completeness allows Ethereum smart contracts to execute infinitely complex computations, increasing the likelihood of resource exhaustion and the halting problem. (correct)
- Ethereum's Turing completeness simplifies smart contract auditing, reducing the risk of vulnerabilities and unexpected behavior.
- The halting problem is irrelevant in Ethereum because of its Proof-of-Stake consensus mechanism, which ensures all transactions are validated within a bounded time frame.
Considering the dual nature of Ethereum accounts, how does the codeHash differentiate an Externally Owned Account (EOA) from a Contract Account regarding smart contract execution?
Considering the dual nature of Ethereum accounts, how does the codeHash differentiate an Externally Owned Account (EOA) from a Contract Account regarding smart contract execution?
In the context of Ethereum transactions, what is the significance of the 'Data' field when transmitting a data payload to a Contract Account, especially concerning the Ethereum Virtual Machine (EVM)?
In the context of Ethereum transactions, what is the significance of the 'Data' field when transmitting a data payload to a Contract Account, especially concerning the Ethereum Virtual Machine (EVM)?
What specific cryptographic process must occur before broadcasting a transaction in Ethereum, and how does this process ensure non-repudiation by linking the transaction to a specific Externally Owned Account (EOA)?
What specific cryptographic process must occur before broadcasting a transaction in Ethereum, and how does this process ensure non-repudiation by linking the transaction to a specific Externally Owned Account (EOA)?
How does Ethereum's 'Gas Limit' mechanism directly address the 'Halting Problem' inherent in Turing-complete smart contracts, preventing denial-of-service attacks and ensuring network stability?
How does Ethereum's 'Gas Limit' mechanism directly address the 'Halting Problem' inherent in Turing-complete smart contracts, preventing denial-of-service attacks and ensuring network stability?
In the context of Ethereum smart contracts, what is the precise relationship between 'gasPrice', 'gasLimit', and 'gasCost' in determining the overall transaction fee, and how do these parameters influence transaction prioritization on the network?
In the context of Ethereum smart contracts, what is the precise relationship between 'gasPrice', 'gasLimit', and 'gasCost' in determining the overall transaction fee, and how do these parameters influence transaction prioritization on the network?
How would a transaction be constructed to deploy a new smart contract onto the Ethereum blockchain, differing from a transaction that merely calls a function on an existing contract (especially concerning the recipient address)?
How would a transaction be constructed to deploy a new smart contract onto the Ethereum blockchain, differing from a transaction that merely calls a function on an existing contract (especially concerning the recipient address)?
Considering that Ethereum is described as a 'global singleton state machine,' what crucial implication does this have for smart contract execution and the sequence of state changes on the blockchain?
Considering that Ethereum is described as a 'global singleton state machine,' what crucial implication does this have for smart contract execution and the sequence of state changes on the blockchain?
Before a transaction is successfully added to the Ethereum blockchain, what sequence of steps must the originating EOA complete to ensure validity and integrity, especially in the context of transaction data and cryptographic signatures?
Before a transaction is successfully added to the Ethereum blockchain, what sequence of steps must the originating EOA complete to ensure validity and integrity, especially in the context of transaction data and cryptographic signatures?
How does the Solidity programming language facilitate the implementation of access control mechanisms within smart contracts, such as restricting certain functions to be executable only by the contract's owner?
How does the Solidity programming language facilitate the implementation of access control mechanisms within smart contracts, such as restricting certain functions to be executable only by the contract's owner?
In Solidity smart contracts, how can developers handle distributing funds to multiple family members (represented by their wallet addresses) based on pre-defined inheritance amounts, ensuring that the distribution is automatically triggered upon a specific event like the contract owner's death?
In Solidity smart contracts, how can developers handle distributing funds to multiple family members (represented by their wallet addresses) based on pre-defined inheritance amounts, ensuring that the distribution is automatically triggered upon a specific event like the contract owner's death?
Within the Ethereum ecosystem, contrast the functionality and purpose of Solidity
with that of Serpent
, particularly in view of their roles in smart contract development and conversion into EVM bytecode.
Within the Ethereum ecosystem, contrast the functionality and purpose of Solidity
with that of Serpent
, particularly in view of their roles in smart contract development and conversion into EVM bytecode.
Critically analyze the implications of implementing a Proof-of-Stake (PoS) consensus mechanism in blockchain networks, particularly regarding its impacts on energy consumption, decentralization, and vulnerability to 51% attacks, compared to Proof-of-Work (PoW).
Critically analyze the implications of implementing a Proof-of-Stake (PoS) consensus mechanism in blockchain networks, particularly regarding its impacts on energy consumption, decentralization, and vulnerability to 51% attacks, compared to Proof-of-Work (PoW).
How can the 'Wei' be articulated with respect to scaling into denominations with higher numerical exponents with relation to other common denomination names?
How can the 'Wei' be articulated with respect to scaling into denominations with higher numerical exponents with relation to other common denomination names?
What conditions inherently must be met for a smart contract transaction to be deemed atomic
and have its state changes recorded?
What conditions inherently must be met for a smart contract transaction to be deemed atomic
and have its state changes recorded?
Given the concept of function decorators or modifiers in Solidity, how can a programmer restrict the execution of a state-changing function to only external calls?
Given the concept of function decorators or modifiers in Solidity, how can a programmer restrict the execution of a state-changing function to only external calls?
When creating a 'Will' contract, what is the most secure way of ensuring the payout()
is only triggered after death?
When creating a 'Will' contract, what is the most secure way of ensuring the payout()
is only triggered after death?
In reference to pragma solidity ^0.5.7;
, what is the best practice to avoid compiler specificities?
In reference to pragma solidity ^0.5.7;
, what is the best practice to avoid compiler specificities?
Given the statement 'Ethereum is a global singleton state machine', what best describes the impact on smart contract?
Given the statement 'Ethereum is a global singleton state machine', what best describes the impact on smart contract?
If a smart contract does not run correctly, what's the point of Halting problem (infinite loop)
and why is it important?
If a smart contract does not run correctly, what's the point of Halting problem (infinite loop)
and why is it important?
Flashcards
Ethereum
Ethereum
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 and uses Ether to meter resource costs
Smart Contract
Smart Contract
A set of promises, specified in digital form, including protocols within which the parties perform on these promises.
Bitcoin Consensus Latency
Bitcoin Consensus Latency
Time taken for a consensus to be reached and a new block added to the blockchain.
TPS (Transactions per Second)
TPS (Transactions per Second)
Signup and view all the flashcards
Non-Turing Complete Language
Non-Turing Complete Language
Signup and view all the flashcards
Halting Problem
Halting Problem
Signup and view all the flashcards
Proof of Stake
Proof of Stake
Signup and view all the flashcards
Wei
Wei
Signup and view all the flashcards
Ethereum Accounts
Ethereum Accounts
Signup and view all the flashcards
Balance of Account
Balance of Account
Signup and view all the flashcards
CodeHash
CodeHash
Signup and view all the flashcards
Nonce
Nonce
Signup and view all the flashcards
Ethereum Transaction
Ethereum Transaction
Signup and view all the flashcards
Nonce(in transactions)
Nonce(in transactions)
Signup and view all the flashcards
Ethereum Gas
Ethereum Gas
Signup and view all the flashcards
Solidity
Solidity
Signup and view all the flashcards
Study Notes
Seminar 4: Blockchain Technology Basics II - Ethereum and Smart Contracts
- Readings include Mastering Ethereum Ch 1, 2 & 7
- Agenda:
- Quick Introduction to Ethereum
- Ethereum vs. Bitcoin
- Important concepts
- Smart Contract
Ethereum History
- Ethereum is an open-source, globally decentralized computing infrastructure.
- This executes programs called smart contracts.
- It uses a blockchain to synchronize and store the system's state changes.
- A crypto-currency called ether meters and constrains execution resource costs.
Smart Contract
- A smart contract constitutes a set of promises, specified in digital form, including protocols within which the parties perform these promises.
- Nick Szabo defined smart contracts in 1996.
- Wallets can be created by using metamask.
Ethereum vs Bitcoin
- Performance bottleneck of Bitcoin: 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. Overcome solutions by 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 Boolean output, e.g., either true or false
- Script language: a non-Turing Complete language
- Designed without complex constructs such as loops and conditions which limits its ability to create general purpose programs.
- Turing Completeness: a mathematical concept that measures the computability of a programming language.
- This is by design as it avoids the risks of bad programming such as infinite loop from bringing down the entire network
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, stopping 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.
- The proof of stake 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
- An issue with this approach is that those with the most ethereum will be able to get even more
- This leads to centralization eventually
- Reduces the chance of a 51% attack, allowing for near-instant transaction approvals
Important concepts
- Ethereum Blockchain - Ether Denominations:
- Wei - lowest denomination
- Named after Wei Dai - author of b-money paper (1998), many core concepts used in BTC implementation
- 1/1,000,000,000,000,000,000 (quintillion)
- Szabo - next denomination
- Named after Nick Szabo author of Bit-Gold
- Finney – 2nd highest denomination
- Named after Hal Finney
- received first Tx from Nakamoto
Ethereum Blockchain – Accounts and Wallets
- Accounts:
- Two Kinds:
- External Owned Accounts - (EOA, most common account)
- Contract Accounts
- Consist of a public/private keypair
- 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: root hash of Merkle-Patricia trie of associated account data
- Contract Account Ethereum accounts can store and execute code Has an associated nonce and balance codeHash - hash of associated account code storageRoot contains Merkle tree of associated storage data
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:
- Send value from one account to another account
- Create smart contract
- Execute smart contract code A 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-creations 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
- Gas limit
- The maximum amount of gas the originator is willing to buy for this transaction Recipient
- The destination Ethereum address
- Value
- The amount of ether to send to the destination
- Data
- The variable-length binary data payload
- v,r,s
- The three components of an ECDSA digital signature of the originating EOA
Ethereum Blockchain – Gas
- Halting problem (infinite loop) – reason for Gas
- Problem: 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 must 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: the current market price of a unit of Gas (in Wei) Check gas price here: https://ethgasstation.info/; https://etherscan.io/gastracker Is always set before a transaction by user
- Gas Limit: the 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.
Fascinating fact on the transaction
- Transactions are signed messages originated by an externally owned account, transmitted
by the Ethereum network, and recorded on the Ethereum blockchain.
- Another way to look at transactions is that they are the only things that can trigger a change of state, or cause a contract to execute in the EVM.
- Ethereum functions as a global singleton state machine, and what makes it tick" is transactions, they change its state.
- Contracts don't run on their own.
- Ethereum doesn't run alone, everything begins with a transaction.
- Transactions are viewed as atomic. Transactions execute in entirety, global states only record any all execution terminates successfully.
Smart contract code
- 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. Serpent: a language similar to Python which can be used to develop contracts and compile to EVM bytecode. It is intended to be maximally clean and simple, combining many of the efficiency benefits of a low-level language with ease-of-use in programming style, and at the same time adding special domain-specific features for contract programming. Serpent is compiled using LLL.
- Website to use if you'd like to learn more: https://cryptozombies.io/en/lesson/1/chapter/1
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.