ethereum hackers

Download Ethereum hackers

Post on 01-Jul-2015




4 download

Embed Size (px)


  • 1. ethereumCoding society

2. ethereumInternet is to communicationasEthereum is to agreements 3. basic premisePlace & run code in a decentralised singleton isolatedmachine;code can call into other peoples code on the machine;all transactions with the machine are crypto-signed andarchived;state fully deterministic. 4. blockchainDiffuse Singleton Data-Structure(non-localised, no-authority, no-centre) 5. bitcoin & crypto-currenciesUsed blockchain to implement basicclearing house contract 6. ethereum & crypto-lawUses blockchain to implement basicarbitrary contracts 7. ethereumEthereum is to Bitcoinasthe iPhone is to a calculator 8. ethereum100% Free software, open, Go, Python implementations(Java & Javascript, too) 9. ethereumState of Ethereum is just the state of a numberof accounts. 10. state: accountsAddress(160-bit excerpt from the 256-bit public key)Balance, Nonce[, Code, Storage](latter two non-null if a contract) 11. transactions: state alterationAlter state by introducing transactions:either send a message callorcreate a contract. 12. contract creationendowment (ETH), init codegas, signature 13. on creationPlaces a new account in the system with code(code in account is whatever is returned fromthe init routine) 14. message callsrecipient, value (ETH), datagas, signature 15. on message receiptvalue is transferred to recipients balance;recipients code (if any) runs. 16. code execution: virtual machineArbitrary size stackPUSH, POP, SWAP, DUPArbitrary temp memory (2256 bytesaddressable)MLOAD, MSTORECode stored in virtual ROMCODESIZE, CODECOPY 17. virtual machineArithmetic/Logic & CryptoADD, EXP, EQ, AND, LT, BYTE, SHA3 &cFlow controlJUMP, JUMPI, PC 18. vm: environmentCan read message input dataCALLDATALOAD, CALLDATASIZE, CALLDATACOPYCan halt & give message output dataRETURN, STOP, SUICIDE 19. vm: environmentArbitrary storage (2256 words addressable)ISOLATED FROM OTHER ACCOUNTSSLOAD, SSTORECan create & send messages.CREATE, CALL 20. vm: environmentCan query blockchain informationTIMESTAMP, PREVHASH, NUMBER, COINBASE, &c.Other informationADDRESS, BALANCE, ORIGIN, CALLER 21. vmStorage, memory & processing costs ETH(actually, costs GAS butGAS ETH) 22. lll: basicsexpression := ( [ ...] ) is just expression0 -> PUSH 0(mload 0x20) -> PUSH 0x20 MLOAD 23. contract: currency(sstore (caller) 0x1000000000000)(returnlll (when (= (calldatasize) 64) (seq(mstore 0 (sload (caller)))(when (>= (mload 0) (calldataload 32)) (seq(sstore (caller) (sub (mload 0) (calldataload 32)))(sstore (calldataload 0)(add (sload (calldataload 0)) (calldataload 32)))))))) 24. lll: advancedvariables: (set name )(mload x) / (mstore y z): @x / [y] z(sload x) / (store y z): @@x / [[y]] z(calldataload x): $x 25. contract: currency[[ (caller) ]] 0x1000000000000(returnlll (when (= (calldatasize) 64) {(set a @@(caller))(when (>= @a $32) {[[(caller)]] (- @a $32)[[$0]] (+ @@ $0 $32)})})) 26. transaction: transferto: data: 27. lll: advancedvariadic arithmetic/logicmacros: (def sqr (x) (* x x)) (sqr 4): (* 4 4) 28. lll: name registration(def registrar0x50441127ea5b9dfd835a9aba4e1dc9c1257b58ca)[0] 'register[32] 'Exchange(call (- (gas) 21) registrar 0 0 64 0 0) 29. exchange walkthrough... 30. thanksLooking for devs, too...C++ in Berlin especially!