Next generation smart contract and decentralised application platform

Buterin, V. (2014). A next-generation smart contract and decentralized application platform. Ethereum, (January), 1–36.

*The Ethereum whitepaper, available on GitHub**

Bitcoin

APPLY(S, TX) -> S' or ERROR

for each input in TX:

if $~\sum$ inputs $<\sum$ outputs: ERROR

return S - (input UTXO) + (output UTXO)

Ethereum

APPLY(S, TX) -> S' works as follows:

  1. Check if TX is well formed with a valid signature
  2. Subtract STARTGAS * GASPRICE from sender and increment sender’s nonce
  3. Initialise GAS = STARTGASand subtract a certain amount of gas per byte to pay for the size of the TX
  4. Transfer the TX value to the receiving account. If it is a contract, run the contract and decrement GAS accordingly.
  5. Miner collects all gas used, the rest is returned to the sender.

Code execution in Ethereum

The Ethereum Blockchain

The block validation algorithm:

  1. Check if the previous block exists and is valid
  2. Check the timestamp, block number, difficulty, TX root, gas limit
  3. Check the POW
  4. Set S[0] := STATE_ROOT of the previous block (i.e no need to store blockchain history)
  5. APPLY(S[i], TX[i]) for i=0,1,...,n-1.
  6. Set S_FINAL:=S[n] (plus a miner reward)
  7. Check if S_FINAL is the same as the system’s STATE_ROOT

Applications of Ethereum