Blockchain - ISA Bangaloreisabangalore.org.in/.../2017/11/PraphulBlockchainIntro.pdfThe rational...

44
Blockchain Distributed Data, Distributed Trust Praphul Chandra www.koinearth.com , www.insofe.edu.in

Transcript of Blockchain - ISA Bangaloreisabangalore.org.in/.../2017/11/PraphulBlockchainIntro.pdfThe rational...

BlockchainDistributed Data, Distributed TrustPraphul Chandra

www.koinearth.com,

www.insofe.edu.in

Trying to determine what is going on in the world by reading newspapers is like trying to tell the time by watching the second hand of a clock.

- Ben Hecht

Ridley, Matt, and L. J. Ganser. The rational optimist: How prosperity evolves. London: Fourth estate, 2010.

Both insect & human societies achieve

large scale cooperation.

Humans are the only species where individuals co-operate beyond kin.

Image Credits: Google

How did we get here?

Ridley, Matt, and L. J. Ganser. The rational optimist: How prosperity evolves. London: Fourth estate, 2010.

How did we get here?

Exchange

• Of Goods

• Trade

• Incentive alignment (Non-zero sum games)

• Morality as self interest | Golden Arches theory

• Of Ideas

• Learning

• From each other

• By standing on the shoulder of giants

Social Mechanisms & Technologies

• For exchange of Goods

• Markets | Bazaar (Agora)

• Laws

• Governance

• For exchange of ideas

• Language

• Gutenberg press, Web

• Schools & Universities

The web is more a social creation than a technical one. I designed it for a social effect — to help people work together — and not as a technical toy. The goal of the Web is to serve humanity. We build it now so that those who come to it later will be able to create things that we cannot ourselves imagine.

- Tim Berner Lee

Human evolution is characterized by increasing social complexity…

Diamond, Jared M., and Doug Ordunio. Guns, germs, and steel. Books on Tape, 1997.

Number of people (scale of cooperation)

Settlement Pattern

Basis of relationship

Decision Making

Conflict Resolution

Economics(Trade; Specialization)

Band

Dozens

Nomadic(Hunter Gatherers)

Kin

Egalitarian (Group Consensus)

Informal(leverage kinship)

Informal(Common ownership; Gender based roles)

Tribe

Hundreds

Village(Settlement)

Kin-based clan

Big-Man

Informal(leverage kinship)

Informal(Barter;

Gender based roles)

Chiefdom

Few Thousands

Groups of villages

Residence & Class

Chief

Chief(Centralized)

Informal(Commodity Money;Specialized classes)

Nation State

Hundreds of Thousands

Cities, Villages

Residence & Class

Institutional Hierarchy(Municipality, Parliament)

Institutional Hierarchy(Codified Law, Judiciary)

Markets(Credit Money;

Super specialization)

The trend of increasing social complexity continues at multiple scales…

Increasing social complexity is both an opportunity & challenge

Bettencourt, Luís MA, et al. "Growth, innovation, scaling, and the pace of life in cities." Proceedings of the national academy of sciences 104.17 (2007): 7301-7306.

social complexity ~ social institutions

• Scaling cooperation increases social complexity

• Increased social complexity requires scalable social mechanisms

• Increased social complexity both requires & fuels innovation.

• We design institutions to formalize social mechanisms

• We accept the constraints & duties imposed by institutions trusting that others would do the same

• Both human institutions & social mechanisms are human creations

• Which should be preserved as long as they achieve their objective … and no longer.

Institutional diversity may be as important as biological diversity for our long term survival.- Elinor Ostrom

Today’s social institutions

• Conflict Resolution

• The rule of written law

• Hierarchical judiciary

• Decision Making

• Constitutionalism (Liberty, Rights, Duties)

• Democracy (Legislature & Executive)

• Economics | Trade

• Money

• Financial Institutions (Banks, Accounting)

Are these institutions relevant today?

Will they scale?

Do they need to evolve?

We have created a Star Wars civilization, with Stone Age emotions, medieval institutions, and godlike technology.

- Edward O. Wilson

MoneyAn institution at the cusp of transformation

Money: What is it?

• Money• …is a human creation.

• …to enable groups of individuals to trade across time & space.

• What is it used for ?• A medium of exchange

• A standard of value

• A store of value

• In terms of a social system,• Money as an information system

• A way of accounting for each person’s contributions to the society

• What a social system chooses to call money is arbitrary • Derives value from a consensus that everyone will accept it as a store of value

• Legal Tender | Encapsulates trust in an institution

Money : Where does it come from?

https://medium.com/mit-media-lab-digital-currency-initiative; http://goldseek.com/news/2009/1-12mh/11.png

• Money ≠ Cash

• Cash is minted

• Money is created (as bits)

• Money vs. Cash (Global Supply)

• Money is created

• As a ledger entry

• By a commercial bank

• When the bank approves a loan

• …since you always pay more than the principle

• Historically

• Commodity

• Symbolic

• Credit

Currency (Money)

• Currency

• An asset used as a medium of exchange

• Today’s currencies have no inherent value (unlike cattle, gold etc.)

• Derives value from trust (… that others would value, & thus, accept it)

• Security of transaction relies on banks (centralized financial infrastructure)

• Cryptocurrency

• Cryptography use to secure the currency transaction

• Cryptography use to control the creation of the currency (Not Fiat)

• Has no physical form (‘exists’ only in the network)

• Decentralized Cryptocurrency

• A cryptocurrency whose creation is decentralized

• A cryptocurrency whose transactions security is decentralized (based on consensus)

• e.g. Bitcoin, Namecoin, Ethereum

Cryptocurrency & Blockchain

Cryptography Refresher

• Basis of “Proof-of-Work”

• Difficult

• Find x, such that Hash(Data, x) < Threshold

• Must try many, many “x” : Brute force computation

• Easy

• Given x, verify that Hash(Data, x) < Threshold

• Exactly one computation

http://www.totalbusinesssolution.in/images/Digital-Signature-Scheme.jpg

An Entity

• Is capable of

• accepting / paying money (currency)

• undertaking transactions

• Owns a wallet

• Client software (Mobile, PC)

• Contains private-public key pair(s)

• Private key is private (secret) known only to entity

• Public key is public & serves as an account # / address

• Has an identity in the real world

• Which may or may not be revealed on the blockchain

PrivateKey

PublicKey

PublicAddress

Transaction

• Is

• Value (currency) transfer from an entity to another

• Leg2 of a transaction (Leg1: product / service)

• e.g. a cheque

• Blockchain transaction

• Value : Cryptocurrency

• Receiver : Public Key (Hash) ~ Account #

• Sender : Public Key (Hash) ~ Account #

• Signature : Digital sign. with sender private key

• Cheque # : Transaction id

• Date : Timestamp (Creation, Acceptance)

• Ledger : Blockchain ~ a universal “bank”

Validating transactions

• Blockchain transaction

• Value : Cryptocurrency

• Receiver : Public Key (Hash) ~ Account #

• Sender : Public Key (Hash) ~ Account #

• Signature : Digital sign. with sender private key

• Cheque # : Transaction id

• Date : Timestamp (Creation, Acceptance)

• Ledger : Blockchain ~ a universal “bank”

• Transaction Verification

• Transaction Value ≤ Sender Balance

• Receiver public key is a valid address

• Senders signature matches the account number

• Transaction id recorded in the ledger

• Date of creation and entry into ledger recorded

• Transaction broadcast to other network nodes

Blockchain : A cryptocurrency view

• A ledger

• Which stores every (cryptocurrency) transaction

• A database

• An immutable ledger

• Records once written cannot be deleted / modified

• Records can be appended

• An immutable distributed ledger

• The ledger is maintained by a peer to peer network

• No single entity owns / controls the ledger

• An immutable distributed open ledger

• Any node can join the network

• Any node can access (read) the ledger entries

• Any node can append new entries in the ledger

https://cdn.bipartisanpolicy.org/wp-content/uploads/2016/06/bank-ledger.png

An immutable

append onlydistributed

openledger

Blockchain : A computer science view

• A data structure

• Consisting of blocks (batches) of validated transactions

• Chained together (Chain of Blocks : Blockchain)

• A cryptographically secured data structure

• Each block is digitally signed

• Each block contains the hash of the previous block

• A cryptographically secured distributed data structure

• Each node maintains a copy (replicated)

• A cryptographic proof-of-work append only data structure

• Nodes compete to add blocks (to earn cryptocurrency)

• Compete: solve a cryptographic puzzle (computationally hard)

• Winning node

• Presents proof-of-work that it solved the cryptographic puzzle

• Other nodes verify (computationally easy)

• All nodes append the block to (their copy of) the blockchain

Acryptographically secured (immutable)

append onlydistributed

cryptographic consensus data structure

Blockchain : Two views

An immutable

append onlydistributed

opentransaction ledger

Acryptographically secured (immutable)

append onlydistributed

cryptographic consensus data structure

Blockchain for Cryptocurrency

• A p2p network of nodes

• Maintains a distributed ledger of all past transactions (blockchain)

• Hence, all account (public key) balances

• Entities

• Own wallets containing private-public key pair(s)

• Undertake transactions : transfer of value / cryptocurrency

• A transaction

• Embeds public key of receiver ; Signed with private key of sender

• Is broadcast to the p2p network

• Each node

• Verifies the transaction

• Attempts to add transactions to the blockchain

Cryptocurrency on Blockchain

• Cryptocurrency

• Entities (Wallets : Key-pairs)

• Transactions

• Distributed Ledger

• P2P Network (of nodes / miners)

Blockchain beyond Cryptocurrency

From cryptocurrency to smart contracts

Smart Contract Validation (Verification)

• Transaction Verification

• Transaction Value ≤ Sender Balance

• Receiver public key is a valid address

• Senders signature matches the account number

• Transaction id recorded in the ledger

• Date of creation and entry into ledger recorded

• Transaction broadcast to other network nodes

• Smart Contract Execution

• Contract condition satisfied

• Receiver public key is a valid address

• Senders signature matches the account number

• Transaction id recorded in the ledger

• Date of creation and entry into ledger recorded

• Transaction broadcast to other network nodes

Blockchain as a state machine + Oracles

• Transactions

• State : Account balances of all entities

• Changed by transactions & conditional transactions

• Conditional Transactions : Smart Contract

• Class | Object

• State : Private variables

• Transition : Functions

• Oracles

• Determine the conditions for contract execution

• May require the blockchain to interact with non-entities

• Triggering Smart Contracts

• A website

• A sensor

• A pre-determined entity

• Consensus among entities: Incentivizing truthful reporting

Blockchain 1.0 vs. 2.0

An immutable

append onlydistributed

opencontracts ledger

Acryptographically secured (immutable)

append onlydistributed

cryptographic consensus state machine

An immutable

append onlydistributed

opentransaction ledger

Acryptographically secured (immutable)

append onlydistributed

cryptographic consensus data structure

Bitcoin | Ethereum

BTC ETH

ScriptA stack based low level program. lang. (100 OpCodes)

SolidityA Turing complete high level program. Lang.

Cryptocurrency TransactionsTwo-party, Multiparty, Delayed

Cryptocurrency Smart ContractsConditional Transactions based on arbitrary conditions

- OracleAn entity which can verify arbitrary condition

- GasLimit contract execution resources

7k nodesp2p Network

18k nodesp2p network

SecureNo known attacks … till date

Secure?DAO attack ... Hard Fork

Proof-of-Work Proof-of-WorkProof-of-stake soon?

ImplicationsApplications & Opportunities

Core Banking

• Efficiency

• Of a central database

• Real Time clearing

• Robustness

• Of a 3rd party clearing house

• Cost

• No custom middleware

• No manual processes / verification

https://richtopia.com/emerging-technologies/four-pillars-blockchain-technology-part-1

Supply Chains | Trade Finance

• B2B Contracts

• Embedded in a blockchain

• Payment conditional on quality & timeliness of supply

• Oracle

• Sensors determine quality & timeliness of supply

• Financial Instrument

• LOC in cryptocurrency

• Bank as credit enabling entities

Smart Property | Loan Finance

• B2B / B2C loan contracts

• Property as collateral

• Loan terms embedded in a blockchain

• Property access conditional on timely installments

• Oracle

• Loan giver as the oracle (asymmetric relation)

• Financial Instrument

• A loan in cryptocurrency

• Bank as credit enabling entities

Proof Of Existence | KYC

• Proof of Existence

• Document hash stored on the blockchain

• Timestamped + Sender Public Key

• Who registered (created) this document & when

• Public Ledger / Database

• Available for verification by anyone

• Public registries

• Land records

• Birth / Death certificates

• Patents / Copyrights / Licenses

• Student transcripts / Teacher Performance

Summary

Blockchain

• The Trust Machine

• Distributed Consensus without an intermediary

• The Internet of Value

• Enable transactions among entities with a “trusted” center

• Decentralized p2p network

• The Future or Money

• Efficient Transaction processing

• Programmable Money : Smart Contracts

• A Universal Computer

• A Distributed Ledger ~ A Replicated Database

• A Distributed Computer ~ A Replicated Computer (contract / transaction verification)

May (you realize) you live in interesting times..

• What would banking look like if we design it today?

• If code is law, how will the legal system change?

• Isn’t electoral democracy just a social contract?

koinearth confidential