SlideShare a Scribd company logo
1 of 30
Download to read offline
THROUGH THE LOOKING GLASS
(OF THE BLOCKCHAIN)
May 29th 2018
A l e s s a n d r o C o n f e t t i
2
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
3
• What it is stored inside a block 

and what is suitable for?
• What is worth to store inside 

and what is better to store outside?
Alessandro Confetti - May 29th 2018 – Codemotion Free Webinar - Through the looking glass (of the blockchain)
4
Image from Julia Donaldson's books – in pictures
THERE IS NO
SUCH A THING AS
A BLOCKCHAIN
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
5
Bitcoin's Academic Pedigree
By Arvind Narayanan, Jeremy Clark
Communications of the ACM, Vol. 60 No. 12,
Pages 36-45
10.1145/3132259Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
6Courtesy of blockchainhub.net
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
7
Ok, I need a blockchain, but which one?
By Pavel Kravchenko Sep 26, 2016
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
8Courtesy of blockchainhub.net
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
9
BITCOIN TRANSACTION
10Ken Shirriff Bitcoins the hard way: Using the raw Bitcoin protocol
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
11
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
12
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
HOW TO INSTALL BITCOIN
13
git clone https://github.com/bitcoin/bitcoin.git
# See doc/build-*.md for instructions on building for your o.s.
./autogen.sh
./configure
make
make check
make deploy
# to explore the blockchain, use the following commands
./src/bitcoin-cli getblockhash <block height>
./src/bitcoin-cli getblock <block hash>
./src/bitcoin-cli getrawtransaction <transaction hash>
./src/bitcoin-cli decoderawtransaction <raw transaction>
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
BITCOIN-CLI EXAMPLES
14
# genesis block
$ bitcoin-cli getblockhash 1
$ bitcoin-cli getblock 00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048
$ bitcoin-cli getrawtransaction 0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098
$ bitcoin-cli decoderawtransaction <the output from the above command>
# more complex block
$ bitcoin-cli getblock 0000000000000001b6b9a13b095e96db41c4a928b97ef2d944a9b31b2cc7bdc4
# Alice bought a cup of coffee from Bob’s Cafe (example from "Mastering Bitcoin 2nd edition")
$ bitcoin-cli getrawtransaction 0627052b6f28912f2703066a912ea577f2ce4da4caa5a5fbd8a57286c345c2f2
$bitcoin-cli decoderawtransaction <the output from the above command>
# Colored Coins (Open Assets)
$ bitcoin-cli getrawtransaction 10d7c4e022f35288779be6713471151ede967caaa39eecd35296aa36d9c109ec
$ bitcoin-cli decoderawtransaction <the output from the above command>
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
BITCOIN BLOCK HEADER
15
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
Courtesy of bicoinwiki
BITCOIN TRANSACTION HEADER
16
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
Courtesy of bicoinwiki
BITCOIN TRANSACTION INPUT/OUTPUT
17
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
Input
Output
Previous output
Courtesy of bicoinwiki
18
ETHEREUM STATE TRANSITION FUNCTION
19Ethereum Wiki
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
20
21
HOW TO INSTALL ETHEREUM
22
wget https://gethstore.blob.core.windows.net/builds/geth-darwin-amd64-1.6.0-
facc47cb.tar.gz
tar -xvfz geth-darwin-amd64-1.6.0-facc47cb.tar.gz
sudo mv geth-darwin-amd64-1.6.0-facc47cb/geth /usr/local/bin/geth
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
ETHEREUM RECURSIVE LENGTH PREFIX (RLP)
23
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
Ethereum Wiki
• For a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.
• Otherwise, if a string is 0-55 bytes long, the RLP encoding consists of a single byte with value 0x80
plus the length of the string followed by the string. The range of the first byte is thus [0x80, 0xb7].
• If a string is more than 55 bytes long, the RLP encoding consists of a single byte with value 0xb7
plus the length in bytes of the length of the string in binary form, followed by the length of the
string, followed by the string. For example, a length-1024 string would be encoded as xb9x04x00
followed by the string. The range of the first byte is thus [0xb8, 0xbf].
• If the total payload of a list (i.e. the combined length of all its items being RLP encoded) is 0-55
bytes long, the RLP encoding consists of a single byte with value 0xc0 plus the length of the list
followed by the concatenation of the RLP encodings of the items. The range of the first byte is thus
[0xc0, 0xf7].
• If the total payload of a list is more than 55 bytes long, the RLP encoding consists of a single byte
with value 0xf7 plus the length in bytes of the length of the payload in binary form, followed by the
length of the payload, followed by the concatenation of the RLP encodings of the items. The range
of the first byte is thus [0xf8, 0xff].
ETHEREUM BLOCK HEADER
24
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
Ethereum Yellow Paper
parentHash: TheKeccak256-bithashoftheparent block’s header, in its entirety
ommersHash The Keccak 256-bit hash of the om- mers list portion of this block
beneficiary The 160-bit address to which all fees collected from the successful mining of this block be transferred
stateRoot The Keccak 256-bit hash of the root node of the state trie, after all transactions are executed and finalisations applied
transactionsRoot The Keccak 256-bit hash of the root node of the trie structure populated with each transaction in the transactions list
portion of the block
receiptsRoot The Keccak 256-bit hash of the root node of the trie structure populated with the re- ceipts of each transaction in the
transactions list portion of the block
logsBloom The Bloom filter composed from index- able information (logger address and log topics) contained in each log entry from
the receipt of each transaction in the transactions list
difficulty A scalar value corresponding to the dif- ficulty level of this block. This can be calculated from the previous block’s difficulty
level and the timestamp
number A scalar value equal to the number of an- cestor blocks. The genesis block has a number of zero
gasLimit A scalar value equal to the current limit of gas expenditure per block
gasUsed A scalar value equal to the total gas used in transactions in this block
timestamp A scalar value equal to the reasonable output of Unix’s time() at this block’s inception
extraData An arbitrary byte array containing data relevant to this block. This must be 32 bytes or fewer
mixHash A 256-bit hash which, combined with the nonce, proves that a sufficient amount of computation has been carried out on
this block
nonce A64-bitvaluewhich,combinedwiththemix- hash, proves that a sufficient amount of computa- tion has been carried out on
this block
25
ETHEREUM TRANSACTION
26
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
Ethereum Yellow Paper
nonce A scalar value equal to the number of trans- actions sent by the sender
gasPrice A scalar value equal to the number of Wei to be paid per unit of gas for all computation costs incurred as a result of the
execution of this transaction
gasLimit A scalar value equal to the maximum amount of gas that should be used in executing this transaction. This is paid up-
front, before any computation is done and may not be increased later
to The 160-bit address of the message call’s recipi- ent or, for a contract creation transaction, ∅, used here to denote the
only member of B0
value A scalar value equal to the number of Wei to be transferred to the message call’s recipient or, in the case of contract
creation, as an endowment to the newly created account
v, r, s Values corresponding to the signature of the transaction and used to determine the sender of the transaction
Contract creation only
Init An unlimited size byte array specifying the EVM-code for the account initialisation procedure
Message call only
data An unlimited size byte array specifying the input data of the message call
Transaction Receipt
gasUsed cumulative gas used in the block containing the transaction receipt as of immediately after the transaction has happened
logs set of logs created through execution of the transaction; each log is a list made of: logger’s address, a series of 32-byte
log topics and some number of bytes of data
logsBloom Bloom filter composed from information in those logs
statusCode the status code of the transaction
BTC & ETH BLOCKCHAIN STATS
27
StopAndDecrypt The Ethereum-blockchain size has exceeded 1TB, and yes, it’s an issue
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
bitinfocharts.com
SO YOU WANT TO USE A BLOCKCHAIN…
28
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
Who can set or change the rules of the protocol?
Who runs the nodes and pay for them?
Who validates the block and at which cost?
Who can read and/or write the blocks?
29Courtesy of Wired
Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
$ tail -f questions
30
Alessandro Confetti
aconfet@thoughtworks.com
twitter @zigolab 

blog http://blog.zigolab.it

More Related Content

What's hot

Implementation of Bitcoin Miner on SW and HW
Implementation of Bitcoin Miner on SW and HWImplementation of Bitcoin Miner on SW and HW
Implementation of Bitcoin Miner on SW and HWJoe Jiang
 
Intro. to Lightning Network (Bitcoin/Litecoin) - Blockchain Developers Malaysia
Intro. to Lightning Network (Bitcoin/Litecoin) - Blockchain Developers MalaysiaIntro. to Lightning Network (Bitcoin/Litecoin) - Blockchain Developers Malaysia
Intro. to Lightning Network (Bitcoin/Litecoin) - Blockchain Developers MalaysiaTM Lee
 
Introduction to Lightning Network
Introduction to Lightning NetworkIntroduction to Lightning Network
Introduction to Lightning NetworkAlan Carbery
 
FOSDEM 2020: Querying over millions and billions of metrics with M3DB's index
FOSDEM 2020: Querying over millions and billions of metrics with M3DB's indexFOSDEM 2020: Querying over millions and billions of metrics with M3DB's index
FOSDEM 2020: Querying over millions and billions of metrics with M3DB's indexRob Skillington
 
Module: drand - the Distributed Randomness Beacon
Module: drand - the Distributed Randomness BeaconModule: drand - the Distributed Randomness Beacon
Module: drand - the Distributed Randomness BeaconIoannis Psaras
 
CNIT 141: 11. Hash Functions
CNIT 141: 11. Hash FunctionsCNIT 141: 11. Hash Functions
CNIT 141: 11. Hash FunctionsSam Bowne
 
Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)
Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)
Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)Zvi Avraham
 

What's hot (7)

Implementation of Bitcoin Miner on SW and HW
Implementation of Bitcoin Miner on SW and HWImplementation of Bitcoin Miner on SW and HW
Implementation of Bitcoin Miner on SW and HW
 
Intro. to Lightning Network (Bitcoin/Litecoin) - Blockchain Developers Malaysia
Intro. to Lightning Network (Bitcoin/Litecoin) - Blockchain Developers MalaysiaIntro. to Lightning Network (Bitcoin/Litecoin) - Blockchain Developers Malaysia
Intro. to Lightning Network (Bitcoin/Litecoin) - Blockchain Developers Malaysia
 
Introduction to Lightning Network
Introduction to Lightning NetworkIntroduction to Lightning Network
Introduction to Lightning Network
 
FOSDEM 2020: Querying over millions and billions of metrics with M3DB's index
FOSDEM 2020: Querying over millions and billions of metrics with M3DB's indexFOSDEM 2020: Querying over millions and billions of metrics with M3DB's index
FOSDEM 2020: Querying over millions and billions of metrics with M3DB's index
 
Module: drand - the Distributed Randomness Beacon
Module: drand - the Distributed Randomness BeaconModule: drand - the Distributed Randomness Beacon
Module: drand - the Distributed Randomness Beacon
 
CNIT 141: 11. Hash Functions
CNIT 141: 11. Hash FunctionsCNIT 141: 11. Hash Functions
CNIT 141: 11. Hash Functions
 
Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)
Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)
Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)
 

Similar to Through the looking glass (of the blockchain)

Ethereum Blockchain and DApps - Workshop at Software University
Ethereum Blockchain and DApps  - Workshop at Software UniversityEthereum Blockchain and DApps  - Workshop at Software University
Ethereum Blockchain and DApps - Workshop at Software UniversityOpen Source University
 
Blockchain Demystified
Blockchain DemystifiedBlockchain Demystified
Blockchain DemystifiedMahesh M Reddy
 
Presentation_Topalidis_Giorgos
Presentation_Topalidis_GiorgosPresentation_Topalidis_Giorgos
Presentation_Topalidis_GiorgosGiorgos Topalidis
 
Presentation topalidis giorgos
Presentation topalidis giorgosPresentation topalidis giorgos
Presentation topalidis giorgosGiorgos Topalidis
 
Ethereum Mining How To
Ethereum Mining How ToEthereum Mining How To
Ethereum Mining How ToNugroho Gito
 
EthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptxEthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptxWijdenBenothmen1
 
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & CodeDeploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & CodeHorea Porutiu
 
Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703
Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703
Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703Nevruz Mesut Sahin
 
Blockchain Development
Blockchain DevelopmentBlockchain Development
Blockchain Developmentpreetikumara
 
Blockchain, cryptography and tokens — NYC Bar presentation
Blockchain, cryptography and tokens — NYC Bar presentationBlockchain, cryptography and tokens — NYC Bar presentation
Blockchain, cryptography and tokens — NYC Bar presentationPaperchain
 
blockchain class 3.pdf
blockchain class 3.pdfblockchain class 3.pdf
blockchain class 3.pdfGopalSB
 
BCHGraz - Meetup #8 - Intro & Ethereum
 BCHGraz - Meetup #8 - Intro & Ethereum BCHGraz - Meetup #8 - Intro & Ethereum
BCHGraz - Meetup #8 - Intro & EthereumBlockchainHub Graz
 
Blockchain IoT Night / 25th Oct 2017
Blockchain IoT Night / 25th Oct 2017Blockchain IoT Night / 25th Oct 2017
Blockchain IoT Night / 25th Oct 2017Lothar Wieske
 
Understanding Proof of Work (PoW) and Proof of Stake (PoS) Algorithms
Understanding Proof of Work (PoW) and Proof of Stake (PoS) AlgorithmsUnderstanding Proof of Work (PoW) and Proof of Stake (PoS) Algorithms
Understanding Proof of Work (PoW) and Proof of Stake (PoS) AlgorithmsGautam Anand
 
POA based Side-Chain Architecture
POA based Side-Chain ArchitecturePOA based Side-Chain Architecture
POA based Side-Chain ArchitectureLuniverse Dunamu
 
create your own cryptocurrency
create your own cryptocurrencycreate your own cryptocurrency
create your own cryptocurrencyBellaj Badr
 
The Basic Theories of Blockchain
The Basic Theories of BlockchainThe Basic Theories of Blockchain
The Basic Theories of BlockchainSota Watanabe
 

Similar to Through the looking glass (of the blockchain) (20)

Ethereum Blockchain and DApps - Workshop at Software University
Ethereum Blockchain and DApps  - Workshop at Software UniversityEthereum Blockchain and DApps  - Workshop at Software University
Ethereum Blockchain and DApps - Workshop at Software University
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
Blockchain Demystified
Blockchain DemystifiedBlockchain Demystified
Blockchain Demystified
 
Presentation_Topalidis_Giorgos
Presentation_Topalidis_GiorgosPresentation_Topalidis_Giorgos
Presentation_Topalidis_Giorgos
 
Presentation topalidis giorgos
Presentation topalidis giorgosPresentation topalidis giorgos
Presentation topalidis giorgos
 
Ethereum Mining How To
Ethereum Mining How ToEthereum Mining How To
Ethereum Mining How To
 
EthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptxEthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptx
 
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & CodeDeploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code
 
Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703
Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703
Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703
 
Blockchain Development
Blockchain DevelopmentBlockchain Development
Blockchain Development
 
Blockchain Corporate Style
Blockchain Corporate StyleBlockchain Corporate Style
Blockchain Corporate Style
 
Blockchain, cryptography and tokens — NYC Bar presentation
Blockchain, cryptography and tokens — NYC Bar presentationBlockchain, cryptography and tokens — NYC Bar presentation
Blockchain, cryptography and tokens — NYC Bar presentation
 
blockchain class 3.pdf
blockchain class 3.pdfblockchain class 3.pdf
blockchain class 3.pdf
 
Blockchain
BlockchainBlockchain
Blockchain
 
BCHGraz - Meetup #8 - Intro & Ethereum
 BCHGraz - Meetup #8 - Intro & Ethereum BCHGraz - Meetup #8 - Intro & Ethereum
BCHGraz - Meetup #8 - Intro & Ethereum
 
Blockchain IoT Night / 25th Oct 2017
Blockchain IoT Night / 25th Oct 2017Blockchain IoT Night / 25th Oct 2017
Blockchain IoT Night / 25th Oct 2017
 
Understanding Proof of Work (PoW) and Proof of Stake (PoS) Algorithms
Understanding Proof of Work (PoW) and Proof of Stake (PoS) AlgorithmsUnderstanding Proof of Work (PoW) and Proof of Stake (PoS) Algorithms
Understanding Proof of Work (PoW) and Proof of Stake (PoS) Algorithms
 
POA based Side-Chain Architecture
POA based Side-Chain ArchitecturePOA based Side-Chain Architecture
POA based Side-Chain Architecture
 
create your own cryptocurrency
create your own cryptocurrencycreate your own cryptocurrency
create your own cryptocurrency
 
The Basic Theories of Blockchain
The Basic Theories of BlockchainThe Basic Theories of Blockchain
The Basic Theories of Blockchain
 

More from Alessandro Confetti

XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...
XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...
XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...Alessandro Confetti
 
Was the technology really useful this time?
Was the technology really useful this time?Was the technology really useful this time?
Was the technology really useful this time?Alessandro Confetti
 
Scuttlebutt or how to exit facebook and start coding your first web 3.0 socia...
Scuttlebutt or how to exit facebook and start coding your first web 3.0 socia...Scuttlebutt or how to exit facebook and start coding your first web 3.0 socia...
Scuttlebutt or how to exit facebook and start coding your first web 3.0 socia...Alessandro Confetti
 
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...Alessandro Confetti
 
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...Alessandro Confetti
 
Oop vs functional stop the fight and start building message driven serverle...
Oop vs functional   stop the fight and start building message driven serverle...Oop vs functional   stop the fight and start building message driven serverle...
Oop vs functional stop the fight and start building message driven serverle...Alessandro Confetti
 
Learn how to build decentralized and serverless html5 applications with embar...
Learn how to build decentralized and serverless html5 applications with embar...Learn how to build decentralized and serverless html5 applications with embar...
Learn how to build decentralized and serverless html5 applications with embar...Alessandro Confetti
 
Learn how to build decentralized and serverless html5 applications with embar...
Learn how to build decentralized and serverless html5 applications with embar...Learn how to build decentralized and serverless html5 applications with embar...
Learn how to build decentralized and serverless html5 applications with embar...Alessandro Confetti
 

More from Alessandro Confetti (11)

XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...
XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...
XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...
 
Was the technology really useful this time?
Was the technology really useful this time?Was the technology really useful this time?
Was the technology really useful this time?
 
Scuttlebutt or how to exit facebook and start coding your first web 3.0 socia...
Scuttlebutt or how to exit facebook and start coding your first web 3.0 socia...Scuttlebutt or how to exit facebook and start coding your first web 3.0 socia...
Scuttlebutt or how to exit facebook and start coding your first web 3.0 socia...
 
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...
 
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...How to avoid a web 3.0 babele   transclusions and folksonomies in a content-a...
How to avoid a web 3.0 babele transclusions and folksonomies in a content-a...
 
Oop vs functional stop the fight and start building message driven serverle...
Oop vs functional   stop the fight and start building message driven serverle...Oop vs functional   stop the fight and start building message driven serverle...
Oop vs functional stop the fight and start building message driven serverle...
 
Learn how to build decentralized and serverless html5 applications with embar...
Learn how to build decentralized and serverless html5 applications with embar...Learn how to build decentralized and serverless html5 applications with embar...
Learn how to build decentralized and serverless html5 applications with embar...
 
Learn how to build decentralized and serverless html5 applications with embar...
Learn how to build decentralized and serverless html5 applications with embar...Learn how to build decentralized and serverless html5 applications with embar...
Learn how to build decentralized and serverless html5 applications with embar...
 
Blockchain
BlockchainBlockchain
Blockchain
 
The Pandora Security Model
The Pandora Security ModelThe Pandora Security Model
The Pandora Security Model
 
Agile vs ??
Agile vs ??Agile vs ??
Agile vs ??
 

Recently uploaded

Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Lucknow
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Excelmac1
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 

Recently uploaded (20)

Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 

Through the looking glass (of the blockchain)

  • 1. THROUGH THE LOOKING GLASS (OF THE BLOCKCHAIN) May 29th 2018 A l e s s a n d r o C o n f e t t i
  • 2. 2 Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
  • 3. 3 • What it is stored inside a block 
 and what is suitable for? • What is worth to store inside 
 and what is better to store outside? Alessandro Confetti - May 29th 2018 – Codemotion Free Webinar - Through the looking glass (of the blockchain)
  • 4. 4 Image from Julia Donaldson's books – in pictures THERE IS NO SUCH A THING AS A BLOCKCHAIN Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
  • 5. 5 Bitcoin's Academic Pedigree By Arvind Narayanan, Jeremy Clark Communications of the ACM, Vol. 60 No. 12, Pages 36-45 10.1145/3132259Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
  • 6. 6Courtesy of blockchainhub.net Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
  • 7. 7 Ok, I need a blockchain, but which one? By Pavel Kravchenko Sep 26, 2016 Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
  • 8. 8Courtesy of blockchainhub.net Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
  • 9. 9
  • 10. BITCOIN TRANSACTION 10Ken Shirriff Bitcoins the hard way: Using the raw Bitcoin protocol Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
  • 11. 11 Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
  • 12. 12 Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
  • 13. HOW TO INSTALL BITCOIN 13 git clone https://github.com/bitcoin/bitcoin.git # See doc/build-*.md for instructions on building for your o.s. ./autogen.sh ./configure make make check make deploy # to explore the blockchain, use the following commands ./src/bitcoin-cli getblockhash <block height> ./src/bitcoin-cli getblock <block hash> ./src/bitcoin-cli getrawtransaction <transaction hash> ./src/bitcoin-cli decoderawtransaction <raw transaction> Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
  • 14. BITCOIN-CLI EXAMPLES 14 # genesis block $ bitcoin-cli getblockhash 1 $ bitcoin-cli getblock 00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048 $ bitcoin-cli getrawtransaction 0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098 $ bitcoin-cli decoderawtransaction <the output from the above command> # more complex block $ bitcoin-cli getblock 0000000000000001b6b9a13b095e96db41c4a928b97ef2d944a9b31b2cc7bdc4 # Alice bought a cup of coffee from Bob’s Cafe (example from "Mastering Bitcoin 2nd edition") $ bitcoin-cli getrawtransaction 0627052b6f28912f2703066a912ea577f2ce4da4caa5a5fbd8a57286c345c2f2 $bitcoin-cli decoderawtransaction <the output from the above command> # Colored Coins (Open Assets) $ bitcoin-cli getrawtransaction 10d7c4e022f35288779be6713471151ede967caaa39eecd35296aa36d9c109ec $ bitcoin-cli decoderawtransaction <the output from the above command> Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
  • 15. BITCOIN BLOCK HEADER 15 Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain) Courtesy of bicoinwiki
  • 16. BITCOIN TRANSACTION HEADER 16 Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain) Courtesy of bicoinwiki
  • 17. BITCOIN TRANSACTION INPUT/OUTPUT 17 Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain) Input Output Previous output Courtesy of bicoinwiki
  • 18. 18
  • 19. ETHEREUM STATE TRANSITION FUNCTION 19Ethereum Wiki Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
  • 20. 20
  • 21. 21
  • 22. HOW TO INSTALL ETHEREUM 22 wget https://gethstore.blob.core.windows.net/builds/geth-darwin-amd64-1.6.0- facc47cb.tar.gz tar -xvfz geth-darwin-amd64-1.6.0-facc47cb.tar.gz sudo mv geth-darwin-amd64-1.6.0-facc47cb/geth /usr/local/bin/geth Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
  • 23. ETHEREUM RECURSIVE LENGTH PREFIX (RLP) 23 Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain) Ethereum Wiki • For a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding. • Otherwise, if a string is 0-55 bytes long, the RLP encoding consists of a single byte with value 0x80 plus the length of the string followed by the string. The range of the first byte is thus [0x80, 0xb7]. • If a string is more than 55 bytes long, the RLP encoding consists of a single byte with value 0xb7 plus the length in bytes of the length of the string in binary form, followed by the length of the string, followed by the string. For example, a length-1024 string would be encoded as xb9x04x00 followed by the string. The range of the first byte is thus [0xb8, 0xbf]. • If the total payload of a list (i.e. the combined length of all its items being RLP encoded) is 0-55 bytes long, the RLP encoding consists of a single byte with value 0xc0 plus the length of the list followed by the concatenation of the RLP encodings of the items. The range of the first byte is thus [0xc0, 0xf7]. • If the total payload of a list is more than 55 bytes long, the RLP encoding consists of a single byte with value 0xf7 plus the length in bytes of the length of the payload in binary form, followed by the length of the payload, followed by the concatenation of the RLP encodings of the items. The range of the first byte is thus [0xf8, 0xff].
  • 24. ETHEREUM BLOCK HEADER 24 Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain) Ethereum Yellow Paper parentHash: TheKeccak256-bithashoftheparent block’s header, in its entirety ommersHash The Keccak 256-bit hash of the om- mers list portion of this block beneficiary The 160-bit address to which all fees collected from the successful mining of this block be transferred stateRoot The Keccak 256-bit hash of the root node of the state trie, after all transactions are executed and finalisations applied transactionsRoot The Keccak 256-bit hash of the root node of the trie structure populated with each transaction in the transactions list portion of the block receiptsRoot The Keccak 256-bit hash of the root node of the trie structure populated with the re- ceipts of each transaction in the transactions list portion of the block logsBloom The Bloom filter composed from index- able information (logger address and log topics) contained in each log entry from the receipt of each transaction in the transactions list difficulty A scalar value corresponding to the dif- ficulty level of this block. This can be calculated from the previous block’s difficulty level and the timestamp number A scalar value equal to the number of an- cestor blocks. The genesis block has a number of zero gasLimit A scalar value equal to the current limit of gas expenditure per block gasUsed A scalar value equal to the total gas used in transactions in this block timestamp A scalar value equal to the reasonable output of Unix’s time() at this block’s inception extraData An arbitrary byte array containing data relevant to this block. This must be 32 bytes or fewer mixHash A 256-bit hash which, combined with the nonce, proves that a sufficient amount of computation has been carried out on this block nonce A64-bitvaluewhich,combinedwiththemix- hash, proves that a sufficient amount of computa- tion has been carried out on this block
  • 25. 25
  • 26. ETHEREUM TRANSACTION 26 Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain) Ethereum Yellow Paper nonce A scalar value equal to the number of trans- actions sent by the sender gasPrice A scalar value equal to the number of Wei to be paid per unit of gas for all computation costs incurred as a result of the execution of this transaction gasLimit A scalar value equal to the maximum amount of gas that should be used in executing this transaction. This is paid up- front, before any computation is done and may not be increased later to The 160-bit address of the message call’s recipi- ent or, for a contract creation transaction, ∅, used here to denote the only member of B0 value A scalar value equal to the number of Wei to be transferred to the message call’s recipient or, in the case of contract creation, as an endowment to the newly created account v, r, s Values corresponding to the signature of the transaction and used to determine the sender of the transaction Contract creation only Init An unlimited size byte array specifying the EVM-code for the account initialisation procedure Message call only data An unlimited size byte array specifying the input data of the message call Transaction Receipt gasUsed cumulative gas used in the block containing the transaction receipt as of immediately after the transaction has happened logs set of logs created through execution of the transaction; each log is a list made of: logger’s address, a series of 32-byte log topics and some number of bytes of data logsBloom Bloom filter composed from information in those logs statusCode the status code of the transaction
  • 27. BTC & ETH BLOCKCHAIN STATS 27 StopAndDecrypt The Ethereum-blockchain size has exceeded 1TB, and yes, it’s an issue Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain) bitinfocharts.com
  • 28. SO YOU WANT TO USE A BLOCKCHAIN… 28 Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain) Who can set or change the rules of the protocol? Who runs the nodes and pay for them? Who validates the block and at which cost? Who can read and/or write the blocks?
  • 29. 29Courtesy of Wired Alessandro Confetti - May 29th 2018 – Codemotion Webinar - Through the looking glass (of the blockchain)
  • 30. $ tail -f questions 30 Alessandro Confetti aconfet@thoughtworks.com twitter @zigolab 
 blog http://blog.zigolab.it