1 Blockchain and Bitcoin Scripts
S. Prithi, Prabha Selvaraj, S. Suganthi. and D. Sumathi.
CONTENTS
1.1 Introduction
1.2 Categories of Blockchain
1.2.1 Public Blockchain
1.2.2 Private Blockchain
1.2.3 Consortium/Federated Blockchain
1.2.4 Hybrid Blockchain
1.3 Components of Blockchain
1.3.1 Cryptographic Hash Functions
1.3.2 Transactions
1.3.3 Asymmetric Key Cryptography
1.3.4 Derivation of Addresses
1.3.5 Ledgers
1.3.6 Blocks
1.4 Architecture of Blockchain
1.5 The Blockchain as a Decentralized Security Framework
1.5.1 Working Model
1.5.2 Taxonomy of Blockchain
1.5.3 Security and Privacy
1.5.4 Security and Protection
1.6 Bitcoin Technology
1.6.1 Bitcoin Basics
1.6.2 Data Insertion in Bitcoins
1.7 Bitcoin Scripts
1.7.1 Bitcoin Scripting Language
1.7.2 Working of a Bitcoin Script
1.7.3 Applications of Bitcoin Scripts
1.8 Escrow ProtocolsāSecurity
1.9 Escrow ProtocolsāPrivacy
1.9.1 Escrow through Uninterrupted Payment
1.9.2 Escrow through MultiSig
1.9.3 Escrow through Threshold Signatures
1.9.4 Escrow through Bond
1.9.5 Blockchain Escrow Services
References
1.1 INTRODUCTION
Blockchain technology is an innovation that enables the distribution of digitized information and was originally designed for the bitcoin cryptocurrency. The authors Don and Alex Tapscott of āBlockchain Revolutionā defined blockchain as a scrupulous digital ledger of economic transactions that is programmed to record not only financial transactions but everything that has a value. As a basic definition, blockchain is a chain of blocks, in which block represents digital information and chain denotes the data stored in a public database. Blockchains are tamperproof digital ledgers carried out in a distributed manner without a centralized database and authority/organization. They allow a community of end users to perform transactions in a ledger which is shared within that association. Under the regular operation of the blockchain network, once the transactions are published they cannot be modified. In 2008, the idea of blockchains was integrated with other computing technologies and concepts to devise modern cryptocurrencies in which electronic cash is protected by means of cryptographic mechanisms in place of a central repository (Nakamoto, 2008). In 2009, with the establishment of the bitcoin network, blockchain became extensively in use. The electronic cash, represented as digital information, is transferred in a distributed system. The bitcoin users digitally sign and transfer their rights to another user and the bitcoin blockchain keeps the record of this transfer public so that the other participants can independently confirm the validation of the transactions. Thus, with cryptographic mechanisms, the blockchain is robust to attempts and the ledger can also follow up the forging of transactions.
Blockchain technology has empowered the advancement of cryptocurrency system such as Bitcoin, Litecoin, Peercoin, Namecoin and Ethereum. Blockchain permits members who donāt know each other to perform business safely. It verifies the identification of the participants, authenticates the transactions and guarantees that everyone performs by its rules. For instance, once the technology is fully developed and incorporated with supplementary technologies like artificial intelligence (AI) and internet of things (IoT), self-contained agents acting as the driver could negotiate an insurance tariff with multiple car insurance companies instantly using data from sensors. David Furlonger, Distinguished Vice President Analyst, Gartner says that āBlockchain technologies provide a set of abilities that deliver new business, economic and societal paradigms.ā According to an estimation done by Gartner, blockchain will yield $3.1 trillion in new operation value by 2030, and the organizations should start exploring the new technologies. He also predicted that by 2025, 50% of people who are using a smartphone but donāt have a bank account will utilize the mobile-accessible cryptocurrency account.
1.2 CATEGORIES OF BLOCKCHAIN
Blockchain can primarily be categorized into two types, private blockchain and public blockchain. Conversely, there are numerous variations, like Consortium/Federated and Hybrid blockchain. Each blockchain comprises a cluster of nodes operating on a peer-to-peer (P2P) network-based system. Each node contains a copy of the shared ledger that will be updated periodically. Every node can initiate or receive transactions, authenticate transactions and create blocks.
1.2.1 Public Blockchain
A public blockchain is a non-limitative variant where every peer can have a copy of the ledger. It is a permissionless distributed ledger technique where anybody can join and perform transactions. This implies that anybody can have accessibility to public blockchain if they have access to the internet. Bitcoin public blockchain was the first public blockchain that was launched to the public. It allowed everyone who had access to the internet to do transactions in a decentralized manner. The authentication of transactions was done through some agreements such as Proof-of-Work (PoW), Proof-of-Stake (PoS), etc. Some examples are Bitcoin, Litecoin and Ethereum.
1.2.1.1 Advantages
Some of the advantages of public blockchain are:
- Anybody can participate in public blockchain.
- The entire community could be trusted.
- Each and every person feels motivated toward the enhancement of the public network.
- Based on the count of the participating nodes, the public blockchains are protected.
- Transparency is brought to the entire network as the data are accessible for authentication purposes.
1.2.1.2 Disadvantages
Public blockchain has a few disadvantages. They are:
- Transaction Speed: To complete a transaction, blockchain takes a few minutes to hours. For example, bitcoin can handle only 7 transactions per second when compared with 24,000 transactions per second by VISA. This is because of the time taken to solve mathematical problems to complete the transaction.
- Scalability: As the number of nodes is increased, the performance of the network becomes slow. For instance, bitcoin is working on moving the transactions off-chain to quicken the bitcoin network and to make it more scalable.
- Choice of agreement: The choice of agreement method also degrades the performance of the network. For instance, bitcoin uses PoW which absorbs lot of energy.
1.2.2 Private Blockchain
A private blockchain works in a restrictive/closed environment. It is also known as permissioned blockchain, which is under the control of a system. For internal use-cases, the private corporation or organization makes a wonderful usage of private blockchains. The private blockchain could be used effectively and permits only certain participants to access the blockchain network. One of the differences of private blockchain from public blockchain is its accessibility. The next major difference is that only one authority keeps control over the network so the transactions are not done in a decentralized manner. Some examples are Multichain, Hyperledger Fabric, Corda, Hyperledger Sawtooth, etc.
1.2.2.1 Advantages
Some of the advantages of private blockchain are:
- They are relatively fast because there are fewer participants when compared with public blockchain. The network takes less time to attain consensus resulting in faster transactions.
- They are more scalable because only a few blocks are verified to validate transactions. So even if the network grows, the performance of the network, such as speed and efficiency, will not be affected. The essential factor is the centralized system that takes control over the network.
1.2.2.2 Disadvantages
The disadvantages of private blockchain are:
- Private blockchains are not decentralized, which contradicts the core doctrine of distributed ledger technology.
- Because it is a centralized network, it becomes quite difficult to attain trust within the private blockchain.
- Finally, there is a chance to lose security as only few nodes are utilized by the private network.
1.2.3 Consortium/Federated Blockchain
A consortium or federated blockchain is a creative approach to solving the requirements of the corporation where there is a demand for the features of both private and public blockchains. In a federated blockchain, some features of the corporation are made public whereas others remain private. One or more organizations manage the consortium blockchain so there is no one single authority of centralized results. To guarantee suitable functional capability, the consortium contains a validator node that performs two functions, authenticate transactions and also initiate or receive transactions. It provides all the features of a private blockchain such as transparency, efficiency, privacy and power. Some examples of consortium blockchain are Energy Web Foundation, R3 Corda, Marco Polo and IBM Food Trust.
1.2.3.1 Advantages
Some of the advantages are:
- It provides better customization capabilities and control over provisions.
- Federated blockchain is more secure and provides better expandability.
- Consortium blockchain is more efficient than public blockchain networks.
- It operates upon clearly defined structures of governance.
- It provides access controls.
1.2.3.2 Disadvantages
- Despite the fact that it is secure, the entire network can be compromised because of the membersā integrity.
- It is less transparent.
- Standards and restraint have a significant influence on network functional capability.
1.2.4 Hybrid Blockchain
Hybrid blockchain is the final type of blockchain and is a combination of private and public blockchain. It does have instances of uses in a corporation that neither desires to organize a private blockchain nor public blockchain and needs to deploy the best of both. Some examples of hybrid blockchain are Dragonchain and XinFinās Blockchain.
1.2.4.1 Advantages
- Need not consider everything public as it operates in a closed ecosystem.
- Based on the requirements, the rules can be modified.
- Hybrid blockchain networks are invulnerable to 51% of attacks.
- Even though it connects with a public network, it provides privacy as well as scalability.
1.2.4.2 Disadvantages
- Not fully transparent.
- It is a challenge to upgrade to the hybrid blockchain network.
- There is no provocation to contribute or participate in the network.
1.3 COMPONENTS OF BLOCKCHAIN
The several components of blockchain technology besides its dependence on cryptographic primitives such as cryptographic hash functions, transactions, digital signatures, asymmetric key cryptography and distributed systems are discussed in this section. Conversely, each component is described in simple terms, and they are used as building blocks to comprehend the complex system.
1.3.1 Cryptographic Hash Functions
Hashing is a technique to apply a cryptographic hash function to input data, which for input of any size like text or image estimates a unique result known as the message digest. The users can in turn use the input data, apply hash function and derive back the same result. The smallest deviation in the input, for instance even a deviation in a single bit, results in a unique output message digest.
Cryptographic hash function possesses three main security properties:
- 1. Preimage Resistant: This property implies that if some output value is given, it is infeasible to compute the correct input value. For instance, given a message digest, find x such that hash(x) = message digest.
- 2. Second Preimage Resistant: This property implies that if the input value is given, it is infeasible to compute a second input that yields the same output. For instance, given x, find y such that hash(x) = hash(y). The only method available is to search the input space exhaustively, nevertheless this is ...