Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft,...

Post on 06-Apr-2017

135 views 4 download

Transcript of Ethereum under the Hood, intro for developers as preparation for Blockchain Hackathon (Delft,...

Ethereum underthehood

Whoarewe?

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

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

Whoarewe?

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

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

Ethereum forBitcoiners

ProgramminginBitcoin

• Containsadeliberatelysimplescriptinglanguage• Atransaction=lockingBitcoinanddescribinghowitcanbeunlocked• Examples:

• Multisig:multiplesignaturesareneededtounlock• CheckLocktimeVerify:Bitcoinonlyspendableatsomepointinfuture• ….

ProgramminginBitcoin

• Containsarelativelysimplescriptinglanguage• Atransaction=lockingBitcoinanddescribinghowitcanbeunlocked• Examples:

• Multisig:multiplesignaturesareneededtounlock• CheckLocktimeVerify:Bitcoinonlyspendableatsomepointinfuture• ….

More”opcodes”,morefunctionality

Altcoin/Metacoin X

Ethereum:anythingisprogrammable“Classic“blockchains

• Addresses

• Balancewith“native”coin

• Transactionsandblocks

Ethereum:

• Addresses• …• …

• BalancewithEther• …

• Transactionsandblocks• …• …

Ethereum:anythingisprogrammable“Classic“blockchains

• Addresses

• Balancewith“native”coin

• Transactionsandblocks

Ethereum:

• Addresses• +datastorage• +code

• BalancewithEther• …

• Transactionsandblocks• …• …

Ethereum:anythingisprogrammable“Classic“blockchains

• Addresses

• Balancewith“native”coin

• Transactionsandblocks

Ethereum:

• Addresses• +datastorage• +code

• BalancewithEther• …

• Transactionsandblocks• …• …

Ethereum:anythingisprogrammable“Classic“blockchains

• Addresses

• Balancewith“native”coin

• Transactionsandblocks

Ethereum:

• Addresses• +datastorage• +code

• BalancewithEther• +application-specifictokens

withspecificbehaviour

• Transactionsandblocks• …• …

Ethereum:anythingisprogrammable“Classic“blockchains

• Addresses

• Balancewith“native”coin

• Transactionsandblocks

Ethereum:

• Addresses• +datastorage• +code

• BalancewithEther• +application-specifictokens

withspecificbehaviour

• Transactionsandblocks• +creationofcontractcode• +callingcontractcode

Slowandprimitive,but…Promise:

A15-yearoldcandeploybusinesslogicthatis:

• Verifiable• Immutable• Untamperable• Untouchable

Smartcontractpattern1Lockthingofvalueincontract

2Contractcodedeterminesredistribution

3Basedoninformationthatisnotyetknown

Smartcontractpattern1Lockthingofvalueincontract• Nativecrypto• Tokensrepresentingvalue…orabilities

2Contractcodedeterminesredistribution

3Basedoninformationthatisnotyetknown

Smartcontractpattern1Lockthingofvalueincontract• Nativecrypto• Tokensrepresentingvalue…orabilities

2Contractcodedeterminesredistribution

3Basedoninformationthatisnotyetknown• Randomness• Actor• “Oracle”

Solidity

Solidity

Contract-oriented,highlevellanguagefortheEVMStaticallytyped,inheritance,librariesandsyntaxsugar

ContractsarelikeclassinstancesPublicfunctionsaretheAPIContractstatelocallyavailableonallnodes

Javascript likelanguage

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

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

https://solidity.readthedocs.io

web3

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){ ... });

DevelopmentTools

Clients

Resources

Whathavepeoplebuiltsofar?

Permissionedorpublic?