Fichas
Blockchain Engineering
Fichas del conjunto (127)
- 1What is the difference between the 'longest chain' and the 'highest accumulated weight'The longest chain is a simplified rule to establish consensus - the longest chain is mined by the largest share of computational power(the shar of honest miners).
This simplified rule is not entirely correct:
each block adds a weight to the chain(the difficulty of the block) and the chain with the highest accumulated weight is mined by the larget share of computational power.
/ If the longest chain would win, it would be easy to recalculate from the genesis block until today with a very low(non-increasing) difficulty and surpass the current blockchain --> and then propose the altered blockchain history to the network and win. - 2if an update to the blockchain is Back/Forward compatible - then it is a .......... forka Soft fork is a Back/Forward compatible update.
Older versions of the Bitcoin software will recognize new blocks. - 3The Bitcoin core client specifies a maximum block size of 1MB. is an update enabling block sizes up to 8MB is considered a soft/hard fork?hard fork
- 4The Bitcoin core client specifies a maximum block size of 1MB. is an update restricting block sizes up to 0.5MB is considered a soft/hard fork?soft fork
- 5Proposals can target different layers: ▪ Consensus Layer (how to validate states and history) ▪ Peer Services Layer (propagation of messages) ▪ API/RPC Layer (high-level calls accessible by apps) ▪ Applications Layer (high-level structures) Updates to what layer can result in a hard fork?The terms hard fork and soft fork describe changes within the Consensus layer
- 6Why is 'Signaling phase' used?To check if a majority of the miner community would support a fork.
A fork that is not accepted by the majority of miners leads to two chains(chain split). Then both chains will compete for users. - 7Are 'replay attacks' possible after a chain split?To prevent replay attacks, the new community has to make the new chain/software incompatible with the old chain.
- 8How do miners vote for a proposal?The version-field in the block header contains 32 bit.
A specific bit of this is used to show support of a proposal - 9What is the needed 'threshold' to pass for a proposal to be accepted? without risking a chain splitThe overall support for a proposal has to be higher than a certain threshold (usually 1916 out of 2016 blocks ➔ 95%) in one difficulty period.
- 10What happens when a proposal becomes rejected?Upon a rejection, the community can split (separate the development and go into different directions).
➔This is called a “Chain split” - 11Give two examples of Bitcoin chain splits▪ Bitcoin Cash (8MB blocks instead of 1MB blocks)
▪ Bitcoin Gold (changes in the PoW-algorithm for ASIC-resistance) - 12What is a 51% attack?A single entity controls the majority of the hashing power of the network.
A 51% attack is the worst possible scenario in a Blockchain (based on PoW as consensus mechanism). - 13Why is a 51% attack on Blockchain highly unlikely?As of the high hash power, the attacker is highly invested.
▪ Entities highly invested have no interest in destroying the network, as they profit the most from it.
➔ A successful executed 51 % attack would destroy the trust in the system and with that, the value of the currency in the system. - 14What can a 51% attacker do?51% attack enables
▪ History rewriting: The attacker can build a Blockchain with the highest accumulated value, defining all contents:
▪ Blocking / DoS-ing addresses / users
▪ Collecting all mining rewards
▪ Creating successful double-spending patterns (orphaning many blocks) - 15Can a 51% attacker create Bitcoins?▪ Cannot invent money, also cannot propose invalid blocks or transactions, as they would simply be rejected.
- 16What is a selfish mining attack?A miner exploits the probability to propose two blocks in a row
it's just a smart selfish way of creating the longest chain and keep the mining reward yourself.
You would need a very big mining pool to do this successfully/ though ~ 25% - 17What are the two possible scenarios of selfish mining?Possibility A: The node finds a second block 4A building on its block 3A. The network is still at block 2. When the network finds another block 3B, the attacker publishes both block 3A and 4A, making the new 3B an orphan block. The network has worked on an old chain, practically wasting its power.
- 18What limits the Bitcoin transaction throughput?10 min block rate
1MB max block size
250 byte or 500 byte transaction size
average 380,000 transactions per day, between the upper and lower bound (for each transaction) - 19How fast does the blockchain increase in size(memory)?The Blockchain size increases linearly by at most 1MB(size of a block) every 10 minutes(block rate)
Data storage of the chain is not a problem - 20Does the Bitcoin transaction rate scale?No.
The transaction rate of Bitcoin does not scale. The currency is limited to a maximum of <600.000 transactions/day or ~6.6 transactions/s.
Visa has 250.00.000 transactions/day - 21What is included in the Consensus Layer?How to validate states and history
- 22What is the difference between “Fork” and “Chain Split”?Forks (whether hard or soft forks) are considered as consensus layer changes. These changes can be implemented and accepted by the network or not. If the whole network agrees to a newly proposed hard fork, it gets implemented and accepted, therefore no chain split happened. If a soft fork or a hard fork leads to disagreement in the community, it could lead to a chain split (two independent chains with equal history up to a certain point). Therefore, forks describe the nature of a change (see Slide 6) and a chain split is one potential result of a proposed controversial fork, in which the community decided to split into two chains.
- 23Q: What happens to Bitcoins after a chain split?You could perceive a chain split as the “creation of a second reality”. Before the chain split, there was only one truth, the longest chain. After the split, now two chains exist and therefore two valid states. In both states, a person controls his/her Unspent transaction outputs. If replay attack prevention mechanisms are in place (Slide 9), both coins (in fact, UTXOs) can be spent independently.
- 24Does Ethereum have a higher transaction rate than Bitcoin?Ethereum surpassed Bitcoin in transactions/day(by a factor of 3x) and active wallets(2x)
- 25In Ethereum: A 'transaction' can only be sent by a ....?A Transaction is always sent by a wallet.
Wallet —> (Transaction) —> Smart Contract
Wallet —> (Transaction) —> Wallet
...
A Contract sends a Virtual Message to other Contracts.
Contract —> (Message) —> Contract - 26Define Gasdo it
- 27Define GasPriceThe GasPrice Defines how much Ether you want to pay for 1 Gas.
Measured in GigaWei(Gwei)
The higher the GasPrice, the faster the transaction will be mined and put up on the blockchain. Creating a sub market, competing for the miners computational power. - 28Define StartGasDefines how much Gas in total you are willing to pay in total for the contraxt
A transaction fails if consumes more Gas than defined. - 29Is Ethereum only a crypto currency like Bitcoin?The Ethereum Network:
* Not a currency, it’s a platform.
* Platform providing the Infrastructure for decentralised applications
The currency used to incentivise the network of nodes in Ethereum is Ether.
A user that uploads a smart contract to the network, pay in Ether. - 30What is the programming language of the Ethereum platform?* Solidity, the programming language of Ethereum. Used to write smart-contracts —> the logic that runs the Applications
- 31Explain the Ethereum 'World Computer'The Ethereum Network is a 'World computer' with a. State Machine
—> The Ethereum VM - EVM
The Block state represent all Wallets, Contracts and memory.
Properties:
• All participants are using the same computer
• Users issue transactions to call programs on the computer
• Everyone shares the same resources and storage
• The computer has no explicit, single owner
• Using the computer’s resources costs money - 32How is the Ethereum World State maintained?The Ethereum 'Blockchain' is the state machine.
The block_state represents the global state of the whole blockchain including all accounts,
contracts and storage - 33What is included in an Ethereum transaction?A transaction is a signed data package that is always sent by a wallet and contains the following data:
▪ The recipient of the message
▪ A signature identifying the sender
▪ The amount of ether to transfer from the sender to the recipient
▪ An optional data field
▪ A STARTGAS value
▪ A GASPRICE value
▪ There are two types of transactions: From wallet to wallet and from wallet to smart contract
(Only a wallet can make a transaction) - 34What is meant by 'a Ethereum message only exists virtually'?(A message is very similar to a transaction) Messages are only sent between Contracts and exist only virtually on EVM: i.e. they are not mined into a block like transactions.
- 35Why is Gas used?Every executed opcode instruction uses a miner’s computational resources and therefore costs a certain fee (called gas).
▪ Each opcode uses a certain amount of gas which may depend on the arguments of the operation, e.g., number of bytes to be allocated - 36What happens to a transaction if too little StartGas is specified?The transaction will fail.
- 37Ethereum uses an Account based ledger. What 2 different types of accounts are supported?1. Accounts that are controlled by private keys and owned externally.
This type can be seen as the default wallet of a user. It can sign transactions, issue smart contract functions calls and send Ether from one account to another.
2. Smart Contract accounts which are controlled by their code
▪ Smart Contracts are treated as account entities with their own, unique address.
▪ Contracts can send messages to other accounts, both externally controlled and smart
contracts.
▪ They can’t issue a transaction themselves.
▪ They have a persistent internal storage to write and read data from. - 38What is the size limit of a Block in Ethereum?The actual size of a block is not limited like in Bitcoin. Instead, the miner sets a gas limit which defines how much computational resources he is willing to provide for each block.
- 39What happens to correclty mined blocks that are no longer on the longest chain?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.
▪ The transactions in the uncle block are though still considered invalid. - 40Is it possible to update an Ethereum Smart contract?All contracts once deployed on the Ethereum blockchain are publicly accessible and can’t be updated/patched.
- 41What is an Oracle Contract?Smart contracts are closed systems
Smart contracts can’t access any data from outside the blockchain on their own. There are no HTTP or similar network methods implemented to call external services. This is on purpose to prevent non- deterministic behavior once a function is called (there are also no functions to generate random values).
Currently, the only way to write smart contracts using external data (e.g. weather data, traffic data etc.) is to use oracles. Oracles are basically third-party services that verify data from web services and write the data via a special smart contract to the blockchain. Other smart contracts can now call the oracle contract to get the data. - 42What is a Token system?Token Systems are currently the largest use case for smart contracts, mostly used to collect money via initial coin offerings (ICOs). Usually, tokens work as a sub-currency of Ethereum and represent a certain asset such as a stock
- 43What are some use cases for Smart Contracts?Token systems
Identity systems
DAO(Decentralized Autonomous Organization - multi sig wallets)
Election and voting systems - 44Is a miner required to have a copy of the full blockchain synced?In order to mine a block it is required to have a synced copy of the full blockchain.
- 45In Bitcoin, double spending is protected by UTXO. How is the account-based ledger Ethereum protected against double spending?Ethereum, being an account based ledger, cannot use UTXOs. Instead each Ethereum account has a number associated called a ”nonce” The account nonce is simply the number of transactions of an account and is included in transactions as a field.
- 46How to typically double spend on Ethereum?A typical double spending attempt initiates a second transaction with a higher gas price after the original payment. The double spender hopes that miners will prefer mining the second transaction
- 47Why are messages not published to blockchain? How could the blockchain be in the same state among all nodes without writing messages to the blockchain?SInce the information is already inherently contained in the transactions that are on the blockchain.
- 48Name four reasons why a transaction that is sent to the Ethereum network might not get mined.1. Wrong signature of the transaction
2. Not enough funds in the account
3. Too low StartGas specified
4. Too low GasPrice so no miner wants to mine it - 49Name two different ways how a mined transaction can fail.1. the transaction runs out of Gas
2. the transaction gets Reverted, by executing an illegal operation - 50Why does a mined transaction that fails still cost gas?Even a transaction that fails half way has ofc consumed computational power from the miner.
Also to prevent spam transactions - 51What is the difference between Memory and Storage in Ethereum?Memory is part of the EVM and storage is part of a smart contract. The former is a non- persistent byte array used as temporal storage during execution of a single transaction. The latter is the data storage used by smart contracts which is persistent between multiple trans- actions.
- 52At a very low level, storing data to storage is performed by the EVM instruction SSTORE. According to the yellow paper, the gas cost of an SSTORE operation is 20,000 “when the storage value is set to non-zero from zero” and 5,000 “when the storage value’s zeroness remains unchanged or is set to zero.” Why is it cheaper to set a value to 0 than to set it from 0 to any other value?All storage items of a contract are initially empty. Setting a storage value from 0 to non-zero means that this value is newly initialized and all full nodes in the network have to keep track of the new data item. Every client has to create a new database entry for this item, which increases the size of the world state. As every node in the network has to allocate physical hard disk space, this operation is quite expensive. Once that space is allocated, changing the value is not increasing the size of the state, which is why this operation is cheaper.
- 53Not all Ethereum nodes are using the same code base. Since the specification for an Ethereum node is open source, basically anyone could create a different implementation. The two major Ethereum implementations are:1. Geth - Official Ethereum Implementation
2. Parity - Multisig hacked - 54Why did the Parity Multisig hack happen?The Parity node implementation comes with some predefined Smart Contract templates.
The template for a Multi-Sig Wallet had a bug in it. The initWallet() constructor did leave out the 'internal' visibility type -> was then defaulted to a public function..
// constructor - just pass on the owner array to the multiowned
function initWallet(address[] _owners...)
So anyone could re-call the constructor and make themselves as owners.
Also, initDaylimit() and initMultiowned() should have been declared as internal.
The hacker increased the DayLimit spending heavily and changed the MultiOwned to just 1 owner - 55What is the difference between Gas and Ether?Each execution or OPCode in the Ethereum Virtual Machine (EVM) costs a certain amount of gas. A transaction has to pay for its complete execution. The transaction fee is calculated by multiplying the required gas with the gas price denominated in Ether, which is the base currency of the Ethereum blockchain.
- 56What is the difference of messages and transactions?A transaction can only be issued from an externally owned account (EOA). This transaction is directly stored in the Blockchain. A Smart Contract can never communicate with other accounts (either EOA or Smart Contracts) on its own. It always needs an external input. All communication created from Smart Contracts are called messages. As these messages are always part (and result) of a corresponding transaction, they are not directly stored in the Blockchain.
- 57Are contracts and their functions visible to everyone?In Public networks like the Ethereum MainNet: Yes, Smart Contracts are visible to everyone. All public functions can be accessed.
- 58Why are there transactions in Etherscan.io which do not transfer any value?A transaction which invokes a function in a Smart Contract is not required to carry any additional Ether.
- 59Is the EVM world state explicitly or implicitly stored on the blockchain?World State - is Implicitly stored in the blockchain
Blockstate - Explicitly stored on the blockchain. From the Blockstate, the World State can be calculated. - 60Does a Smart Contract have a persistent state/storage on the EVM?A contract has its own, persistent state on the blockchain which is
defined by state variables in the contract.
Functions are used to change the state of the smart contract or to
perform other computations. - 61How much wei is 1 Ether?1 Ether == 1e18(10^18) Wei
1 Gwei == 1e9 Wei - 62What is a View function?Functions which are declared as view are read only, i.e. they do not modify any state variable nor alter
the state of the blockchain.
However, they can read from state variables. - 63What is a pure function?Pure functions can be seen as a subset of view functions which don’t modify the state but also don’t read from the state.
- 64Blockchain might be a potential solution if:▪ Multiple parties are involved and
▪ The parties do not trust each other or have different interests and
▪ Shared write access is required and
▪ All writes to the database need to be (publicly) verifiable - 65What is the difference between an abstract Solidity contract and an interface?The interface is more restrivtive
- 66A transaction that calls a view function does not cost any gas because it does not change state.False. View functions do consume gas. However, since view functions do not modify the state, it is possible to call them without sending the transaction to the network. For example, they can be executed by a local node or by Etherscan. In that case, no record of the transaction is stored on the blockchain and one does not have to pay for the transaction.
- 67Every pure function is a view function.True. Pure functions are a subset of view functions which don’t modify the state but also don’t read from the state.
- 68If msg.sender == tx.origin, then this code was called directly by an externally owned account and not by another smart contract.True. tx.origin is the externally owned account that issued the transaction and msg.sender is the direct caller of the function. If they are equal, the code was called directly by the issuer of the transaction and therefore not by a smart contract.
- 69What is a testnetwork and why use it?A testnetwork is a separate chain that has the same properties as the main net.
Used for testing SC, since the Ether on the test network has no value. - 70What 3 Ethereum test net works are there?Ropsten is a Proof of Work network with a very low difficulty.
• Kovan uses Proof of Authority meaning that only some approved accounts can create new
blocks. The average block time is four seconds.
• Rinkeby also uses Proof of Authority but with a block time of about fifteen seconds. - 71What is an ABI?The ABI can be useful when calling functions of the contract. From the bytecode alone it is not easily apparent what functions the contract provides (though, it is possible to reverse-engineer some of this information). With the ABI, your wallet can show you an UI of all the available functions and their correct parameters.
- 72transaction = { nonce: '0x0', gasLimit: '0x6acfc0', // 7000000 gasPrice: '0x4a817c800', // 20000000000 to: '0x0', value: '0x0', data: '0xfffff' }; This is the template of every transaction. What happens if the to: is the zero address?A new conract is created based on the address of the sender and her current nonce
- 73How to create 'random' numbers in Ethereum?A commonly used approach to create pseudo-random numbers is to use the hash of the currently mined block.
return uint(blockhash(block.number - 1));
Potential predictability by miner - 74It is impossible to patch a deployed contract. What are the Evolution support Design Patterns?Decoupling the business logic from the state data by using two separate contracts.
▪ One contract implements all the functions for the business logic
▪ Another one acts as a raw data storage contract
Makes it then easier to update the business logic contract and still keep the same Data State in the other decoupled contract.
No need to mitigate the State to a new contract. - 75Replacing a smart contract with a newer version comes with the implication that the newly deployed contract has a different account address as the older one. What is the Proxy Design Pattern?Separate the business logic and the data from the actual, application-facing contract.
▪ Implement a proxy contract which forwards all calls to the contract with the business logic. - 76What is a fungible token?All tokens are indistinguishable and have the exact same value
- 77What is a non-fungible token?Tokens are distinguishable. Each token is identified by an ID.
- 78What is the ERC20 interface?It is a token standard for fungible tokens.
The specification defines an interface that a contract must implement to be ERC20 compliant. It does not specify the actual implementation of the functions.
It is the most commonly used token standard in the Ethereum network - 79Use cases of non-fungible tokens?Use cases:
▪ Digital goods
▪ In-Game items
▪ Collectables
▪ Music
▪ etc.
▪ Physical property
▪ Real estate
Art
▪ etc. - 80What are Ethereum Oracles and why are they needed?Solidity instructions to write SC limit the SC to be deterministic -
no random funciton
no web access
Oracles are third-party services that collect data from web services and write the data via a special smart contract to the blockchain. - 81What is the difference between a Synchronous and an Asynchronous Oracle?synchronous Oracle: data is periodically(every 100 blocks or smth) pushed to the Oracle contract and retrieved by the Smart Contract. So is not entirely fresh.
asynchronous Oracle: the contract acts as a proxy for the Oracle service to send fresh data back to the original Smart Contract via a callback function - 82How to prevent Over- and Underflow bugs in SC?the SafeMath library can be used to prevent Over- and underflow bugs
- 83What are the benefits of having a P2P decetralized app (Dapp), specifically on a blockchain?Ehtereum:
Trust
The source code of any verified smart contract can be checked by anyone.
Payment
Payment is implemented by default since anyone can send / receive Ether.
Accounts
dApps can be build on top of Ethereum’s account system, so there is no need to implement an additional user account management system.
Storage
dApps can leverage the Blockchain as common (expensive) data storage. - 84What are the intrinsic drawbacks of Dapps on a blockchain?Costs
Any state change and computation costs money. For that reason, only mission-critical data and functionality should leverage the Blockchain.
Delay
The current block time of Ethereum is around 14 seconds, i.e., it takes at least 14 seconds from the function call to the definite result of it. - 85what is web3?Web3.js is the official Ethereum JavaScript API that provides a wrapper for the JSON RPC interface to interact directly with the blockchain.
Provides methods to deploy and interact with smart contracts
• Provides methods to sign and send transactions
• Widely used framework to interact with the Ethereum Blockchain - 86What is a web3 provider?A web service that is connected to a geth/parity node and thus the Ethereum blockchain. Through it a user can make transactions.
MetaMask is a private key manager that injects a web3 provider for the user to interract with the Ethereum blockchain - 87What is an ABI?Application Binary Interface
(ABI) in JSON that can be used by other applications to interact/call functions of the contract - 88Solidity, what is Truffle:Truffle is a popular framework to facilitate the development of Ethereum smart contracts. The framework provides tools to compile, test and deploy Solidity contracts
- 89Solidit, what is Ganache?Ganache is a local blockchain for Ethereum smart contract development. It can be used to deploy, simulate, and test smart contracts.
- 90What are Solidity events?Convenient way to listen for smart contract function calls and state changes without scanning the whole blockchain.
▪ Mostly used to trigger callback function in dApp event listeners. - 91What is constortium blockchains?Consortium Blockchains are a hybrid of public and private Blockchains. The access to the network is limited to certain parties and participation usually requires an invitation by the starter of the network.
eg Hyperledger - 92Motivation of constortium Blockhains:Multiple big entities/companies that do not fully trust eachother that need to share a database in a tamper-proof and secure way where every participant has read and write access.
- 93Do you need a blockchain? -Use case flow chart1. Do you need a Database? y
2. Do you need a rapid DB? n
3. Do you need to store very large entries?n
4. Does it require shared write access? y
5a. Are the writers known and trusted? y/n
(y: 5b. Are writers' interest unified?) n
6. Do you need to use a trusted 3rd party?n
--> use a Public blockchain if you need the transactions to be public. Otherwise use a private blockchain. - 94Difference between a permisson and a permissionless Public blockchain?Bitcoin is a public Permissionless blockchain where Anyone can join.
In Permissioned public blockchains, you have to get an invite to join the network. - 95What is Corda?Not a blockchain, but a decentralized P2P ledger platform.
- 96What is Hyperledger?(hyper - beyond)
By the Linux foundation:
cointains 6 differenta frameworks(Fabric, Sawtooth etc.) to set up a blockchain infrastructure (private and permissioned/consortium networks - without any Currency) - 97What is the Hyperledger Fabric framework?A framework/platform for setting up private and consortium blockchains.
Uses 'Membership Service Provider' (MSP) to entorll new nodes into the network. - 98Fabric support multi channel networks, what is that?Channels are a subset of participants of a network.
Channels provide privacy between different ledgers. Each channel has its own ledger / Blockchain.
– Ledgers exist in the scope of a channel
• Channels can be shared across an entire network of peers
• Channels can be permissioned for a specific set of participants
– Peers can participate in multiple channels - 99What is Hyperledger Composer tool?A graphical interface of a toolset for develop and deploy blockchain solutions(over Fabric or any other framework)
It is complex to set up a Fabric network, Composer makes it easier. - 100What is Chaincode in Fabric?Another word for a Smart Contract.
Certain business logic for a whole channel or for particular transactions. - 101What does an Ordering Node?Central node that Orders transactions into blocks and publish the block to the network of Peers
- 102Bitcoin: Name and briefly describe two incentives for creating new blocks in the network.1. Mining reward: by creating a block, the miner is rewarded coins
2. Transaction fee: the miner collects the fees of the transactions it mines - 103Ethereum: Name one possible way to generate random numbers.1. Using Oracle contract
2. Using the hash of the current block - 104Bitcoin: what is the OP_RETURN instruction?OP_RETURN throws an error when reached
Proof-of-burn: the coins sent in the transaction are lost/burned
If you want to store data/text on the blockchain:
Use OP_RETURN in the scriptPubKey
followed by the text you want to store.
(since code after an OP_RETURN won't be executed) - 105An Ethereum account for an EOE and a SC has the same struct: An Ethereum account contains four fields: nonce balance (ether) contract_code storage How to tell if EOA or SC?If the contract_code and storage is: 0x0
==> EOA - 106define Ethereum access classifiers: public external internal privatepublic - all can access
external - Cannot be accessed internally, only externally
internal - only this contract and contracts deriving from it can access
private - can be accessed only from this contract - 107What is P2PKHPay To Public Key Hash
eg.
TxOut script:
OP_DROP
OP_DUP
OP_HASH160
PubKeyHash1 <-- P2PKH
OP_EQUALVERIFY
OP_CHECKSIG - 108Explain properties of the Ethereum World Computer• Everyone shares the same resources and storage
• Transactions are used to invoke function calls on this computer
• All participants are using the same computer
• The computer has no explicit, single owner
• Using the computer’s resources costs money - 109What is Chaincode in Hyperledger?Smart Contracts in Hyperledger are called Chaincode
- 110What differnet nodes in Hyperledger are there?• Committing peer
Maintains the state of the Blockchain and commits transactions.
• Endorsing peer
an endorsing peer is allways also a committing peer. The difference is that an endorsing peer additionally takes transaction proposals and executes them to create endorsements.
• Ordering service node
Orders transactions sequentially - 111Why are public keys of identities hashed before they are used as an address? Name two reasons and explain.You want to hash your public key pk in order to receive an “identity”, as
▪ Public keys are very large
▪ Public keys may be vulnerable to quantum computing attacks. Hashing is Quantum resistant.
In order to prevent the PrivateKeys to be calculated from the PublicKeys, the PubKeys are hashed.
Utxos Always has to be completely consumed, by sending the rest to a new address(pubKey hash) which was not revealed before. - 112Name the three key properties of the Bitcoin Blockchain according to the lecture and explain them.1. Trust free - no need for a central/third party that maintains/controls the system
2. Tamper-proof - the blockchain is immutable by design
3. Transparency - all the transactions are public - 113what fields of the header is contained in a block's hash?The block‘s hash used for chaining is calculated from the version until the nonce field.
/The nonce is the solution to the search puzzle
==
1. Version
2. Hash of previous block
3. Hash of Merkle Root
4. Time
5. Difficulty
6. Nonce - 114How many private keys has a Wallet Owner?Some cases just one private key,
The wallet owner owns one private key for each unspent transaction outputs (UTXOs)
Also always just one PublicKey for each Private key -- key pair - 115Alice wants to send 1.0 BTC to Bob. What steps does her transaction take until being completed?1. The transaction is created and signed by Alice.
2. The signed transaction is sent to a full node for validation.
3. If the transaction is valid, the full node publishes the transaction to the network and is added to the memory pool.
4. A miner includes Alice’s transaction from the memory pool to its block. The miner solves the puzzle and publishes the block to the network.
5. Other nodes receive the mined block and validate all contents. - 116Take a look at Bitcoin script’s opcodes in the slides. Which fundamental commands are missing? What could be the reason they are not added?Loops and Jumps
Not there to keep the system deterministic - 117There is an op code called locktimeverify and a time lock in the transaction itself. What is the difference? What are examples in which these are useful?LOCKTIMEVERIFY
The locktimeverify op code basically locks a Txout (and therefore the associated Bitcoins) for that certain amount of time. However, the output can be mined and included in the Blockchain. An application would be: I pay you, but in a year from now without being able to interfere with the payment process. After a year, the Txout would be spendable, no matter what.
Time Lock
The time lock in a transaction defines the time until a transaction can be mined. Until then, it is invalid, therefore not included in the Blockchain. This is an optional insurance for micropayment channels. If the referencing txout is already spent, then the transaction is invalid. - 118How often is the mining search puzzle difficulty adjusted?every 2016 block
- 119at what block interval is the mining reward halved?every 210,000 block
- 120how many bitcoins can be mined in total?21 million
- 121The nonce field is 32-bit long, resulting in 4.294.967.296 possible allocations. However, this is not sufficient for getting a high probability to find a valid block in current difficulty times (2.6∗1022 attempts to find a valid block). Explain possible changes that you can introduce in your block to change the hash without making the block invalid. Discuss which of these changes are more expensive than others.1. Change the timestamp
2. Change the scriptSig field of the coinbase transaction
3. Change the address of the coinbase transaction
4. Alter the Merkle Root hash by:
- Change the order of transactions
- Add/Remove transactions - 122Full nodes are incentivized not directly by any rewards. Reasons to set up a full node can be following:1. running their own full node to connect the light node / wallet software with it.
2. having a business which relies on the data (merchant, data analytics, ...). - 123How does block validation work?1. Correct hash reference to the previous block
2. Correct difficulty and Puzzle is solved
3. All transactions has to be valid - 124explain Ethereum Double spending patternAlice has 10ETH in her account and the current account nonce=5
Alice makes a payment to someone of 10ETH with nonce=6
Alice then creates another transaction of 10ETH with nonce=6 and send to herself.
As soon as any of the transactions is mined, the other will be invalid since their nonces are eaqual.
--> Alice sends the 2nd transaction with a very high gasPrice to have a higher change of successfully double spend.
/Cannot send 2nd transaction with nonce=7. Since this Tx can only be mined after the Tx with nonce=6. - 125What can be exploited if address.call() is used unsafe?problem:
calls the CALL() func without a gas limit:
Re-entrancy attack - 126If msg.sender == tx.origin, then this code was called directly by an externally owned account and not by another smart contract.True. tx.origin is the externally owned account that issued the transaction and msg.sender is the direct caller of the function. If they are equal, the code was called directly by the issuer of the transaction and therefore not by a smart contract
- 127—
Información
- Descripción
- Fichas sobre Blockchain Engineering, creado por Gustav j el 31/07/2019.
- Creado por
- Gustav j
- Visitas
- 2
- Valoración