Chapter 26:Blockchain Databases Database System Concepts,7th Ed. @Silberschatz,Korth and Sudarshan See www.db-book.com for conditions on re-use
Database System Concepts, 7th Ed. ©Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-use Chapter 26: Blockchain Databases
Outline ■Overview Blockchain Properties Achieving Blockchain Properties via Cryptographic Hash Functions Consensus Data Management in a Blockchain ■Smart Contracts Performance Enhancement Emerging Applications Database System Concepts-7th Edition 26.2 @Silberschatz,Korth and Sudarshan
Database System Concepts - 7 26.2 ©Silberschatz, Korth and Sudarshan th Edition Outline ▪ Overview ▪ Blockchain Properties ▪ Achieving Blockchain Properties via Cryptographic Hash Functions ▪ Consensus ▪ Data Management in a Blockchain ▪ Smart Contracts ▪ Performance Enhancement ▪ Emerging Applications
History Blockchain technology's development was driven initially by cryptocurrencies. But cryptocurrency is just one application of blockchain Cryptocurrencies: ·Purely online Maintained by a decentralized distributed ledger ■Bitcoin One of the first successful cryptocurrencies,and the best known. Published under the pseudonym Satoshi Nakomoto Aims to be an anonymous,fully distributed and decentralized currency There are other blockchains that are more appropriate for blockchain- based enterprise data Database System Concepts-7th Edition 26.3 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 26.3 ©Silberschatz, Korth and Sudarshan th Edition History ▪ Blockchain technology’s development was driven initially by cryptocurrencies. • But cryptocurrency is just one application of blockchain ▪ Cryptocurrencies: • Purely online • Maintained by a decentralized distributed ledger ▪ Bitcoin • One of the first successful cryptocurrencies, and the best known. • Published under the pseudonym Satoshi Nakomoto • Aims to be an anonymous, fully distributed and decentralized currency • There are other blockchains that are more appropriate for blockchainbased enterprise data
Types of Blockchain ■Public Anyone can download the needed software and create a blockchain node No trust assumed among participating nodes Permissioned Permission to run a blockchain node is granted by a permissioning authority Some degree of relaxation of the assumptions of trustlessness and autonomy The type of blockchain influences the choice of algorithm used by which nodes agree on the next block to be added to the blockchain Database System Concepts-7th Edition 26.4 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 26.4 ©Silberschatz, Korth and Sudarshan th Edition Types of Blockchain ▪ Public • Anyone can download the needed software and create a blockchain node • No trust assumed among participating nodes ▪ Permissioned • Permission to run a blockchain node is granted by a permissioning authority • Some degree of relaxation of the assumptions of trustlessness and autonomy ▪ The type of blockchain influences the choice of algorithm used by which nodes agree on the next block to be added to the blockchain
Blockchain Properties and Structure Linked list of blocks Each block contains a pointer to the previous block plus a hash of the previous block Except,of course,for the first block,called the genesis block Tamper resistance The inclusion of the hash of the previous block makes tampering difficult Changing the contents of a block means changes all newer blocks as well Specific mathematical requirements for the hash function (see later) Replication prevents replacement of the entire blockchain without gaining majority control Database System Concepts-7th Edition 26.5 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 26.5 ©Silberschatz, Korth and Sudarshan th Edition Blockchain Properties and Structure ▪ Linked list of blocks • Each block contains a pointer to the previous block plus a hash of the previous block ▪ Except, of course, for the first block, called the genesis block ▪ Tamper resistance • The inclusion of the hash of the previous block makes tampering difficult ▪ Changing the contents of a block means changes all newer blocks as well • Specific mathematical requirements for the hash function (see later) • Replication prevents replacement of the entire blockchain without gaining majority control
Blockchain Properties and Structure Node types Full node-maintains copy of blockchain and participates in the consensus process Light node -submits updates to the blockchain but does not participate in the consensus process Consensus algorithms to choose node to add next block: Proof of work-first node to solve a certain hard math problem Proof of stake-node selected based on amount of currency owned or held in reserve Byzantine consensus-message-based protocol to reach consensus on next block Other approaches-proof of activity,proof of burn,proof of capacity, proof of elapsed time Database System Concepts-7th Edition 26.6 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 26.6 ©Silberschatz, Korth and Sudarshan th Edition Blockchain Properties and Structure ▪ Node types • Full node – maintains copy of blockchain and participates in the consensus process • Light node – submits updates to the blockchain but does not participate in the consensus process ▪ Consensus algorithms to choose node to add next block: • Proof of work – first node to solve a certain hard math problem • Proof of stake – node selected based on amount of currency owned or held in reserve • Byzantine consensus – message-based protocol to reach consensus on next block • Other approaches – proof of activity, proof of burn, proof of capacity, proof of elapsed time
Blockchain Properties and Structure Forks A fork occurs if a block is added to a block that is not the most recent one Accidental if consequence of the consensus algorithm One fork survives;others are eventually orphaned Malicious if due to an attempt to damage the blockchain Consensus-based if agreed to by majority of users Consensus-based fork types Hard-old version of blockchain software does not recognize new blocks as valid Soft-old version of blockchain software recognizes new blocks as valid Database System Concepts-7th Edition 26.7 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 26.7 ©Silberschatz, Korth and Sudarshan th Edition Blockchain Properties and Structure ▪ Forks • A fork occurs if a block is added to a block that is not the most recent one • Accidental if consequence of the consensus algorithm ▪ One fork survives; others are eventually orphaned • Malicious if due to an attempt to damage the blockchain • Consensus-based if agreed to by majority of users ▪ Consensus-based fork types • Hard – old version of blockchain software does not recognize new blocks as valid • Soft – old version of blockchain software recognizes new blocks as valid
Blockchain Properties and Structure Digital signature Public-key encryption is used to allow users to sign their transactions. Ensures that users cannot deny submitting the transaction,a property called irrefutability. Anonymity Users can remain anonymous unless there is a way to tie the user's ID (public key)to a real-world entity Summary of blockchain properties: Decentralization-majority consensus with no central authority. Tamper resistance-infeasibility of changing the contents of blocks on the blockchain. Irrefutability-user cannot deny having submitted a transaction. Anonymity-IDs not directly tied to any real-world entity Database System Concepts-7th Edition 26.8 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 26.8 ©Silberschatz, Korth and Sudarshan th Edition Blockchain Properties and Structure ▪ Digital signature • Public-key encryption is used to allow users to sign their transactions. • Ensures that users cannot deny submitting the transaction, a property called irrefutability. ▪ Anonymity • Users can remain anonymous unless there is a way to tie the user’s ID (public key) to a real-world entity ▪ Summary of blockchain properties: • Decentralization – majority consensus with no central authority. • Tamper resistance – infeasibility of changing the contents of blocks on the blockchain. • Irrefutability – user cannot deny having submitted a transaction. • Anonymity – IDs not directly tied to any real-world entity
Cryptographic Hash Functions Let h denote a cryptographic hash function.Then h must satisfy the following properties: Collision resistant-It is infeasible to find two distinct values x and y such that h(x)=h(y) Irreversible-Given h(x),it is infeasible to find x. By infeasible,we mean that there is strong mathematical evidence,if not an actual proof,that there is no approach to obtaining an answer that is better than guessing from the set of all possibilities. Database System Concepts-7th Edition 26.9 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 26.9 ©Silberschatz, Korth and Sudarshan th Edition Cryptographic Hash Functions ▪ Let h denote a cryptographic hash function. Then h must satisfy the following properties: • Collision resistant – It is infeasible to find two distinct values x and y such that h(x) = h(y) • Irreversible – Given h(x), it is infeasible to find x. ▪ By infeasible, we mean that there is strong mathematical evidence, if not an actual proof, that there is no approach to obtaining an answer that is better than guessing from the set of all possibilities
Blockchain Transactions Exact transaction model is specific to each blockchain. ■Bitcoin No account balances stored directly. A transaction specifies: Input transactions(whose output are spent by this transaction) A set of outputs,each specifying the recipient and the amount A digital signature from the user submitting the transaction Additionally a Bitcoin transaction may: Store a small amount of data on the blockchain Specify a slightly more complex transaction using the Bitcoin scripting language Ethereum Maintains account balances,which are modified by transactions Has a more sophisticated,Turing-complete scripting language Database System Concepts-7th Edition 26.10 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 26.10 ©Silberschatz, Korth and Sudarshan th Edition Blockchain Transactions ▪ Exact transaction model is specific to each blockchain. ▪ Bitcoin • No account balances stored directly. • A transaction specifies: ▪ Input transactions (whose output are spent by this transaction) ▪ A set of outputs, each specifying the recipient and the amount ▪ A digital signature from the user submitting the transaction • Additionally a Bitcoin transaction may: ▪ Store a small amount of data on the blockchain ▪ Specify a slightly more complex transaction using the Bitcoin scripting language ▪ Ethereum • Maintains account balances, which are modified by transactions • Has a more sophisticated, Turing-complete scripting language