The blockchain and its applications to energy, videosurveillance and e- commerce Pierluigi Gallo Pierluigi Gallo pierluigi.gallo@unipa.it 1
Outline • Motivation • Blockchain applications • blockchain technical intro • Hash functions • Hash cash • Blockchain structure • Comparison between finance transactions and energy transactions Pierluigi • Application in videosurveillance Gallo • An exemplary application in e-commerce 2
Motivations • Why we talk about blockchains during a Linux Day? • It’s an hot topic and everyone talks about it • Several platforms are designed to run everywhere, most of them run on Linux • For the Kerckhoffs's principle the code has to be open source Pierluigi Gallo 3
• Finance and money transfer • Online music • Government R3 (Intel, Microsoft, Oracle, Voise, Mycelia Circles, GovCoin • • • +60) Dubai is aiming to put all its • • Car sharing WSBA Wall Street Blockchain government documents on the • Alliance blockchain by 2020. • Insurance Applications • Education and University • Crowdfunding B3I , The Blockchain • Insurance Industry Initiative Certificates stored on the • • Charity and ONG blockchain Aeternity, LenderBot from • Stratumn, InsurETH BitGive • • Human resources • Healthcare • Supply Chain Management • Voting systems • Tierion, Gem, Philips, Microsoft • Provenance, Fluent, SKUChain, and Blockverify • Decentralized File Storage SM L • Transport • Leasing and selling cars • IPFS, Swarm, StoreJ • BiTA – Blockchain in Transport Visa + Docusign • • Notary and Real Estate Alliance • Networking and IoT • Ubitquity • Blockchain as a service Adept, ChainOfThings • • Testament and crypto-will IBM Hyperledger • IBM+Samsung, cognitive IoT • Smart will • • Internet of loyalty applications with smart contracts. Filament • Stock trading loyyal • • Data analysis, bets, forecasting Pierluigi • Trading • Cybersecurity Augur • Gallo OpenBazaar Guardtime • • • The Wisdom of the Crowd • Energy management • Videosurveillance EWF (Energy Web Foundation) • • Crowdsourced knowledge Transactive Grid, LO3, SolarCoin, • AutoGrid Lunyr • 4
Blockchain is a data structure What is a blockchain? containing authoritative log of validated transactions The blockchain as a chain of ownership without a trusted intermediary Block Block Block --- --- --- Transaction 1 Transaction 1 Transaction 1 Transaction 2 Transaction 2 Transaction 2 … … … Pierluigi Gallo Transaction n Transaction n Transaction n It’s a chain because changes can be made only by adding new information to the end and because blocks are linked each other 5
Bob Alice From financial transactions to energy transactions Transaction - from Latin Transition - from Latin Transactus, p.p. of Transigere, Transitionem, to negotiate pass, passage • Mapping the physical (and digital) world in the digital world State 0 State 1 • Transactions are movements of anything with a value between two parties Alice Alice • In Bitcoin transactions keep track of transfer of bitcoins , • in the energy sector, transactions involve the transfer of State Pierluigi energy between a generator and a load transition Gallo Bob • Transactions record events in the physical Bob world • Energy transactions 6
Hash functions Pierluigi Gallo Understanding Cryptography – Christof Paar and Jan Pelzl The Hash rate indicates how many hash functions can be computed by a computer per second 7
Choose another value Hashcash (PoW) Reference Reference to Numeric to the last transactions + + value block within this • The puzzle depends on the last block in the (nonce) block blockchain 1, 2, 3, … • when the puzzle is solved, automatically there is a new puzzle to solve • This work is ’provable’ (it only needs to compute one hash to prove it) • dynamically adjusted target • Hashcah makes block creation computationally "hard" 6f0378f21a495f 5c13247317d158 • SHA256 is designed to be a completely e9d51da45a5bf6 8fc2f366e450de unpredictable pseudorandom function, the only afdc8302 way to create a valid block is simply trial and error, Starts Pierluigi repeatedly incrementing the nonce and seeing if with k Gallo the new hash matches No zeros? • The winner of this puzzle will be able to write his 000000f21a495f Yes block in the blockchain 5c13247317d158 e9d51da45a5bf6 We have finished • It is rewarded with some ‘transaction fee’ 8fc2f366e450de • The other ones will stop their quest for the solution our work 8 afdc8302
Blockchain internals: Hash pointers Blockchain are append-only, they maintain the whole history H[ ] H[ ] H[ ] H[ ] Data Data Data Block Block Block 10 11 12 Hash Pointer data structures, since the 70ies Pierluigi Gallo Data Integrity guaranteed even on unsecure storage
Blockchain internals: Merkle Trees Blockchain are append-only, they maintain the whole history H[ ] H[ ] H[ ] H[ ] Block 11 Data Nonce Block 13 Root Hash Hash01 Hash23 Merkle Trees (since the 70ies) Hash0 Hash1 Hash2 Hash3 Pierluigi Gallo TX2 TX3 TX0 TX1 Data Integrity guaranteed even on unsecure storage
Shareability across boundaries of trust Blockchain features (no need for single trust anchor) • Distributed ledger • Fully distributed, no need for middleman • Immutable • Byzantine fault tolerant system with decentralized consensus • Cryptographically secure • Works well in trustless environments 3T Pierluigi Traceability • Gallo Transparency • • A fertile soil for smart contracts Trust • (no need for single trust anchor) 11
Forks It happens a fork! ⊂ B 7 ⊂ B 8 ⊂ B 6 B 1 ⊂ B 2 ⊂ B 3 ⊂ B 4 ⊂ B 5 ⊂ B’ 6 • How to resolve forks? • Choose the longest branch (more work is behind the longest branch) • Remove the shortest branch • To be sure that my block is not involved in a fork I need to wait for other successive 6 blocks. This protects from forks but introduces latency Pierluigi • The more blocks are added after a block, the more such block is trusted Gallo • As the blocks pile on top of each other, it becomes exponentially harder to reverse the transaction, thereby making it more and more trusted by the network. 12
Orazi and Curiazi (my personal view on proof of work) C Z A B ∆ T ∆ T The mining procedure The legend 3 soldiers (A,B,C) against 1 (Z) would easily win but … Pierluigi Gallo • All nodes that want to add a block have to mine • All soldiers that want to kill Z have to run after him • Mining is a time- and energy-consuming process • A,B,C run after Z • Miners arrive at different times (the difficulty of • Running is a time- and energy-consuming process mining can be tuned) • After the run, A,B,C arrive at different time 13
Tuning the difficulty of mining new blocks • d is tuned so that we have a winner every 10 minutes (average) • This time has not to bee too short to avoid too many forks • This time should be the shortest possible in order to reduce latencies • We tune d to have a constant difficulty as computation capabilities increase over time • The work has to be hard, in order to provide consensus while preventing Sybil attacks Pierluigi • Our goal is to have energy-efficient transactions Gallo • Does it make sense to have a such huge waste of energy to maintain the blockchain? 14
How transactions are added and chained (consensus protocol) • It depends on the blockchain, but we need some ’rules’ to avoid clashes and inconsistencies • In a fully-distributed system rules are needed to select who can write next block • Nodes that receive a valid transaction that has not seen before will immediately forward it to other connected nodes • the transaction rapidly propagates out across the peer-to-peer network, reaching a large percentage of the nodes within a few seconds. Pierluigi Gallo 15
Lightweight proving before writing a block • proof of work, • PBFT, • proof of stake, • proof of activity, • proof of burn, • proof of Elapsed Time (PoET), • proof of location. Pierluigi Gallo 16
Blockchain taxonomy by permission to write blocks • Public or permissionless • Typical application: cryptocurrencies • Proof of work – requires a lot of energy • Permissioned • Most of the rest of the applications, except cryptocurrencies • Proof of X (including proof of work) • Does not require much energy Pierluigi Gallo • Private • Not of big interest 17
Transactions are chained (not only blocks): Financial transactions the inputs from the latest transaction correspond to outputs from previous transactions. • Transactions are like lines in a double- entry bookkeeping ledger. • one transaction contains: • one or more “inputs,” which are debits against a bitcoin account. • one or more “outputs,” which are credits added to a bitcoin account. • The inputs and outputs (debits and credits) do not necessarily add up to the same amount • Generally, outputs add up to slightly less Pierluigi than inputs, the difference is the Gallo “transaction fee” • The transaction fee is used as reward for the miner who includes the transaction in the ledger for his work Transactions move value from transaction inputs to transaction outputs 18
Recommend
More recommend