1 thought on “animal print jewelry wholesale Blockchain --- Consensus algorithm”
Lonnie
countertop jewelry displays wholesale The POW algorithm is a mechanism to prevent distributed service resources from being abused and refused to service attacks. It requires the node to perform an appropriate time consumption and the complex operation of resources, and its computing results can be quickly calculated by other nodes to ensure the use of time and energy to ensure that services and resources are used by real needs. The most basic technical principles in the POW algorithm is to use the hash algorithm. Suppose that the hash (R) is found, and if the original data is R (raw), the calculation result is R (Result). r = hash (r) This the characteristics of the hash function hash () are that for any input value R, the result R is obtained, and it cannot be pushed back from R. When the input raw data r changes to 1 Bit, the result R value is completely changed. In the POW algorithm of Bitcoin, the difficulty of the introduction of algorithms D and random value N to get the following formulas: Rd = have (R N) The previous D bytes of the calculation result RD must be 0. Because the hash function results are unknown, each miner must do a lot of operations before they can get the correct results. After calculating the result broadcast to the entire network, other nodes only need to perform hash operations once to check. The POW algorithm is to use this method to calculate the consumption resources, and the verification is only once.
POS algorithm requires that node verifications must pledge certain funds to be qualified for mining packaging, and the regional chain system uses random methods when selecting packaging nodes. The greater the probability of being selected for the packing block. In POS mode, each currency generates 1 currency every day. For example, you hold 100 dollars and hold a total of 30 days. Then, at this time, your currency age is 3,000. At this time, if you verify a POS block, your currency age will be cleared to 0, and at the same time, the corresponding digital currency interest will be obtained from the block. The process of nodes out of the POS algorithm is as follows: ordinary nodes must be pledged by the node of the outlet, first of all, when the block is out, packing the block, and then broadcasting to the entire network, other verifications, other verifications The node will verify the legitimacy of the block.
The DPOS algorithm is similar to the POS algorithm, and also pledges with shares and equity. But the difference is that the DPOS algorithm uses the method of entrusted pledge, similar to selecting N super nodes to book account blocks in the way of national elections. The voters vote their own votes to a node. If a node is elected as a bookkeeping node, the bookkeeper node can often use any way to return their own voters after obtaining the outlet reward. This node will take turns out of the block and supervise each other between nodes. If they do evil, they will be deducted. It trust a small amount of integrity nodes, you can remove unnecessary steps during the signature process and improve the speed of transaction.
Byzantine Question: Byzantine is the capital of the ancient East Roman Empire. In order to defend each sealing land, a army led by a single general. Essence During the war, all generals must reach a consensus to decide whether to start war together. , there may be traitors in the army, and these people will affect the generals to reach a consensus. The issue of General Byzantine refers to how the remaining generals reached a consistent decision -making question when the general known that the general was a traitor. BFT: BFT is Byzantine fault tolerance. Byzantine error -tolerant technology is a type of fault -tolerant technology in a type of distributed computing. Byzantine assumes that it is a model of the real world. Due to hardware errors, network congestion or interruption, and malicious attacks, computers and networks may have unpredictable behaviors. Byzantine error -tolerant technology is designed to handle these abnormal behaviors and meet the requirements for the problem to solve. Byzantine error system: This nodes that occur are called Byzantine nodes, and normal nodes are non -Byzantine nodes. I assume that the distributed system has n nodes, and assume that the entire system Byzantine node does not exceed M (n ≥ 3m 1), the Byzantine error system needs to meet the following two conditions: , in addition, the Byzanting error system tolerance system The following two indicators need to be reached: PBFT is the practical Byzantine lying algorithm, which solves the problem of the primitive Byzantine 错 algorithm. Solving the problem of Byzantine's fault
PBFT is a state machine copy copy algorithm. All copies are operated during the rotation of a view (View). : Master Node P = V MOD | R |. V: View Number, | R | Nodes, P: Master Node Number. The consensus process of the PBFT algorithm is as follows: Client initiates a request (request), and broadcasts to each copy node, which is initiated by one of the master nodes. And broadcast. Other nodes get the original news and send Prepare messages after the passage is completed. Each node receives 2F 1 Prepare message, that is, it is considered to be prepared and sending the Commit message. When the node receives a 2F 1 Commit message and the client receives the F 1 of the same repy message, it means that the client's request initiated the entire network has reached the entire network consensus. The specific process is as follows: Ter client C sends a u003Crequest, O, T, C> request to the master node P. O: Specific operation of request, T: Time stamp of client additions when request, C: client logo. Request: Contains message content M, and message summary d (m). The client signed the request. The main node receives the client's request and needs to be performed: a. Whether the client request message signature is correct. illegal requests discard. Correct request, allocate a number n, the number n is mainly used to sort the client's request. Then broadcast a message u003Cu003C Pre-Prepare, V, N, D>, M> to other copies nodes. V: View Number, D Client message summary, M message content. u003CPre-Prepare, V, N, D> The signature of the master node. n is [h, h] in a certain range. For the specific reasons, see the garbage recycling chapter. This node node I received the pre-PREPARE message from the main node, which needs to be performed: a. Master node pre-prepare message signature correctly. b. Whether the current copy node has received a piece of Pre-Prepare information with different signatures under the same V and the number is also received. c. D and M are the same. d. N is in the interval [h, h]. illegal requests discard. Correct request, copy node I sends a u003Cprepare, v, n, d, i> messages to other nodes, including the master node, v, n, d, and m the same content as the pre-prepare message, i is the current copy node number. u003Cprepare, v, n, d, i> The signature of the copy node I. Record pre-PREPARE and Prepare messages to LOG, and restore unfinished request operations during the View Change process. The master nodes and copy nodes receive prepare messages, and the following is required: a. Copy node prepare message signature correctly. b. Whether the current copy node has received n N under the same view V. c. N whether it is in the interval [h, h]. d. D. Whether D is the same as D. illegal requests are discarded as D. D. D. If the copy node I receives 2F 1 verified Prepare message, send a u003CCommit, V, N, D, i> messages to other nodes, including the master nodes, v, n, d, and the above prepare messages. same. u003CCommit, v, n, d, i> The signature of the copy node I. Record the Commit message to the log, and restore unfinished request operations during the View Change process. Record the Prepare message sent by other copy nodes to log. The main node and copy node receives the Commit message, and the following is required: a. Copy node COMMIT message signature is correct. b. Whether the current copy node has received n N under the same view V. c. D and M are the same. d. N is in the interval [h, h]. illegal requests discard. If the copy node I receives the COMMIT message passed by 2F 1 verification, indicating that most of the nodes in the current network have reached a consensus, operating the client's request operation O, and returned to u003CReply, V, T, C, I, R> Give the client, R: The result of the request operation. If the client receives the F 1 of the same reply message, it means that the client's request initiated the entire network has reached the entire network consensus, otherwise the client needs to determine whether to send the request to the master node. Record the Commit message sent by other copy nodes to LOG.
If the master node is evil, it may make the same serial number on different requests, or to allocate serial numbers, or make adjacent serial numbers discontinuous. Backup nodes should have responsibilities to actively check the legitimacy of these serial numbers. If off the main node or the request of the wicked client, the client sets the timeout mechanism, and the timeout will request a message to all copy nodes. The copy node detects the main node for evil or offline, and initiates the View Change protocol. View Change protocol: This nodes broadcast u003CView-Change, V 1, N, C, P, I> Message to other nodes. N is the latest STable number, C is a 2F 1 verified message collection, and P is the Pre-Prepare and Prepare message collection of the current copy node that is not completed. Is when the main node P = V 1 MOD | R | After receiving 2F valid View-Change messages, broadcast u003Cnew-video, v 1, v, o> messages to other nodes. V is a valid View-Change message collection. O is the unprecedented Pre-Prepare message collection sponsored by the master node. Selected rules for Pre-Prepare Message Collection: This node received the New-View message from the master node, verifying effectiveness, valid, enter the V 1 state, and start the Pre-Prepare message processing process in O.
In the above algorithm process, in order to ensure that during the View Change process, the previous request can be restored, each copy node records some messages to the local log. When the request request node needs to be Clear the recorded message of the request before. The easiest way is to perform consensus synchronization of the current state after the reply message. The cost of doing this is relatively high, so you can perform multiple requests K (for example: 100). Essence This state synchronization message is the message. The copy node I send u003C, n, d, i> to other nodes. N is the last view request number retained by the current node. D is a summary of the current state, which records the message to the log. If the copy node I receives a message that has been verified by 2F 1, it will remove the news in the previous log and use N as the current Stable. This is an ideal situation. In fact, after the copy node I sent a message to other nodes, the other nodes have not completed the K request, so it will not respond to I immediately. Moving forward, but not formed at this time. In order to prevent the processing request of i from too fast, set up a high and low water level interval mentioned above to solve this problem. Lowwater level H is equal to the number of the previous STable, and the high water level H = H L. Among them, L is the value we specified, which is equivalent to the integer multiple of the period of request K. It can be set to L = 2K. When the copy I processing requests exceed the high water level H, they will stop at this time, wait for the stable to change, and then continue to move forward.
In the blockchain scenario, it is generally suitable for private chains and alliance chain scenes that require strong consistency. For example, PBFT is an optional consensus agreement in the IBM -led blockchain super ledger project. In the Fabric project, the consensus module is designed as insertable modules and supports consensus algorithms such as PBFT and RAFT.
RAFT is based on the leader -driven consensus model, which will elected an outstanding leader (Leader), and the leader will be fully responsible for the management cluster. Copy logs between nodes.
In the figure below, the leader (S1) of the cluster will be selected during the startup process, and services/requests from all commands/requests from the client will be provided. All nodes in the RAFT cluster maintain a distributed log (copy log) to store and submit commands (log entries) issued by the client. Leader accepts the log entries from the client and copy them between all followers (S2, S3, S4, S5) in the RAFT cluster. In the RAFT cluster, the minimum number of nodes need to be satisfied to provide the expected level consensus guarantee, which is also called the legal number. The minimum number of votes required to perform operations in the Raft cluster is (n / 2 1), of which n is the total number of members in the group, that is, at least half of the voting, which is why the cluster node is usually strange. Therefore, in the above example, we need at least 3 nodes to ensure consensus guarantee. If the legal arbitration node is unavailable for any reason, that is, there are no more than half voting, then the negotiation is not reached and the new log cannot be submitted.
The data storage: TIDB/TIKV Log: Dledger of Alibaba found: Consul
countertop jewelry displays wholesale The POW algorithm is a mechanism to prevent distributed service resources from being abused and refused to service attacks. It requires the node to perform an appropriate time consumption and the complex operation of resources, and its computing results can be quickly calculated by other nodes to ensure the use of time and energy to ensure that services and resources are used by real needs.
The most basic technical principles in the POW algorithm is to use the hash algorithm. Suppose that the hash (R) is found, and if the original data is R (raw), the calculation result is R (Result).
r = hash (r)
This the characteristics of the hash function hash () are that for any input value R, the result R is obtained, and it cannot be pushed back from R. When the input raw data r changes to 1 Bit, the result R value is completely changed. In the POW algorithm of Bitcoin, the difficulty of the introduction of algorithms D and random value N to get the following formulas:
Rd = have (R N)
The previous D bytes of the calculation result RD must be 0. Because the hash function results are unknown, each miner must do a lot of operations before they can get the correct results. After calculating the result broadcast to the entire network, other nodes only need to perform hash operations once to check. The POW algorithm is to use this method to calculate the consumption resources, and the verification is only once.
POS algorithm requires that node verifications must pledge certain funds to be qualified for mining packaging, and the regional chain system uses random methods when selecting packaging nodes. The greater the probability of being selected for the packing block.
In POS mode, each currency generates 1 currency every day. For example, you hold 100 dollars and hold a total of 30 days. Then, at this time, your currency age is 3,000. At this time, if you verify a POS block, your currency age will be cleared to 0, and at the same time, the corresponding digital currency interest will be obtained from the block.
The process of nodes out of the POS algorithm is as follows: ordinary nodes must be pledged by the node of the outlet, first of all, when the block is out, packing the block, and then broadcasting to the entire network, other verifications, other verifications The node will verify the legitimacy of the block.
The DPOS algorithm is similar to the POS algorithm, and also pledges with shares and equity.
But the difference is that the DPOS algorithm uses the method of entrusted pledge, similar to selecting N super nodes to book account blocks in the way of national elections.
The voters vote their own votes to a node. If a node is elected as a bookkeeping node, the bookkeeper node can often use any way to return their own voters after obtaining the outlet reward.
This node will take turns out of the block and supervise each other between nodes. If they do evil, they will be deducted.
It trust a small amount of integrity nodes, you can remove unnecessary steps during the signature process and improve the speed of transaction.
Byzantine Question:
Byzantine is the capital of the ancient East Roman Empire. In order to defend each sealing land, a army led by a single general. Essence During the war, all generals must reach a consensus to decide whether to start war together.
, there may be traitors in the army, and these people will affect the generals to reach a consensus. The issue of General Byzantine refers to how the remaining generals reached a consistent decision -making question when the general known that the general was a traitor.
BFT:
BFT is Byzantine fault tolerance. Byzantine error -tolerant technology is a type of fault -tolerant technology in a type of distributed computing. Byzantine assumes that it is a model of the real world. Due to hardware errors, network congestion or interruption, and malicious attacks, computers and networks may have unpredictable behaviors. Byzantine error -tolerant technology is designed to handle these abnormal behaviors and meet the requirements for the problem to solve.
Byzantine error system:
This nodes that occur are called Byzantine nodes, and normal nodes are non -Byzantine nodes.
I assume that the distributed system has n nodes, and assume that the entire system Byzantine node does not exceed M (n ≥ 3m 1), the Byzantine error system needs to meet the following two conditions:
, in addition, the Byzanting error system tolerance system The following two indicators need to be reached:
PBFT is the practical Byzantine lying algorithm, which solves the problem of the primitive Byzantine 错 algorithm. Solving the problem of Byzantine's fault
PBFT is a state machine copy copy algorithm. All copies are operated during the rotation of a view (View). : Master Node P = V MOD | R |. V: View Number, | R | Nodes, P: Master Node Number.
The consensus process of the PBFT algorithm is as follows: Client initiates a request (request), and broadcasts to each copy node, which is initiated by one of the master nodes. And broadcast. Other nodes get the original news and send Prepare messages after the passage is completed. Each node receives 2F 1 Prepare message, that is, it is considered to be prepared and sending the Commit message. When the node receives a 2F 1 Commit message and the client receives the F 1 of the same repy message, it means that the client's request initiated the entire network has reached the entire network consensus.
The specific process is as follows:
Ter client C sends a u003Crequest, O, T, C> request to the master node P. O: Specific operation of request, T: Time stamp of client additions when request, C: client logo. Request: Contains message content M, and message summary d (m). The client signed the request.
The main node receives the client's request and needs to be performed:
a. Whether the client request message signature is correct.
illegal requests discard. Correct request, allocate a number n, the number n is mainly used to sort the client's request. Then broadcast a message u003Cu003C Pre-Prepare, V, N, D>, M> to other copies nodes. V: View Number, D Client message summary, M message content. u003CPre-Prepare, V, N, D> The signature of the master node. n is [h, h] in a certain range. For the specific reasons, see the garbage recycling chapter.
This node node I received the pre-PREPARE message from the main node, which needs to be performed:
a. Master node pre-prepare message signature correctly.
b. Whether the current copy node has received a piece of Pre-Prepare information with different signatures under the same V and the number is also received.
c. D and M are the same.
d. N is in the interval [h, h].
illegal requests discard. Correct request, copy node I sends a u003Cprepare, v, n, d, i> messages to other nodes, including the master node, v, n, d, and m the same content as the pre-prepare message, i is the current copy node number. u003Cprepare, v, n, d, i> The signature of the copy node I. Record pre-PREPARE and Prepare messages to LOG, and restore unfinished request operations during the View Change process.
The master nodes and copy nodes receive prepare messages, and the following is required:
a. Copy node prepare message signature correctly.
b. Whether the current copy node has received n N under the same view V.
c. N whether it is in the interval [h, h].
d. D. Whether D is the same as D. illegal requests are discarded as D. D. D. If the copy node I receives 2F 1 verified Prepare message, send a u003CCommit, V, N, D, i> messages to other nodes, including the master nodes, v, n, d, and the above prepare messages. same. u003CCommit, v, n, d, i> The signature of the copy node I. Record the Commit message to the log, and restore unfinished request operations during the View Change process. Record the Prepare message sent by other copy nodes to log.
The main node and copy node receives the Commit message, and the following is required:
a. Copy node COMMIT message signature is correct.
b. Whether the current copy node has received n N under the same view V.
c. D and M are the same.
d. N is in the interval [h, h].
illegal requests discard. If the copy node I receives the COMMIT message passed by 2F 1 verification, indicating that most of the nodes in the current network have reached a consensus, operating the client's request operation O, and returned to u003CReply, V, T, C, I, R> Give the client, R: The result of the request operation. If the client receives the F 1 of the same reply message, it means that the client's request initiated the entire network has reached the entire network consensus, otherwise the client needs to determine whether to send the request to the master node. Record the Commit message sent by other copy nodes to LOG.
If the master node is evil, it may make the same serial number on different requests, or to allocate serial numbers, or make adjacent serial numbers discontinuous. Backup nodes should have responsibilities to actively check the legitimacy of these serial numbers.
If off the main node or the request of the wicked client, the client sets the timeout mechanism, and the timeout will request a message to all copy nodes. The copy node detects the main node for evil or offline, and initiates the View Change protocol.
View Change protocol:
This nodes broadcast u003CView-Change, V 1, N, C, P, I> Message to other nodes. N is the latest STable number, C is a 2F 1 verified message collection, and P is the Pre-Prepare and Prepare message collection of the current copy node that is not completed.
Is when the main node P = V 1 MOD | R | After receiving 2F valid View-Change messages, broadcast u003Cnew-video, v 1, v, o> messages to other nodes. V is a valid View-Change message collection. O is the unprecedented Pre-Prepare message collection sponsored by the master node. Selected rules for Pre-Prepare Message Collection:
This node received the New-View message from the master node, verifying effectiveness, valid, enter the V 1 state, and start the Pre-Prepare message processing process in O.
In the above algorithm process, in order to ensure that during the View Change process, the previous request can be restored, each copy node records some messages to the local log. When the request request node needs to be Clear the recorded message of the request before.
The easiest way is to perform consensus synchronization of the current state after the reply message. The cost of doing this is relatively high, so you can perform multiple requests K (for example: 100). Essence This state synchronization message is the message.
The copy node I send u003C, n, d, i> to other nodes. N is the last view request number retained by the current node. D is a summary of the current state, which records the message to the log. If the copy node I receives a message that has been verified by 2F 1, it will remove the news in the previous log and use N as the current Stable.
This is an ideal situation. In fact, after the copy node I sent a message to other nodes, the other nodes have not completed the K request, so it will not respond to I immediately. Moving forward, but not formed at this time.
In order to prevent the processing request of i from too fast, set up a high and low water level interval mentioned above to solve this problem. Lowwater level H is equal to the number of the previous STable, and the high water level H = H L. Among them, L is the value we specified, which is equivalent to the integer multiple of the period of request K. It can be set to L = 2K. When the copy I processing requests exceed the high water level H, they will stop at this time, wait for the stable to change, and then continue to move forward.
In the blockchain scenario, it is generally suitable for private chains and alliance chain scenes that require strong consistency. For example, PBFT is an optional consensus agreement in the IBM -led blockchain super ledger project. In the Fabric project, the consensus module is designed as insertable modules and supports consensus algorithms such as PBFT and RAFT.
RAFT is based on the leader -driven consensus model, which will elected an outstanding leader (Leader), and the leader will be fully responsible for the management cluster. Copy logs between nodes.
In the figure below, the leader (S1) of the cluster will be selected during the startup process, and services/requests from all commands/requests from the client will be provided. All nodes in the RAFT cluster maintain a distributed log (copy log) to store and submit commands (log entries) issued by the client. Leader accepts the log entries from the client and copy them between all followers (S2, S3, S4, S5) in the RAFT cluster.
In the RAFT cluster, the minimum number of nodes need to be satisfied to provide the expected level consensus guarantee, which is also called the legal number. The minimum number of votes required to perform operations in the Raft cluster is (n / 2 1), of which n is the total number of members in the group, that is, at least half of the voting, which is why the cluster node is usually strange. Therefore, in the above example, we need at least 3 nodes to ensure consensus guarantee.
If the legal arbitration node is unavailable for any reason, that is, there are no more than half voting, then the negotiation is not reached and the new log cannot be submitted.
The data storage: TIDB/TIKV
Log: Dledger
of Alibaba found: Consul