Proof of Work solves two things:
provided a consensus algorithm allowing node to update bitcoin ledger free(自由的) entry into the consensus process Bitcoin
Mining
is the only mechanism for bitcoin to be issued, no coins are in the genesis state to prevent the network from sybil attack (fork the chain and have over 51% of computation resources) Multi-level data structure
Hash of a block
root hash of a merkle tree Simplified payment verification → light node - download block header and relevant branches
Bitcoin Application
Name coin - first-to-file paradigm - first registerer succeeds and second fails colored coins - allow users to issue new currencies metacoins - different state transition functions Two approaches towards building a consensus protocol
building an independent network → difficult to implement, too small to protect themselves followed the power rule building a protocol on top of bitcoin → does not inherit the simplified payment verification features of bitcoin Scripting
facilitate a weak version of a concept of smart contracts lack of turing-completeness → no while loop value-blindness → UTXO all or nothing blockchain blindness → valuable source of randomness Ethereum
Ethereum Accounts:
states: nonce, ether balance, contract code, storage
externally owned accounts vs. contract accounts
Transaction
the recipient of the message
a signature identifying the sender
the amount of ether transferred
data field [optional]
STARTGAS - maximum number of steps that transaction execution allowed to take
GASPRICE - unit fee sender pays per computational step
Messages
the sender of the message (implicit)
the recipient of the message
the amount of ether transferred
data field [optional]
STARTGAS - maximum number of steps that transaction execution allowed to take
State Transition Function
validate transaction form
calculate transaction fee
initialize GAS = STARTGAS
transfer the transaction value
revert state changes except payment of fee when execution failed or run out of gas, send the fee to miner
otherwise, refund the fees for remaining gas to the sender, and send consumed gas to miner
Validating block - preserve both state and transaction lists
Application type:
financial, semi-financial, non-financial