69
Ethereum under the hood

Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Embed Size (px)

Citation preview

Page 1: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Ethereum underthehood

Page 2: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Whoarewe?

• Joris Bontje• @mids106• http://OneUp.Company

• PascalVanHecke• @vanheckeinfo• http://Tokenengineers.com

Page 3: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Whoarewe?

• Joris Bontje• @mids106• http://OneUp.Company

• PascalVanHecke• @vanheckeinfo• http://Tokenengineers.com

Page 4: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Ethereum forBitcoiners

Page 5: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

ProgramminginBitcoin

• Containsadeliberatelysimplescriptinglanguage• Atransaction=lockingBitcoinanddescribinghowitcanbeunlocked• Examples:

• Multisig:multiplesignaturesareneededtounlock• CheckLocktimeVerify:Bitcoinonlyspendableatsomepointinfuture• ….

Page 6: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 7: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

ProgramminginBitcoin

• Containsarelativelysimplescriptinglanguage• Atransaction=lockingBitcoinanddescribinghowitcanbeunlocked• Examples:

• Multisig:multiplesignaturesareneededtounlock• CheckLocktimeVerify:Bitcoinonlyspendableatsomepointinfuture• ….

More”opcodes”,morefunctionality

Altcoin/Metacoin X

Page 8: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 9: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Ethereum:anythingisprogrammable“Classic“blockchains

• Addresses

• Balancewith“native”coin

• Transactionsandblocks

Ethereum:

• Addresses• …• …

• BalancewithEther• …

• Transactionsandblocks• …• …

Page 10: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Ethereum:anythingisprogrammable“Classic“blockchains

• Addresses

• Balancewith“native”coin

• Transactionsandblocks

Ethereum:

• Addresses• +datastorage• +code

• BalancewithEther• …

• Transactionsandblocks• …• …

Page 11: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 12: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 13: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 14: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Ethereum:anythingisprogrammable“Classic“blockchains

• Addresses

• Balancewith“native”coin

• Transactionsandblocks

Ethereum:

• Addresses• +datastorage• +code

• BalancewithEther• …

• Transactionsandblocks• …• …

Page 15: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 16: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Ethereum:anythingisprogrammable“Classic“blockchains

• Addresses

• Balancewith“native”coin

• Transactionsandblocks

Ethereum:

• Addresses• +datastorage• +code

• BalancewithEther• +application-specifictokens

withspecificbehaviour

• Transactionsandblocks• …• …

Page 17: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Ethereum:anythingisprogrammable“Classic“blockchains

• Addresses

• Balancewith“native”coin

• Transactionsandblocks

Ethereum:

• Addresses• +datastorage• +code

• BalancewithEther• +application-specifictokens

withspecificbehaviour

• Transactionsandblocks• +creationofcontractcode• +callingcontractcode

Page 18: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 19: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 20: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Slowandprimitive,but…Promise:

A15-yearoldcandeploybusinesslogicthatis:

• Verifiable• Immutable• Untamperable• Untouchable

Page 21: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 22: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 23: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 24: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 25: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Smartcontractpattern1Lockthingofvalueincontract

2Contractcodedeterminesredistribution

3Basedoninformationthatisnotyetknown

Page 26: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Smartcontractpattern1Lockthingofvalueincontract• Nativecrypto• Tokensrepresentingvalue…orabilities

2Contractcodedeterminesredistribution

3Basedoninformationthatisnotyetknown

Page 27: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Smartcontractpattern1Lockthingofvalueincontract• Nativecrypto• Tokensrepresentingvalue…orabilities

2Contractcodedeterminesredistribution

3Basedoninformationthatisnotyetknown• Randomness• Actor• “Oracle”

Page 28: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Solidity

Page 29: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Solidity

Contract-oriented,highlevellanguagefortheEVMStaticallytyped,inheritance,librariesandsyntaxsugar

ContractsarelikeclassinstancesPublicfunctionsaretheAPIContractstatelocallyavailableonallnodes

Page 30: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Javascript likelanguage

Page 31: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 32: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

CompilestoEVMbytecode

TXVALUE PUSH 25 PUSH 10 PUSH 18 EXP MUL LE NOT PUSH 34 JMPI STOP PUSH 34 JMP PUSH 0 TXDATA SLOAD NOT PUSH 0 TXDATA PUSH 1000 LT NOT MUL NOT NOT PUSH 34 JMPI STOP PUSH 1 TXDATA PUSH 0 TXDATA SSTORE

Page 33: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 34: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 35: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 36: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 37: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

https://ethereum.github.io/browser-solidity/

Page 38: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 39: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

https://solidity.readthedocs.io

Page 40: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

web3

Page 41: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 42: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

web3- Javascript API// creation of contract objectvar MyContract = web3.eth.contract(abi);

// initiate contract for an addressvar myContractInstance =MyContract.at('0x78e97bcc5b5dd9ed228fed7a4887c0d7287344a9');

var result = myContractInstance.myConstantMethod('myParam');console.log(result) // '0x25434534534’

myContractInstance.myStateChangingMethod('someParam1', 23,{value: 200, gas: 2000}, function(err, result){ ... });

Page 43: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 44: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

DevelopmentTools

Page 45: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 46: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 47: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 48: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 49: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Clients

Page 50: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 51: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 52: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 53: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 54: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 55: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 56: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Resources

Page 57: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 58: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Whathavepeoplebuiltsofar?

Page 59: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 60: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 61: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 62: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)

Permissionedorpublic?

Page 63: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 64: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 65: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 66: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 67: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 68: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)
Page 69: Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft, December 7th 2016)