The four core technologies of the blockchain: 1. Distributed ledger, which plays the role of data storage in the blockchain; 2. Consensus mechanism, which plays the role of coordinating the behavior of nodes in the blockchain. Clarify the role of data processing; 3. Cryptography, which can ensure data security and verify data ownership; 4. Smart contracts, which play the role of data execution and application in the blockchain.
The operating environment of this tutorial: Windows 10 system, Dell G3 computer.
In fact, in the past ten years, blockchain has made great changes and progress on the original basis. As of now, the four core technologies of blockchain have been enriched-distributed ledger, consensus mechanism, Cryptography and smart contracts respectively play the role of data storage, data processing, data security, and data application in the blockchain. In general, the four core technologies each have their own role in the blockchain, and they jointly build the foundation of the blockchain.
First of all, distributed ledger builds the framework of the blockchain. It is essentially a distributed database. When a After a piece of data is generated and processed by everyone, it will be stored in this database, so the distributed ledger plays the role of data storage in the blockchain;
The blockchain consists of many nodes that together form an end-to-end In the end-to-end network, there are no centralized equipment and management agencies. Data exchange between nodes is verified through digital signature technology. There is no need for artificial mutual trust, as long as it is carried out in accordance with established rules. Nodes cannot deceive other nodes. Because the entire network is decentralized, everyone is a participant and everyone has the right to speak.
Secondly, because of the decentralized nature of distributed ledgers, the blockchain network is a distributed one structure, everyone can freely join it and participate in the recording of data. However, at the same time, the troublesome "Byzantine Generals" problem arises, that is, the more people participate in the network, the more the entire network will become. It is difficult to achieve unification, so another mechanism is needed to coordinate the accounts of all nodes to maintain consistency. The consensus mechanism formulates a set of rules to clarify the way for everyone to process data, and completes the opinions between nodes by competing for accounting rights. Unified, whoever obtains the accounting rights in the end will use the data processed by the entire network. Therefore, the consensus mechanism plays a role in coordinating the behavior of nodes in the blockchain and clarifying the role of data processing.
Anyone can participate in the blockchain network. Each device can serve as a node. Each node is allowed to obtain a complete database. There is a consensus mechanism between nodes. Through competition, calculation , jointly maintain the entire blockchain. If any node fails, the remaining nodes can still work normally. It is equivalent to recognizing your game rules. Bitcoin has the consensus mechanism of Bitcoin. If the world recognizes it, you can participate in Bitcoin mining. Because you recognize its consensus mechanism, it can also be understood as recognizing its game rules. The rule of Bitcoin is to perform huge calculations, and whoever calculates it first will be rewarded with POW.
Note: What are the advantages and disadvantages of the consensus mechanism compared with PoW, PoS, and DPoS?
PoW is proof of work. This is a very clever method. Its advantages are :
The algorithm is simple and easy to implement;
No need to exchange additional information to reach a consensus;
Destroying the system requires a huge cost;
Its shortcomings are also very obvious:
Wasted energy;
The confirmation time of the block is difficult to shorten;
The new blockchain must find a different hashing algorithm, otherwise it will face Bit Coin’s computing power attack;
is prone to forks and needs to wait for multiple confirmations;
is never final and requires a checkpoint mechanism To make up for finality
PoS is proof of equity, which changes the computing power in PoW into system equity. The greater the equity you have, the greater the probability of becoming the next bookkeeper. The advantage of this mechanism is that it does not consume as much electricity as Pow, but it also has many disadvantages:
It is not professional, and participants with rights and interests may not want to participate in accounting;
It is easy to produce forks and needs to wait for multiple confirmations;
There is never finality and a checkpoint mechanism is needed to make up for finality;
Based on PoS, DPoS professionalizes the role of bookkeepers. Bookkeepers are first selected through equity, and then bookkeepers take turns keeping accounts. This approach still does not solve the finality problem.
DBFT (delegated BFT) is a general consensus mechanism module that proposes an improved Byzantine fault-tolerant algorithm, making it applicable to blockchain systems.
DBFT is a protocol based on blockchain technology. Users can digitize assets and rights in the physical world and conduct decentralized network protocols for financial services such as registration, issuance, transfer transactions, clearing and delivery through a peer-to-peer network. Xiaoyi can issue company equity recognized by China's "Contract Law" and "Company Law", not only in the digital currency circle, but also in mainstream Internet finance. Xiaoyi can be used for equity crowdfunding, P2P online lending, digital asset management, smart contracts, etc.
This consensus mechanism is based on the "Practical Byzantine Fault Tolerance" proposed by Castro and Liskov, and has been improved to make it suitable for blockchain systems. Byzantine fault tolerance technology is widely used in distributed systems, such as distributed file systems, distributed collaboration systems, cloud computing, etc. dBFT has mainly made the following improvements:
Improved the request response mode of the C/S architecture into a peer-to-peer node mode suitable for P2P networks;
Improve the static consensus participating nodes into dynamic consensus participating nodes that can dynamically enter and exit;
Designed a set of voting based on the proportion of equity held for the generation of consensus participating nodes Mechanism to decide consensus participating nodes (accounting nodes) through voting;
Introducing digital certificates into the blockchain solves the problem of authenticating the true identity of the accounting nodes in voting
Why did you finally adopt such a solution?
Answer: Blockchain is a distributed ledger system, and its internal economic model determines , each participant does not need to trust other participants, which is called trustless. The Byzantine Generals Problem describes how participants can reach a consensus without trust, and Byzantine Fault Tolerance technology is a solution to such problems. In addition, the network environment of the blockchain is very complex and will face problems such as network delays, transmission errors, software errors, security holes, hacker intrusions, etc., as well as a variety of malicious nodes. Byzantine fault tolerance technology can tolerate these errors. plan.
The dBFT mechanism selects bookkeepers based on equity, and then the bookkeepers reach a consensus through the Byzantine Fault Tolerance algorithm. The advantages of this method are:
Professional bookkeeper;
Can tolerate any type of errors;
Accounting is completed by multiple people, each Blocks are final and will not fork;
The reliability of the algorithm has strict mathematical proof
Disadvantages:
When 1/3 or more of the bookkeepers stop working, the system will not be able to provide services;
When 1/3 or more of the bookkeepers stop working When people join forces to do evil, and all other bookkeepers are divided into two network islands, the malicious bookkeeper can cause the system to fork, but will leave cryptographic evidence;
In summary, the core point of the dBFT mechanism is to ensure the finality of the system to the greatest extent so that the blockchain can be applied to real financial application scenarios. For example, our Columbus consensus mechanism DPOS DBFT consensus mechanism. If one person or device in our entire node is shut down, other nodes will still be working normally and will not affect the entire network system. But if Tencent's server is shut down, then everyone's WeChat cannot be opened, because you have no place to retrieve data. This is the difference between a centralized server and a blockchain server.
In addition, the data enters the distributed database , it is not just a matter of simply packaging it in. The underlying data structure is determined by blockchain cryptography. The packaged data blocks will be processed into a chain structure through the hash function in cryptography. The latter block contains the hash value of the previous block. Because the hash algorithm is one-way and anti-tampering, only in the blockchain network, once the data is uploaded to the chain, it cannot be tampered with and is traceable. In addition, Your account will also be encrypted through asymmetric encryption, thereby ensuring the security of the data and verifying the ownership of the data.
Modifications to a single or multiple databases cannot affect other databases. Unless more than 51% of the entire network's data is modified at the same time, this is highly unlikely to happen. Each transaction in the blockchain is cryptographically connected to two adjacent blocks, so the past and present of any transaction can be traced back. Here is the data structure of the blockchain, block header and block body. Cryptography hash values, timestamps, determine its order through timestamps, and will not disrupt it.
This principle operates in our business system, including the commodity system. What we call traceability allows us to find out where the goods are produced and what the raw materials are. We can find it step by step from back to front, because we are doing it every step of the way. When taking an action, the information data is written into the blockchain system. Through this system, I can find out whether the raw material is used and whether it is produced using this process. Through such a data structure storage, we can jointly believe that this product is indeed produced in this way, and believe that this is true.
In addition, the data cannot be modified. If you want to modify it, only 51% of the data can be modified. From the equity perspective, those who own 51% of the company's equity have the right to speak in the company. This is just a possibility. Why is blockchain technology more effective and safer than Internet technology? Because it is distributed. If you want to modify the data inside, as a hacker, you need to find all the computers that record this account, and each computer must modify it. , maybe you can quickly find one of them and change it, but it is difficult to change all of them.
All transaction information in the blockchain is public, so every transaction is visible to all nodes. Since nodes are decentralized, there is no need to disclose identities between nodes. Nodes are anonymous. For example, after each computing machine is started, we do not know who has started and who has not started each computing machine. You can turn it on at your home. There is a problem of more work and more gain.
Finally, application-level smart contracts can be built on the basis of distributed ledgers. When we want to solve some trust issues, we can use smart contracts to formulate agreements between users in the form of code, clearly list the conditions, and execute them through programs, and the data in the blockchain can be called through smart contracts. , so the Zhitong contract plays the role of data execution and application in the blockchain.
Smart contracts can help you exchange money, property, shares or anything of value in a transparent and conflict-free way while avoiding the services of middlemen. It is even said that smart contracts will replace the position of lawyers in the future. Through smart contract means, the asset or currency is transferred to the program, the program runs this code and at a certain point in time it automatically verifies a condition, it automatically determines whether the asset should go to one person or back to another person, or should it immediately Return to the person who sent it or a combination thereof. (Automatic enforcement, no guarantee of failure) At the same time, the decentralized ledger also stores and copies files, giving it a certain degree of security and immutability.
Features of Smart Contracts
Autonomy - eliminates middlemen and third parties, you are the one who makes the agreement; there is no need to rely on a broker, Lawyer or other intermediary to confirm. Incidentally, this also eliminates the danger of third-party manipulation, since execution is managed automatically by the network rather than by one or more potentially biased individuals who may make mistakes.
Trust - Your files are encrypted on a shared ledger. Someone can't say they lost it.
Backup – Imagine if your bank lost your savings account. On the blockchain, every one of your friends has your back. Your document has been duplicated multiple times.
Security - cryptography, website encryption, keep your files safe. No hacking. In fact, it takes a very smart hacker to crack the code and penetrate.
Speed – You often have to spend a lot of time and paperwork processing documents manually. Smart contracts use software code to automate tasks, reducing the time for a range of business processes.
Savings Cost Savings – Smart contracts can save you money because they eliminate the middleman. For example, you must pay a notary to witness your transaction.
Accuracy – Automated contracts are not only faster and cheaper, but they also eliminate the errors associated with filling out forms manually.
The best way to describe smart contracts is to compare the technology to a vending machine. Typically, you go to a lawyer or a notary, pay them, and wait for you to get the documents. With a smart contract, you just put a Bitcoin into a vending machine (like a ledger) and put your escrow, driver's license or whatever into your account. What’s more, smart contracts not only define the rules and penalties of the agreement in the same way as traditional contracts, but also automatically enforce these obligations.
Smart Contracts and Blockchain
The best thing about blockchain is that because it is a decentralized system that exists among all allowed parties time, so no need to pay a middleman (middleman), it saves you time and conflicts. There are problems with blockchains, but they are rated, undeniably, faster, cheaper, and more secure than traditional systems, which is why banks and governments are turning to them. Using the characteristics of blockchain technology and applying it to smart contracts will make it easier to improve various contracts in work and life.
For more related knowledge, please visit the FAQ column!
The above is the detailed content of What are the four core technologies of blockchain?. For more information, please follow other related articles on the PHP Chinese website!