Home  >  Article  >  What are the principles and characteristics of blockchain

What are the principles and characteristics of blockchain

angryTom
angryTomOriginal
2019-07-22 16:27:3320189browse

What are the principles and characteristics of blockchain

Recommended tutorial: Python tutorial

Blockchain The concept and characteristics of

Blockchain is an organic combination of a series of existing mature technologies. It effectively records distributed ledgers and provides complete scripts to support Different business logic. In a typical blockchain system, data is generated and stored in units of blocks, and is connected into a chain data structure in chronological order. All nodes jointly participate in the data verification, storage and maintenance of the blockchain system. The creation of a new block usually needs to be confirmed by a majority of nodes in the entire network (the number depends on different consensus mechanisms), and is broadcast to each node to achieve network-wide synchronization, and cannot be changed or deleted afterwards.

From the outside, the blockchain system should have the following characteristics:

● Multi-party writing, joint Maintenance

The multi-party here only refers to the bookkeeping participants and does not include clients using the blockchain. The accounting participants of the blockchain should be composed of multiple entities whose interests are not completely consistent, and in different accounting cycles, different participants take the lead in initiating accounting (the rotation method depends on different consensus mechanisms), and Other participants will jointly verify the accounting information initiated by the leading party.

● Public ledger

# The ledger recorded by the blockchain system should be in a state that all participants are allowed to access. In order to verify the blockchain For the validity of recorded information, accounting participants must have the ability to access the information content and ledger history. However, public ledgers refer to the disclosure of accessibility and do not represent the disclosure of information itself. Therefore, the industry expects to apply many privacy protection technologies, such as zero-knowledge proof, homomorphic encryption, threshold encryption, etc., to the blockchain. field to solve the problem of verifying the validity of information through ciphertext operations.

● Decentralization

Blockchain should be a system that does not rely on a single trust center, and the processing only involves closed systems within the chain When it comes to data, the blockchain itself can create trust between participants. However, in some cases, such as identity management and other scenarios, external data will inevitably be introduced, and these data require trust endorsement from a trusted third party. At this time, for different types of data, the trust should come from different trusted parties. third parties rather than relying on a single trust center. In this case, the blockchain itself does not create trust, but rather serves as a vehicle for trust.

● Non-tamperability

As the most significant feature of the blockchain, non-tamperability is a necessary condition for the blockchain system, not Under sufficient conditions, there are many hardware-based technologies that can also write data once, read it multiple times and cannot be tampered with. Typical examples are CD-R (Compact Disk-on-Record). The non-tamperability of the blockchain is based on the cryptographic hash algorithm and the characteristics of joint maintenance by multiple parties. However, due to this characteristic, the non-tamperability of the blockchain is not strictly speaking. It is more appropriate to call it difficult to tamper.

Core technology of blockchain

1. Distributed ledger

Distributed Ledger Technology DLT (Distributed Ledger Technology) is essentially a decentralized data storage that can share, synchronize and replicate data in a network composed of multiple network nodes, multiple physical addresses or multiple organizations. technology. Compared with traditional distributed storage systems, distributed ledger technology mainly has two different characteristics:

Traditional distributed storage systems implement a data management mechanism controlled by a central node or authoritative organization. Distributed ledger technology Ledgers are often based on certain consensus rules and use multi-party decision-making and joint maintenance for data storage, replication and other operations. In the face of the explosive growth of Internet data, the current way of building data management systems by a single central organization is facing more challenges. Service providers have to continue to invest in building large-scale data centers, which not only brings various computing, network, storage, etc. The problem of huge resource pool efficiency, and the ever-increasing system scale and complexity have also brought about increasingly severe reliability problems. However, the decentralized data maintenance strategy of distributed ledger technology can effectively reduce the burden of bloated systems. In some application scenarios, the huge resource pool accumulated by a large number of scattered nodes in the Internet can even be effectively utilized.

Traditional distributed storage systems decompose the data in the system into several fragments and then store them in the distributed system. However, each node in the distributed ledger has an independent and complete copy of the data storage. Nodes do not interfere with each other and have equal permissions. The final consistency of data storage is achieved through periodic or event-driven consensus between each other. After decades of development, the shortcomings of highly centralized data management systems in traditional business systems in terms of data trustworthiness and network security have attracted increasing attention. Ordinary users are unable to determine whether their data has been stolen or tampered with by service providers, and are even more powerless when attacked by hackers or security breaches occur. In order to deal with these problems, people continue to add additional management mechanisms or technologies, which further pushes up the situation. The maintenance cost of traditional business systems reduces the operational efficiency of business activities. Distributed ledger technology can fundamentally improve this phenomenon. Since each node maintains a complete set of data copies, any modification of the data by a single node or a few clusters will not affect the majority of the global copies. In other words, whether it is a deliberate modification by a service provider without authorization or a malicious attack by a network hacker, most nodes in the distributed ledger cluster need to be affected at the same time in order to achieve tampering with existing data. Otherwise, The remaining nodes in the system will quickly discover and trace the malicious behavior in the system, which obviously greatly improves the credibility and security guarantee of the data in the business system.

These two unique system characteristics make distributed ledger technology a very low-level revolutionary innovation that is powerfully disruptive to existing business systems.

2. Consensus mechanism

The blockchain is a distributed (decentralized) system with traceable history, non-tampering, and solving the problem of multi-party mutual trust. ization) system. Distributed systems are bound to face consistency problems, and the process of solving consistency problems is called consensus.

Reaching consensus in a distributed system requires a reliable consensus algorithm. The consensus algorithm usually solves the problem of which node in the distributed system initiates the proposal and how other nodes reach agreement on the proposal. Based on the difference between traditional distributed systems and blockchain systems, we divide consensus algorithms into consensus algorithms between trusted nodes and consensus algorithms between untrusted nodes. The former has been studied in depth and is widely used in popular distributed systems, among which Paxos and Raft and their corresponding variant algorithms are the most famous. Although the latter has been studied for a long time, it was not until the development of blockchain technology was in full swing in recent years that related consensus algorithms were widely used. According to different application scenarios, the latter is divided into consensus algorithms suitable for public chains represented by algorithms such as PoW (Proof of Work) and PoS (Proof of Stake), and PBFT (Practical ByzanTIne Fault Tolerance) and its variant algorithms. Represents the consensus algorithm suitable for consortium chains or private chains.

The Proof of Work POW algorithm is the algorithm adopted by the Bitcoin system. This algorithm was proposed by W. Dai in the design of B-money in 1998. The Ethereum system currently also uses the PoW algorithm for consensus, but because the Ethereum system generates blocks faster (about 15 seconds) and is easier to generate blocks, in order to avoid a large number of nodes running in vain, Ethereum proposed the Uncle block reward mechanism. The PoS (Proof of Stake) algorithm was first implemented by Sunny King in the PPC (PeerToPeerCoin) system released in August 2012. The Ethereum system has always had a good impression of PoS and plans to replace PoW with PoS as its consensus in the future. mechanism. PoS and its variant algorithms can solve the problem of wasting computing power that the PoW algorithm has been criticized for, but it itself has not been sufficiently verified. The PBFT algorithm was first proposed by Miguel Castro (Castro) and Barbara Liskov (Liskov) at the OSDI99 conference in 1999. This algorithm has higher operating efficiency than the original Byzantine fault-tolerant algorithm. Assuming there are N nodes in the system, the PBFT algorithm can tolerate the presence of F malicious nodes in the system, and 3F 1 is not greater than N. Although the PBFT consensus algorithm can tolerate more Byzantine nodes as the number of nodes in the system increases, its consensus efficiency decreases at an extremely fast rate. This is why we can see that there are very few systems that apply PBFT as a consensus algorithm. There are reasons for having more than 100 nodes.

Whether it is the PoW algorithm or the PoS algorithm, the core idea is to encourage nodes to contribute and contribute to the system through economic incentives, and to prevent nodes from doing evil through economic penalties. In order to encourage more nodes to participate in consensus, public chain systems usually issue tokens to nodes that contribute to the operation of the system. The difference between a consortium chain or private chain and a public chain is that participating nodes in a consortium chain or private chain usually hope to obtain trusted data from the chain, which is much more meaningful than obtaining incentives through accounting, so They have more obligations and responsibilities to maintain the stable operation of the system, and usually have a smaller number of participating nodes. PBFT and its variant algorithms are just suitable for application scenarios of alliance chains or private chains.

3. Smart Contract

● What is a smart contract?

Smart contract is a computer protocol designed to spread, verify or execute contracts in an information-based manner. Smart contracts allow trusted transactions without third parties. These transactions are traceable and irreversible. The aim is to provide security that is superior to traditional contracting methods and to reduce other transaction costs associated with contracts.

The concept of smart contracts dates back to the 1990s and was first proposed by computer scientist, jurist and cryptographer Nick Szabo. His definition of smart contracts is as follows: "A smart contract is a set of commitments defined in digital form, including an agreement on which contract participants can execute these commitments." Research scholars such as Nick Szabo hope to use cryptography and other The digital security mechanism puts the traditional formulation and performance of contract terms under computer technology to reduce related costs. However, due to the immaturity of many technologies at the time and the lack of digital systems and technologies that could support programmable contracts, Nick Szabo's working theory on smart contracts has not been realized.

With the emergence and maturity of blockchain technology, smart contracts, as an important research direction for blockchain and future Internet contracts, have developed rapidly. Smart contracts based on blockchain include event processing and storage mechanisms, as well as a complete state machine for accepting and processing various smart contracts. The status processing of data is completed in the contract. After the event information is passed into the smart contract, the smart contract is triggered to perform state machine judgment. If the triggering conditions of one or several actions in the automatic state machine are met, the state machine will select the automatic execution of the contract action based on the preset information. Therefore, as a computer technology, smart contracts can not only effectively process information, but also ensure that both parties to the contract can enforce the contract without involving a third-party authority, thus avoiding the occurrence of breach of contract.

● Advantages and Risks of Smart Contracts

With the widespread application of smart contracts in blockchain technology, its advantages have been recognized by more and more researchers Approval with technical staff. Generally speaking, smart contracts have the following advantages:

a. High timeliness of contract formulation: In the formulation of smart contracts, there is no need to rely on the participation of third-party authorities or centralized agencies, only the parties to the contract need to Through computer technology, the jointly agreed terms are transformed into automated and digital agreements, which greatly reduces the intermediate links in agreement formulation and improves the response efficiency of agreement formulation.

b. Low cost of contract maintenance: Smart contracts use computer programs as carriers during the implementation process. Once deployed successfully, the computer system will supervise and execute them in accordance with the provisions in the contract. Once the contract is breached, the smart contract can be implemented in accordance with the prior Agreements are enforced by procedures. Therefore, the cost of human supervision and execution is greatly reduced.

c. High accuracy of contract execution: During the execution of smart contracts, due to the reduction of human participation, all interested parties cannot interfere with the specific execution of the contract. The computer system can ensure the correct execution of the contract. Effectively improves the accuracy of contract execution.

Although smart contracts have obvious advantages over traditional contracts, in-depth research and application of smart contracts are still being explored, and we cannot ignore the potential risks of this emerging technology.

In 2017, the multi-signature Ethereum wallet Parity announced a major vulnerability that would render multi-signature smart contracts unusable. The vulnerability resulted in the freezing of Ethereum funds worth more than $150 million. . Coincidentally, in February 2018, a group of researchers from the National University of Singapore, Yale University College in Singapore, and University College London released a report claiming that they used the analysis tool Maian to analyze nearly 1 million smart contracts based on Ethereum and found that There are 34,200 contracts containing security vulnerabilities, which can be exploited by hackers to steal ether coins, freeze assets, and delete contracts.

The occurrence of security risk events is worthy of our reflection, but in any case, industry insiders generally believe that blockchain technology and smart contracts will become an important direction for the future development of IT technology. The current risks are caused by the maturity of new technologies. An inevitable process.

● Application of smart contracts

At present, smart contracts, as a core technology of blockchain, have been widely used in influential platforms such as Ethereum and Hyperledger Fabric. It is widely used in blockchain projects.

a. Smart contract application in Ethereum: A smart contract in Ethereum is a piece of code that can be executed by the Ethereum virtual machine. Ethereum supports a powerful Turing-complete scripting language, allowing developers to develop arbitrary applications on it. These contracts can usually be written in high-level languages ​​(such as Solidity, Serpent, LLL, etc.) and converted into bytecode through a compiler ( byte code) is stored on the blockchain. Once deployed, smart contracts cannot be modified. Users complete account transactions through contracts and manage and operate the currency and status of the account.

b. Smart contract application of Hyperledger Fabric: In the Hyperledger Fabric project, the concept and application of smart contracts are more widely extended. As stateless, event-driven, self-executing code that supports Turing completeness, smart contracts are deployed in the blockchain network in Fabric and interact directly with the ledger, playing a very central position. Compared with Ethereum, Fabric smart contracts and underlying ledgers are separated. When upgrading smart contracts, there is no need to migrate ledger data to new smart contracts, truly realizing the separation of logic and data. Fabric's smart contract is called chaincode, which is divided into system chaincode and user chaincode. The system chain code is used to implement system-level functions and is responsible for the processing logic of the Fabric node itself, including system configuration, endorsement, verification, etc. The user chain code realizes the user's application functions and provides state processing logic based on the blockchain distributed ledger. It is written by the application developer and supports the upper-layer business. User chaincode runs in an isolated chaincode container.

4. Cryptography

Information security and cryptography technology are the cornerstone of the entire information technology. In the blockchain, a large number of modern information security and cryptography technical achievements are also used, mainly including: hash algorithm, symmetric encryption, asymmetric encryption, digital signature, digital certificate, homomorphic encryption, zero-knowledge proof, etc. This chapter briefly introduces the application of security and cryptography technology in blockchain from the aspects of security integrity, confidentiality, identity authentication and other dimensions.

● Integrity (anti-tampering)

The blockchain uses cryptographic hash algorithm technology to ensure that the integrity of the blockchain ledger is not destroyed. The hash (hash) algorithm can map binary data into a shorter string and has input-sensitive characteristics. Once the input binary data is slightly tampered with, the string obtained by the hash operation will be abnormal. big change. In addition, excellent hash algorithms also have conflict avoidance characteristics. If you input different binary data, the hash result strings obtained will be different.

The blockchain utilizes the input sensitivity and conflict avoidance characteristics of the hash algorithm. In each block, it generates a hash value containing the previous block, and generates a verified transaction value in the block. Merkle root hash. Once some blocks of the entire blockchain are tampered with, the same hash value cannot be obtained as before the tampering, thus ensuring that the blockchain can be quickly identified when it is tampered with, ultimately ensuring the integrity of the blockchain (anti-tampering) .

● Confidentiality

Encryption and decryption technology is divided into two categories in terms of technical composition: one is symmetric encryption and the other is asymmetric encryption. The encryption and decryption keys of symmetric encryption are the same; the encryption and decryption keys of asymmetric encryption are different, one is called the public key and the other is called the private key. Data encrypted by the public key can only be decrypted by the corresponding private key, and vice versa.

Blockchains, especially alliance chains, require TLS (Transport Layer Security) encrypted communication technology during the entire network transmission process to ensure the security of transmitted data. TLS encrypted communication is the perfect combination of asymmetric encryption technology and symmetric encryption technology: the communicating parties use asymmetric encryption technology to negotiate to generate a symmetric key, and then use the generated symmetric key as the working key to complete the encryption and decryption of data. This simultaneously takes advantage of the advantages of asymmetric encryption, which does not require the sharing of keys between both parties, and the speed of symmetric encryption operations.

● Identity Authentication

Pure TLS encrypted communication can only ensure the confidentiality and integrity of the data transmission process, but cannot guarantee the trust of the communication peer (middleman) attack). Therefore, it is necessary to introduce a digital certificate mechanism to verify the identity of the communication peer, thereby ensuring the correctness of the peer's public key. Digital certificates are generally issued by authoritative organizations. One side of the communication holds the public key of the authoritative root CA (Certificate Authority) to verify whether the communication peer's certificate is trusted by itself (that is, whether the certificate is issued by itself), and to confirm the peer's identity based on the certificate content. After confirming the peer's identity, take out the public key in the peer's certificate and complete the asymmetric encryption process.

In addition, the latest research results of modern cryptography are also applied in the blockchain, including homomorphic encryption, zero-knowledge proof, etc., to maximize privacy when the blockchain distributed ledger is public Protective ability. Technology in this area is still being developed and improved.

Blockchain security is a system project. System configuration and user permissions, component security, user interface, network intrusion detection and attack prevention capabilities, etc., will all affect the security and reliability of the final blockchain system. . During the actual construction process of the blockchain system, a reasonable balance should be achieved in terms of security, system construction cost and ease of use on the premise of meeting user requirements.

The above is the detailed content of What are the principles and characteristics of blockchain. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn