Traditional Culture Encyclopedia - Traditional stories - What is blockchain technology? Introduction to Core Technologies of Blockchain
What is blockchain technology? Introduction to Core Technologies of Blockchain
What is the core technology of blockchain?
Blockchain technology can be an open account book (anyone can see it) or an authorized network (only authorized people can see it), which solves the challenge of supply chain because it is an unchangeable record, shared among network participants and updated in real time.
Blockchain technology-data layer: design the data structure of the account book.
Core technology 1, block+chain:
Technically, a block is a data structure that records transactions and reflects the flow of transaction funds. The transaction blocks that have arrived in the system are connected together to form the main chain, and all nodes participating in the calculation record the main chain or a part of the main chain.
Each block consists of a block header and a block, and the block is only responsible for recording all the transaction information of a previous period, mainly including the transaction quantity and transaction details; The block header encapsulates the current version number, the address of the previous block, the time stamp (recording the time when the block was generated, accurate to the second), the random number (recording the value of the relevant math problem answer of the block), the target hash value of the current block, the root value of Merkle number and other information. Structurally, most functions of the blockchain are realized by the blockchain header.
Core technology II. Hash function:
Hash function can convert data of any length into a set of fixed-length codes through hash algorithm. Its principle is based on an encrypted one-way hash function, which is easy to verify, but difficult to crack. Usually, the industry uses the way of y=hash(x), and this hash function can calculate a hash value y by operating on x.
Commonly used hash algorithms are MD5, SHA- 1, SHA-256, SHA-384 and SHA-5 12. Take SHA256 algorithm as an example. If any string of data is input into SHA256, a 256-bit hash value will be obtained. Its characteristics: the same data input will get the same result. As long as the input data changes slightly (for example, a 1 changes to 0), it will get completely different results, which cannot be predicted in advance. Forward calculation (calculating its corresponding hash value from data) is very easy. Reverse calculation (cracking) is extremely difficult and is considered impossible under the current scientific and technological conditions.
Core technology 3, Merkle tree:
Merkle tree is a hash binary tree, which can be used to quickly verify the integrity of large-scale data. In the blockchain network, Merkle tree is used to summarize all transaction information in a block and finally generate a unified hash value of all transaction information in the block. Any change in the transaction information in the block will change the Merkle tree.
Core technology 4. Asymmetric encryption algorithm:
Asymmetric encryption algorithm is a key method, which requires two keys: public key and private key. The public key and the private key are a pair. If the data is encrypted with the public key, it can only be decrypted with the corresponding private key, thus obtaining the corresponding data value. If the data is signed with a private key, then the signature can only be verified with the corresponding public key, and the sender of the verification information is the holder of the private key.
Because encryption and decryption use two different keys, this algorithm is called asymmetric encryption algorithm, while symmetric encryption uses the same key during encryption and decryption.
Blockchain technology-network layer: realize the decentralization of accounting nodes.
Core technology 5. P2P network:
Peer-to-peer network, also known as peer-to-peer technology, is an Internet system that has no central server and relies on user groups for information exchange. Unlike a central network system with a central server, each client of a peer-to-peer network is both a node and a server. P2P technology is adopted in domestic Thunder software. P2P network has the characteristics of decentralization and robustness.
Blockchain technology-* * * knowledge layer: distributing the task load of accounting nodes.
Core technology 6, * * * knowledge mechanism:
* * * knowledge mechanism is how to realize * * knowledge among all accounting nodes to identify the validity of a record, which is not only a means of identification, but also a means of preventing tampering. At present, there are four knowledge mechanisms: PoW, PoS, DPoS and distributed consistency algorithm.
Pow (proof work): Pow mechanism, that is, mining mechanism similar to Bitcoin. Miners package the existing unrecorded transactions in the network into a block, and then constantly traverse to try to find a random number, so that the hash value of the new block plus the random number meets certain difficulty conditions. Finding a random number that meets the conditions is equivalent to determining the latest block of the blockchain, and it is also equivalent to obtaining the current round of bookkeeping rights of the blockchain. Miners broadcast the blocks that meet the mining difficulty conditions in the network. After verifying that the blocks meet the mining difficulty conditions and the transaction data in the blocks meet the protocol specifications, other nodes in the whole network will link the blocks to their own version of the blockchain, thus forming the * * * knowledge of the current network state of the whole network.
PoS(prooffstake):PoS mechanism, which requires nodes to provide a certain number of tokens to obtain the bookkeeping right of competitive blockchain. If the bookkeeper is determined solely by the token balance, the rich will win, which will lead to the centralization of bookkeeping rights and reduce the fairness of knowledge. Therefore, different PoS mechanisms adopt different ways to increase the randomness of bookkeeping rights on the basis of proof of rights and interests to avoid centralization. For example, in PeerCoin)PoS mechanism, the bitcoin with the longest chain age is more likely to account correctly. NXT and Black Coin use a formula to predict the next accounting node. The probability that more tokens are selected as accounting nodes will be greater. In the future, Ethereum will also switch from the current PoW mechanism to the PoS mechanism. According to the information we have seen so far, the PoS mechanism of Ethereum will use nodes to bet on the next block, gamblers will get extra ethereal bonuses, and losers will be deducted ethereal coins to realize the next block.
DPOS (Delegated Proof-of-Stake): DPOS is easy to understand, similar to the modern enterprise board system. The DPoS mechanism adopted by Bitshares is that shareholders elect a certain number of witnesses, and each witness has two seconds' permission time to generate blocks in turn. If the witness server cannot generate blocks in a given time slice, the authority to generate blocks will be granted to the corresponding witness server in the next time slice. Shareholders can change these witnesses at any time by voting. This design of DPoS makes block generation faster and more energy-saving.
Distributed consistency algorithm: Distributed consistency algorithm is based on traditional distributed consistency technology. Among them, there are Byzantine fault-tolerant algorithms to solve the problem of Byzantine generals, such as PBFT (Byzantine fault-tolerant algorithm). In addition, the distributed consistency algorithm (Pasox, Raft) for solving non-Byzantine problems is not explained in detail in this paper. At present, this kind of algorithm is a common knowledge mechanism in alliance chain and private chain scenarios.
Generally speaking, POW is suitable for public chain. If a private chain is built, POS is more suitable, because there is no trust problem of verification nodes. However, due to the existence of untrusted local nodes in the alliance chain, DPOS is more suitable.
Blockchain technology-incentive layer: formulating the "salary system" of accounting nodes.
Core technology 7. Distribution mechanism and incentive mechanism:
Take bitcoin as an example. Bitcoin was originally rewarded by the system to miners who created new blocks, and the reward was halved about every four years. At the beginning, every time a new block is recorded, miners will be rewarded with 50 bitcoins, and the reward will be halved every four years. By analogy, by about 2 140 AD, the newly created blocks will not be rewarded by the system. By then, the total number of bitcoins will be about 2 1 10,000, which is the total number of bitcoins and will not increase indefinitely.
Another source of incentives is transaction fees. When the newly created block has no system reward, the income of miners will change from system reward to transaction fee. For example, you can specify 1% as the handling fee paid to the miners in the record block when transferring money. If the output value of a transaction is less than the input value, then the difference is the transaction fee, which will be added to the incentive of the block. As long as a given amount of electronic money has entered the circulation, the incentive mechanism can be gradually transformed into relying entirely on transaction fees, so there is no need to issue new money.
Blockchain technology-contract layer: giving the account book programmable characteristics.
Core technology 8, smart contract:
Smart contract is a set of procedural rules and logic of situational response, which is realized by decentralized trusted script code deployed in blockchain. Usually, after the smart contract is signed by all parties, it is attached to the blockchain data in the form of program code, and recorded in a specific block of the blockchain after P2P network propagation and node verification. Smart contracts encapsulate predefined states and transition rules, scenarios that trigger contract execution, and response operations in specific scenarios. Blockchain can monitor the status of smart contracts in real time, and activate and execute contracts by checking external data sources and confirming that specific trigger conditions are met.
The above is the blockchain technology brought to you by Bian Xiao. Introduce all the contents of the core technology of blockchain.
- Previous article:Which district in Shantou has the best economy?
- Next article:What are the traditional customs of Linxian?
- Related articles
- How to Teach Digital Teaching
- Jade Vegetable Steak and Shark's Fin is a dish of which place (Explore the regional characteristics and cultural background of traditional Chinese dishes)
- Why are the robots in the small face of the knife so popular?
- The seven-year itch - how accountants can break through the work bottleneck? (I)
- Excuse me, who knows the brewing process of rum
- Scientific Research Culture of Shanghai Museum
- Office desk and chair picture appreciation office desk and chair picture introduction
- What is the meaning of hierarchy in architecture?
- In traditional Chinese medicine
- Civil engineering-an important cornerstone of building a future city!