CN113438327B - Consensus algorithm implementation method based on block chain - Google Patents

Consensus algorithm implementation method based on block chain Download PDF

Info

Publication number
CN113438327B
CN113438327B CN202110999868.7A CN202110999868A CN113438327B CN 113438327 B CN113438327 B CN 113438327B CN 202110999868 A CN202110999868 A CN 202110999868A CN 113438327 B CN113438327 B CN 113438327B
Authority
CN
China
Prior art keywords
node
range
confidence
trust
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110999868.7A
Other languages
Chinese (zh)
Other versions
CN113438327A (en
Inventor
路博
宋志明
戚惠敏
杨成林
白建武
严彪
吴金彪
唐迎旭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan Sanxiang Bank Co Ltd
Original Assignee
Hunan Sanxiang Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan Sanxiang Bank Co Ltd filed Critical Hunan Sanxiang Bank Co Ltd
Priority to CN202110999868.7A priority Critical patent/CN113438327B/en
Publication of CN113438327A publication Critical patent/CN113438327A/en
Application granted granted Critical
Publication of CN113438327B publication Critical patent/CN113438327B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Testing And Monitoring For Control Systems (AREA)

Abstract

The invention relates to a block chain-based consensus algorithm implementation method, and relates to the technical field of data processing. The block chain and the consensus algorithm are combined, so that the distributed cluster system has the characteristics of the block chain when processing data, the error rate of the consensus algorithm is reduced, when each node stores data, the consistency of the data stored by each node is checked while the data is shared, and a trust mechanism is established for each node. And setting node response time length on the block chain, and selecting a corresponding punishment mechanism to carry out trust degree reduction punishment on the node when the node does not respond or the response time length is longer, so that the data error rate is reduced, and the safety and reliability of the consensus algorithm are further improved.

Description

Consensus algorithm implementation method based on block chain
Technical Field
The invention relates to the technical field of data processing, in particular to a block chain-based consensus algorithm implementation method.
Background
The block chain is used as a distributed shared account book and a database on the practical application level, and has the characteristics of decentralization, no tampering, whole-course trace retention, traceability, collective maintenance, public transparency and the like, so that the data consistency during data sharing among all blocks is ensured, the application scenes with rich block chains basically solve the problem of information asymmetry based on the block chain, and the cooperative trust and the consistent action among a plurality of main bodies are realized, so that the block chain is applied to a plurality of fields.
The most important problem of the consensus algorithm in the distributed cluster system is the data consistency of each node in the cluster system, and the reason is that after data is disclosed to all nodes, the data consistency is difficult to guarantee when a certain node or a plurality of nodes are illegally tampered, and on the other hand, communication of a node support is unreliable, so that delay and blocking in data transmission are caused, and data inconsistency is caused by errors or node downtime in processing of the nodes, so that the data error rate is further high, the data processing performance is low, and the data consistency is not safe and reliable enough.
Disclosure of Invention
Therefore, the invention provides a block chain-based consensus algorithm implementation method, which is used for solving the problems of data inconsistency caused by high error rate and easy data tampering of a data processing system based on a consensus algorithm in the prior art.
In order to achieve the above object, the present invention provides a block chain-based consensus algorithm implementation method, which includes:
step S1, writing the data to be stored into the blockchain and checking the data written into each node on the blockchain when the data writing is completed so as to ensure that each node stores the data to be stored and the input data of each node is consistent with the data to be stored;
step S2, establishing an initial trust Q0 for each node on the block chain, and taking the initial trust as the unique identification of the block;
step S3, establishing timing spot check frequency on the block chain and/or spot check the block when updating data;
in step S3, a preset spot check proportion B0 is set on the blockchain, and when a spot check is performed on a node on the blockchain, randomly selecting nodes on the block chain according to a preset spot check proportion B0 to carry out spot check and comparing the data consistency of all the nodes, wherein the data of all the nodes are consistent, ending the spot check, if at least one node data is inconsistent, obtaining the past spot check record of the node, and calls the actual trust level Q of the node, if the actual trust level Q of the node is lower than the initial trust level Q0, selecting a corresponding trust degree regulating coefficient according to the actual trust degree range of the actual trust degree Q of the node to punish the node, when the actual confidence level Q of the node is lower than the initial confidence level Q0, the blockchain extracts the data amount U of the inconsistent data of the node, selecting a corresponding trust degree adjusting coefficient according to the inconsistent data quantity U to punish the node;
in step S3, when performing spot check on each node, the block chain further performs a corresponding trust level reduction penalty on the checked node according to whether the checked node responds and the response duration t, acquires the actual trust level Q of the node when the checked node does not respond or the response duration t exceeds the preset response duration t0, compares the actual response duration t of the node with the preset response duration t0, selects a corresponding trust level range correction coefficient according to the comparison result to correct the preset trust level range, and selects a trust level adjustment coefficient in the trust level adjustment coefficient range corresponding to the corrected preset trust level range to perform a trust level reduction penalty on the node when the correction is completed.
Further, when the nodes of the block chain are subjected to spot check according to a preset spot check proportion B0, the data of one node is inconsistent, and the actual trust Q of the node is lower than the initial trust Q0, the actual trust of the node is compared with a preset trust range, and a corresponding trust adjustment coefficient range is selected according to the comparison result to reduce the trust penalty of the node,
wherein, the block chain is also provided with a first preset confidence degree range F1, a second preset confidence degree range F2, a third preset confidence degree range F3, a first confidence degree adjusting coefficient range K1, a second confidence degree adjusting coefficient range K2 and a third confidence degree adjusting coefficient range K3, wherein F1 is larger than F2 is larger than F3, 1 is larger than K1 is larger than K2 is larger than K3 is larger than 0.5,
when Q belongs to F1, selecting a first trust degree adjusting coefficient range K1 to reduce the trust degree punishment of the node;
when Q belongs to F2, selecting a second trust degree adjusting coefficient range K2 to reduce the trust degree punishment of the node;
and when Q is equal to F3, selecting a third trust degree adjusting coefficient range K3 to perform trust degree reduction punishment on the node.
Further, when the ith trust degree regulating coefficient range Ki is selected to carry out trust degree reduction punishment on the node, i =1, 2, 3 is set, the block chain calculates the difference value delta Q between the actual trust degree Q of the node and the trust degree maximum value Qmax in the corresponding actual trust degree range, and selects the trust degree regulating coefficient in the corresponding trust degree regulating coefficient range to carry out trust degree reduction punishment on the node according to the difference value,
wherein, the block chain is also provided with a first confidence difference value delta Q1, a second confidence difference value delta Q2, a third confidence difference value delta Q3, a first confidence adjustment coefficient k1, a second confidence adjustment coefficient k2 and a third confidence adjustment coefficient k3, wherein, delta Q1 < delta Q2 < delta Q3, k1 < k2 < k3,
when the delta Q1 is not less than the delta Q < delta Q2, selecting a first trust degree adjusting coefficient k1 in the ith trust degree adjusting coefficient range Ki to reduce the trust degree punishment of the node;
when the delta Q2 is not less than the delta Q < delta Q3, selecting a second trust degree adjusting coefficient k2 in the ith trust degree adjusting coefficient range Ki to reduce the trust degree punishment of the node;
and when the delta Q is larger than or equal to the delta Q3, selecting a third trust degree adjusting coefficient k3 in the ith trust degree adjusting coefficient range Ki to carry out trust degree reduction punishment on the node.
Further, when the ith trust degree adjusting coefficient range Ki is selected to reduce the trust degree punishment on the nodes and acquire inconsistent data quantity, the acquired inconsistent data quantity U is compared with the preset inconsistent data quantity, the corresponding trust degree range adjusting coefficient is selected according to the comparison result to adjust the preset trust degree range,
wherein, the block chain is also provided with a first inconsistent data volume U1, a second inconsistent data volume U2, a third inconsistent data volume U3, a first confidence degree range adjusting coefficient D1, a second confidence degree range adjusting coefficient D2 and a confidence degree range adjusting coefficient D3, wherein U1 is more than U2 and more than U3, 0.8 is more than D1 is more than D2 is more than D3 is more than 0.5,
when U1 is not less than U and is less than U2, a first confidence degree range adjusting coefficient D1 is selected to adjust the preset confidence degree range;
when U2 is not less than U3, selecting a second trust degree range adjusting coefficient D2 to adjust the preset trust degree range;
when U is larger than or equal to U3, selecting a third confidence degree range adjusting coefficient D3 to adjust the preset confidence degree range;
when the jth confidence degree range adjusting coefficient Dj is selected to adjust the preset confidence degree range, setting i =1, 2, 3, setting the adjusted preset confidence degree range as F ', and setting F' = Fi multiplied by Dj.
Further, when the inconsistent data volume is obtained, a preset maximum inconsistent data volume Umax is further arranged on the block chain, when the inconsistent data volume is obtained, the actually obtained inconsistent data volume U is compared with the preset maximum inconsistent data volume Umax, and if the U is larger than or equal to the Umax, the block chain selects a second trust degree adjusting coefficient in a trust degree adjusting coefficient range corresponding to a trust degree range next to the preset trust degree range where the trust degree Q of the node is located to reduce the trust degree punishment on the node.
Further, the preset response duration t0 includes a first preset response duration t1, a second preset response duration t2, and a third preset response duration t3, when the node is spot-checked, if the node does not respond within the third preset response duration, the third trust level adjustment coefficient in the third trust level adjustment coefficient range is directly selected to perform trust level reduction penalty on the node, if the node responds within the third preset response duration, the actual response duration t of the node is obtained and compared with the preset response duration, a corresponding trust level range correction coefficient is selected according to the comparison result to correct the preset trust level range, and when the correction is completed, the trust level adjustment coefficient in the trust level adjustment coefficient range corresponding to the corrected preset trust level range is selected to perform trust level reduction penalty on the node.
Further, when the preset confidence level range is corrected, a first preset confidence level range correction coefficient x1, a second preset confidence level range correction coefficient x2 and a third preset confidence level range correction coefficient are further arranged on the block chain, 1 < x2 < x3 < 0.8 are set,
when t is less than t1, selecting a first preset confidence degree range correction coefficient x1 to correct the preset confidence degree range;
when t is more than or equal to t1 and is less than t2, a first preset confidence degree range correction coefficient x1 is selected to correct the preset confidence degree range;
when t is less than 2t and less than or equal to t3, selecting a first preset confidence degree range correction coefficient x1 to correct the preset confidence degree range;
when the s-th preset confidence range correction coefficient xs is selected to correct the preset confidence range, s =1, 2, 3 is set, and the corrected preset confidence range is set to F '″, and F' = F × xs is set.
Further, a preset confidence lower limit Qmin is also set on the block chain, and when the actual confidence of the node is lower than the preset confidence lower limit, the node is removed from the block chain.
Compared with the prior art, the distributed cluster system has the advantages that the block chain and the consensus algorithm are combined, so that the distributed cluster system has the characteristics of the block chain when data are processed, the error rate of the consensus algorithm is reduced, when each node stores data, the data stored by each node is checked while the data are shared, a trust mechanism is established for each node, the stored data can not be tampered under the trust mechanism, and the consistency of the stored data of each node is ensured.
Particularly, a spot check proportion is set on the block chain, spot check is carried out on data consistency of all nodes periodically or during data updating, actual trust of the node is obtained in the spot check process, when data of one node is inconsistent, a trust reduction punishment is carried out on the node, and when the trust reduction punishment is carried out, a corresponding trust adjustment coefficient is selected according to a comparison result of a preset trust range where the actual trust of the node is located for punishment, so that the possibility of data inconsistency caused by data tampering is reduced, and the safety and reliability of the consensus algorithm are improved.
Particularly, by setting the node response time length on the block chain, when the node does not respond or the response time length is longer, a corresponding punishment mechanism is selected to carry out trust degree reduction punishment on the node, so that the data error rate is reduced, and the safety and the reliability of the consensus algorithm are further improved.
Furthermore, by presetting a trust degree range and a trust degree range adjusting coefficient, and when the actual trust degree of the node is lower than the initial trust degree, selecting a corresponding trust degree adjusting coefficient range according to the preset trust degree range in which the actual trust degree is positioned to perform trust degree reduction punishment on the node with inconsistent data, the control precision of a trust mechanism is improved, the possibility of data inconsistency caused by falsification of the introduced data is further reduced, and the safety and reliability of the consensus algorithm are further improved.
Further, by setting a trust degree difference value and a trust degree adjusting coefficient, and when the actual trust degree of a certain node is lower than the initial trust degree and the data of the certain node is inconsistent, calculating the difference value between the actual trust degree and the initial trust degree and selecting the trust degree adjusting coefficient in the corresponding trust degree adjusting coefficient range according to the difference value to reduce the trust degree punishment of the node, the control precision of a trust mechanism is further improved, the possibility of leading out data to be distorted to cause data inconsistency is further reduced, and the safety and reliability of the consensus algorithm are further improved.
Furthermore, by setting inconsistent data volume and a trust degree range adjusting coefficient, when the data of a certain node is inconsistent during spot check, the trust degree range is adjusted by calculating the actual inconsistent data volume, and when the adjustment is completed, the trust degree penalty is reduced for the node by using the trust degree adjusting coefficient range corresponding to the adjusted trust degree range, the control precision of a trust mechanism is further improved, the possibility of data inconsistency caused by the falsification of the extracted data is further reduced, and the safety and reliability of the consensus algorithm are further improved.
Further, by setting the damaged maximum inconsistent data volume, when the actual inconsistent data volume exceeds the preset maximum inconsistent data volume, selecting a second trust degree adjusting coefficient in a trust degree adjusting coefficient range corresponding to a trust degree range next to the preset trust degree range in which the node trust degree Q is located to perform trust degree reduction punishment on the node, further improving the control precision of a trust mechanism, further reducing the possibility of leading-out data being distorted to cause data inconsistency, and further improving the safety and reliability of the consensus algorithm.
Further, a preset response time length is set, a corresponding preset trust degree range correction coefficient is selected according to a comparison result of the actual response time length of a certain node and the preset response time length to correct the preset trust degree range according to the fact that the actual response time length of the certain node exceeds the preset response time length, the corrected preset trust degree range where the actual trust degree is located is determined when the correction is completed, and the corresponding trust degree adjustment coefficient range is selected to reduce the trust degree punishment of the node when the correction is completed.
Drawings
Fig. 1 is a flowchart of a block chain-based consensus algorithm implementation method according to the present invention.
Detailed Description
In order that the objects and advantages of the invention will be more clearly understood, the invention is further described below with reference to examples; it should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only for explaining the technical principle of the present invention, and do not limit the scope of the present invention.
Fig. 1 shows a flowchart of a block chain-based consensus algorithm implementation method according to the present invention.
The invention discloses a block chain-based consensus algorithm implementation method, which comprises the following steps:
step S1, writing the data to be stored into the blockchain and checking the data written into each node on the blockchain when the data writing is completed so as to ensure that each node stores the data to be stored and the input data of each node is consistent with the data to be stored;
step S2, establishing an initial trust Q0 for each node on the blockchain, and taking the initial trust as the unique identifier of the node;
step S3, establishing timing spot check frequency on the block chain and/or spot check the node when updating data;
in step S3, a preset spot check proportion B0 is set on the blockchain, and when a spot check is performed on a node on the blockchain, randomly selecting nodes on the block chain according to a preset spot check proportion B0 to carry out spot check and comparing the data consistency of all the nodes, wherein the data of all the nodes are consistent, ending the spot check, if at least one node data is inconsistent, obtaining the past spot check record of the node, and calls the actual trust level Q of the node, if the actual trust level Q of the node is lower than the initial trust level Q0, selecting a corresponding trust degree regulating coefficient according to the actual trust degree range of the actual trust degree Q of the node to punish the node, when the actual confidence level Q of the node is lower than the initial confidence level Q0, the blockchain extracts the data amount U of the inconsistent data of the node, selecting a corresponding trust degree adjusting coefficient according to the inconsistent data quantity U to punish the node;
in step S3, when performing spot check on each node, the block chain further performs a corresponding trust level reduction penalty on the checked node according to whether the checked node responds and the response duration t, acquires the actual trust level Q of the node when the checked node does not respond or the response duration t exceeds the preset response duration t0, compares the actual response duration t of the node with the preset response duration t0, selects a corresponding trust level range correction coefficient according to the comparison result to correct the preset trust level range, and selects a trust level adjustment coefficient in the trust level adjustment coefficient range corresponding to the corrected preset trust level range to perform a trust level reduction penalty on the node when the correction is completed.
Specifically, by combining the block chain and the consensus algorithm, the distributed cluster system has the characteristics of the block chain when data processing is performed, the error rate of the consensus algorithm is reduced, when each node stores data, the data stored by each node is subjected to consistency check while the data is shared, and a trust mechanism is established for each node.
Particularly, a spot check proportion is set on the block chain, spot check is carried out on data consistency of all nodes periodically or during data updating, actual trust of the node is obtained in the spot check process, when data of one node is inconsistent, a trust reduction punishment is carried out on the node, and when the trust reduction punishment is carried out, a corresponding trust adjustment coefficient is selected according to a comparison result of a preset trust range where the actual trust of the node is located for punishment, so that the possibility of data inconsistency caused by data tampering is reduced, and the safety and reliability of the consensus algorithm are improved.
Particularly, by setting the node response time length on the block chain, when the node does not respond or the response time length is longer, a corresponding punishment mechanism is selected to carry out trust degree reduction punishment on the node, so that the data error rate is reduced, and the safety and the reliability of the consensus algorithm are further improved.
Referring to fig. 1, when the nodes of the block chain are spot-checked according to a preset spot-check ratio B0 and one of the node data is inconsistent and the actual confidence Q of the node is lower than the initial confidence Q0, the actual confidence of the node is compared with the preset confidence range and the corresponding confidence adjustment coefficient range is selected according to the comparison result to penalize the node for reducing the confidence,
wherein, the block chain is also provided with a first preset confidence degree range F1, a second preset confidence degree range F2, a third preset confidence degree range F3, a first confidence degree adjusting coefficient range K1, a second confidence degree adjusting coefficient range K2 and a third confidence degree adjusting coefficient range K3, wherein F1 is larger than F2 is larger than F3, 1 is larger than K1 is larger than K2 is larger than K3 is larger than 0.5,
when Q belongs to F1, selecting a first trust degree adjusting coefficient range K1 to reduce the trust degree punishment of the node;
when Q belongs to F2, selecting a second trust degree adjusting coefficient range K2 to reduce the trust degree punishment of the node;
and when Q is equal to F3, selecting a third trust degree adjusting coefficient range K3 to perform trust degree reduction punishment on the node.
Specifically, by presetting a trust degree range and a trust degree range adjusting coefficient, and when the actual trust degree of the node is lower than the initial trust degree, selecting a corresponding trust degree adjusting coefficient range according to the preset trust degree range in which the actual trust degree is positioned to perform trust degree reduction punishment on the node with inconsistent data, the control precision of a trust mechanism is improved, the possibility of data inconsistency caused by tampering of the introduced data is further reduced, and the safety and reliability of the consensus algorithm are further improved.
Continuing to refer to fig. 1, the block chain-based consensus algorithm implementation method of the present invention sets i =1, 2, 3 when the ith trust level adjustment coefficient range Ki is selected to make a trust level reduction penalty on a node, the block chain calculates a difference Δ Q between the actual trust level Q of the node and the trust level maximum Qmax in the corresponding actual trust level range, and selects the trust level adjustment coefficient in the corresponding trust level adjustment coefficient range according to the difference to make a trust level reduction penalty on the node,
wherein, the block chain is also provided with a first confidence difference value delta Q1, a second confidence difference value delta Q2, a third confidence difference value delta Q3, a first confidence adjustment coefficient k1, a second confidence adjustment coefficient k2 and a third confidence adjustment coefficient k3, wherein, delta Q1 < delta Q2 < delta Q3, k1 < k2 < k3,
when the delta Q1 is not less than the delta Q < delta Q2, selecting a first trust degree adjusting coefficient k1 in the ith trust degree adjusting coefficient range Ki to reduce the trust degree punishment of the node;
when the delta Q2 is not less than the delta Q < delta Q3, selecting a second trust degree adjusting coefficient k2 in the ith trust degree adjusting coefficient range Ki to reduce the trust degree punishment of the node;
and when the delta Q is larger than or equal to the delta Q3, selecting a third trust degree adjusting coefficient k3 in the ith trust degree adjusting coefficient range Ki to carry out trust degree reduction punishment on the node.
Specifically, by setting a trust degree difference value and a trust degree adjusting coefficient, and when the actual trust degree of a certain node is lower than the initial trust degree and the data of the certain node is inconsistent, calculating the difference value between the actual trust degree and the initial trust degree and selecting the trust degree adjusting coefficient in the corresponding trust degree adjusting coefficient range according to the difference value to reduce the trust degree punishment of the node, the control precision of a trust mechanism is further improved, the possibility of leading out data to be distorted to cause data inconsistency is further reduced, and the safety and reliability of the consensus algorithm are further improved.
Referring to fig. 1, when the ith trust degree adjustment coefficient range Ki is selected to make a trust degree reduction penalty on the node and obtain inconsistent data volume, the obtained inconsistent data volume U is compared with the preset inconsistent data volume, the corresponding trust degree range adjustment coefficient is selected according to the comparison result to adjust the preset trust degree range,
wherein, the block chain is also provided with a first inconsistent data volume U1, a second inconsistent data volume U2, a third inconsistent data volume U3, a first confidence degree range adjusting coefficient D1, a second confidence degree range adjusting coefficient D2 and a confidence degree range adjusting coefficient D3, wherein U1 is more than U2 and more than U3, 1 is more than D1 and more than D2 and more than D3 and less than 0.5,
when U1 is not less than U and is less than U2, a first confidence degree range adjusting coefficient D1 is selected to adjust the preset confidence degree range;
when U2 is not less than U3, selecting a second trust degree range adjusting coefficient D2 to adjust the preset trust degree range;
when U is larger than or equal to U3, selecting a third confidence degree range adjusting coefficient D3 to adjust the preset confidence degree range;
when the jth confidence degree range adjusting coefficient Dj is selected to adjust the preset confidence degree range, setting i =1, 2, 3, setting the adjusted preset confidence degree range as F ', and setting F' = Fi multiplied by Dj.
Specifically, by setting inconsistent data volume and a trust degree range adjusting coefficient, when data of a certain node is inconsistent during spot check, the trust degree range is adjusted by calculating the actual inconsistent data volume, and when the adjustment is completed, the trust degree penalty is reduced for the node by using the trust degree adjusting coefficient range corresponding to the adjusted trust degree range, the control precision of a trust mechanism is further improved, the possibility of data inconsistency caused by the falsification of the led-out data is further reduced, and the safety and reliability of the consensus algorithm are further improved.
Referring to fig. 1, according to the block chain-based consensus algorithm implementation method, when the inconsistent data amount is obtained, a preset maximum inconsistent data amount Umax is further arranged on the block chain, when the inconsistent data amount is obtained, the actually obtained inconsistent data amount U is compared with the preset maximum inconsistent data amount Umax, and if U is greater than or equal to Umax, the block chain selects a second trust degree adjustment coefficient in a trust degree adjustment coefficient range corresponding to a trust degree range next to the preset trust degree range where the trust degree Q of the node is located to reduce the trust degree penalty for the node.
Specifically, by setting the damaged maximum inconsistent data volume, when the actual inconsistent data volume exceeds the preset maximum inconsistent data volume, selecting a second trust degree adjusting coefficient in a trust degree adjusting coefficient range corresponding to a trust degree range next to the preset trust degree range in which the node trust degree Q is located to perform trust degree reduction punishment on the node, further improving the control precision of a trust mechanism, further reducing the possibility of leading out data to be distorted to cause data inconsistency, and further improving the safety and reliability of the consensus algorithm.
Referring to fig. 1, the block chain-based consensus algorithm implementation method of the present invention, the preset response time periods t0 include a first preset response time period t1, a second preset response time period t2 and a third preset response time period t3, when the node is spot-checked, if the node does not respond within a third preset response time length, directly selecting a third trust degree regulating coefficient in a third trust degree regulating coefficient range to carry out trust degree reduction punishment on the node, if the node responds within a third preset time length, the actual response time t of the node is obtained and compared with the preset response time, selecting a corresponding confidence degree range correction coefficient according to the comparison result to correct the preset confidence degree range, and after the correction is finished, selecting a trust degree adjusting coefficient in a trust degree adjusting coefficient range corresponding to the corrected preset trust degree range to carry out trust degree reduction punishment on the node.
Referring to fig. 1, in the block chain-based consensus algorithm implementation method of the present invention, when the predetermined confidence level range is modified, the block chain is further provided with a first predetermined confidence level range modification coefficient x1, a second predetermined confidence level range modification coefficient x2, and a third predetermined confidence level range modification coefficient, where 1 < x1 < x2 < x3 < 0.8,
when t is less than t1, selecting a first preset confidence degree range correction coefficient x1 to correct the preset confidence degree range;
when t is more than or equal to t1 and is less than t2, a first preset confidence degree range correction coefficient x1 is selected to correct the preset confidence degree range;
when t is less than 2t and less than or equal to t3, selecting a first preset confidence degree range correction coefficient x1 to correct the preset confidence degree range;
when the s-th preset confidence range correction coefficient xs is selected to correct the preset confidence range, s =1, 2, 3 is set, and the corrected preset confidence range is set to F '″, and F' = F × xs is set.
Specifically, a preset response time length is set, a corresponding preset trust degree range correction coefficient is selected according to a comparison result of the actual response time length of a certain node and the preset response time length to correct a preset trust degree range according to the actual response time length of the node and the preset response time length, the corrected preset trust degree range where the actual trust degree is located is determined when the correction is completed, and a corresponding trust degree adjustment coefficient range is selected to reduce the trust degree punishment of the node when the correction is completed.
Referring to fig. 1, in the block chain-based consensus algorithm implementation method of the present invention, a preset confidence lower limit Qmin is further set on the block chain, and when the actual confidence of the node is lower than the preset confidence lower limit, the node is removed from the block chain.
So far, the technical solutions of the present invention have been described in connection with the preferred embodiments shown in the drawings, but it is easily understood by those skilled in the art that the scope of the present invention is obviously not limited to these specific embodiments. Equivalent changes or substitutions of related technical features can be made by those skilled in the art without departing from the principle of the invention, and the technical scheme after the changes or substitutions can fall into the protection scope of the invention.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention; various modifications and alterations to this invention will become apparent to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (8)

1. A block chain-based consensus algorithm implementation method is characterized by comprising the following steps:
step S1, writing the data to be stored into the blockchain and checking the data written into each node on the blockchain when the data writing is completed so as to ensure that each node stores the data to be stored and the input data of each node is consistent with the data to be stored;
step S2, establishing an initial trust Q0 for each node on the block chain, and taking the initial trust as the unique identification of the block;
step S3, establishing timing spot check frequency on the block chain and/or spot check the block when updating data;
in step S3, a preset spot check proportion B0 is set on the blockchain, and when a spot check is performed on a node on the blockchain, randomly selecting nodes on the block chain according to a preset spot check proportion B0 to carry out spot check and comparing the data consistency of all the nodes, wherein the data of all the nodes are consistent, ending the spot check, if at least one node data is inconsistent, obtaining the past spot check record of the node, and calls the actual trust level Q of the node, if the actual trust level Q of the node is lower than the initial trust level Q0, selecting a corresponding trust degree regulating coefficient according to the actual trust degree range of the actual trust degree Q of the node to punish the node, when the actual confidence level Q of the node is lower than the initial confidence level Q0, the blockchain extracts the data amount U of the inconsistent data of the node, selecting a corresponding trust degree range adjusting coefficient according to the inconsistent data quantity U to adjust the preset trust degree range;
in step S3, when performing spot check on each node, the block chain further performs a corresponding trust level reduction penalty on the checked node according to whether the checked node responds and the response duration t, acquires the actual trust level Q of the node when the checked node does not respond or the response duration t exceeds the preset response duration t0, compares the actual response duration t of the node with the preset response duration t0, selects a corresponding trust level range correction coefficient according to the comparison result to correct the preset trust level range, and selects a trust level adjustment coefficient in the trust level adjustment coefficient range corresponding to the corrected preset trust level range to perform a trust level reduction penalty on the node when the correction is completed.
2. The block chain-based consensus algorithm implementation method of claim 1, wherein when a node of the block chain is spot checked according to a preset spot check ratio B0 and one of the node data is inconsistent and the actual confidence Q of the node is lower than the initial confidence Q0, the actual confidence of the node is compared with a preset confidence range and a corresponding confidence adjustment coefficient range is selected according to the comparison result to penalize the node for reducing the confidence,
wherein, the block chain is also provided with a first preset confidence degree range F1, a second preset confidence degree range F2, a third preset confidence degree range F3, a first confidence degree adjusting coefficient range K1, a second confidence degree adjusting coefficient range K2 and a third confidence degree adjusting coefficient range K3, wherein F1 is larger than F2 is larger than F3, 1 is larger than K1 is larger than K2 is larger than K3 is larger than 0.5,
when Q belongs to F1, selecting a first trust degree adjusting coefficient range K1 to reduce the trust degree punishment of the node;
when Q belongs to F2, selecting a second trust degree adjusting coefficient range K2 to reduce the trust degree punishment of the node;
and when Q is equal to F3, selecting a third trust degree adjusting coefficient range K3 to perform trust degree reduction punishment on the node.
3. The block chain-based consensus algorithm realization method of claim 2, wherein when an ith confidence adjustment coefficient range Ki is selected to make a confidence reduction penalty on a node, i =1, 2, 3 is set, the block chain calculates a difference Δ Q between an actual confidence Q of the node and a confidence maximum Qmax in a corresponding actual confidence range, and selects a confidence adjustment coefficient in a corresponding confidence adjustment coefficient range to make a confidence reduction penalty on the node according to the difference,
wherein, the block chain is also provided with a first confidence difference value delta Q1, a second confidence difference value delta Q2, a third confidence difference value delta Q3, a first confidence adjustment coefficient k1, a second confidence adjustment coefficient k2 and a third confidence adjustment coefficient k3, wherein, delta Q1 < delta Q2 < delta Q3, k1 < k2 < k3,
when the delta Q1 is not less than the delta Q < delta Q2, selecting a first trust degree adjusting coefficient k1 in the ith trust degree adjusting coefficient range Ki to reduce the trust degree punishment of the node;
when the delta Q2 is not less than the delta Q < delta Q3, selecting a second trust degree adjusting coefficient k2 in the ith trust degree adjusting coefficient range Ki to reduce the trust degree punishment of the node;
and when the delta Q is larger than or equal to the delta Q3, selecting a third trust degree adjusting coefficient k3 in the ith trust degree adjusting coefficient range Ki to carry out trust degree reduction punishment on the node.
4. The block chain-based consensus algorithm implementation method of claim 3, wherein when an ith confidence level adjustment coefficient range Ki is selected to make a confidence level reduction penalty on a node and obtain an inconsistent data amount, the obtained inconsistent data amount U is compared with a preset inconsistent data amount, a corresponding confidence level range adjustment coefficient is selected according to a comparison result to adjust the preset confidence level range,
wherein, the block chain is also provided with a first inconsistent data volume U1, a second inconsistent data volume U2, a third inconsistent data volume U3, a first confidence degree range adjusting coefficient D1, a second confidence degree range adjusting coefficient D2 and a confidence degree range adjusting coefficient D3, wherein U1 is more than U2 and more than U3, 0.8 is more than D1 is more than D2 is more than D3 is more than 0.5,
when U1 is not less than U and is less than U2, a first confidence degree range adjusting coefficient D1 is selected to adjust the preset confidence degree range;
when U2 is not less than U3, selecting a second trust degree range adjusting coefficient D2 to adjust the preset trust degree range;
when U is larger than or equal to U3, selecting a third confidence degree range adjusting coefficient D3 to adjust the preset confidence degree range;
when the jth confidence degree range adjusting coefficient Dj is selected to adjust the preset confidence degree range, setting i =1, 2, 3, setting the adjusted preset confidence degree range as F ', and setting F' = Fi multiplied by Dj.
5. The block chain-based consensus algorithm implementation method of claim 4, wherein when the inconsistent data amount is obtained, a preset maximum inconsistent data amount Umax is further set on the block chain, when the inconsistent data amount is obtained, an actually obtained inconsistent data amount U is compared with the preset maximum inconsistent data amount Umax, and if U is greater than or equal to Umax, the block chain selects a second trust degree adjustment coefficient in a trust degree adjustment coefficient range corresponding to a trust degree range next to the preset trust degree range where the trust degree Q of the node is located to reduce the trust degree penalty for the node.
6. The block chain based consensus algorithm implementation method of claim 5, the preset response time periods t0 include a first preset response time period t1, a second preset response time period t2 and a third preset response time period t3, when the node is spot-checked, if the node does not respond within a third preset response time length, directly selecting a third trust degree regulating coefficient in a third trust degree regulating coefficient range to carry out trust degree reduction punishment on the node, if the node responds within a third preset time length, the actual response time t of the node is obtained and compared with the preset response time, selecting a corresponding confidence degree range correction coefficient according to the comparison result to correct the preset confidence degree range, and when the correction is finished, selecting a trust degree adjusting coefficient in a trust degree adjusting coefficient range corresponding to the corrected preset trust degree range to carry out trust degree reduction punishment on the node.
7. The block chain-based consensus algorithm implementation method of claim 6, wherein when the predetermined confidence level range is modified, the block chain further comprises a first predetermined confidence level range modification coefficient x1, a second predetermined confidence level range modification coefficient x2, and a third predetermined confidence level range modification coefficient x3, wherein 1 < x2 < x3 < 0.8 is set,
when t is less than t1, selecting a first preset confidence degree range correction coefficient x1 to correct the preset confidence degree range;
when t is more than or equal to t1 and is less than t2, a first preset confidence degree range correction coefficient x2 is selected to correct the preset confidence degree range;
when t is less than 2t and less than or equal to t3, selecting a first preset confidence degree range correction coefficient x3 to correct the preset confidence degree range;
when the s-th preset confidence range correction coefficient xs is selected to correct the preset confidence range, s =1, 2, 3 is set, and the corrected preset confidence range is set to F '″, and F' = F × xs is set.
8. The block chain-based consensus algorithm implementation method of claim 7, wherein a preset confidence lower limit Qmin is further set on the block chain, and when the actual confidence of the node is lower than the preset confidence lower limit, the node is removed from the block chain.
CN202110999868.7A 2021-08-30 2021-08-30 Consensus algorithm implementation method based on block chain Active CN113438327B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110999868.7A CN113438327B (en) 2021-08-30 2021-08-30 Consensus algorithm implementation method based on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110999868.7A CN113438327B (en) 2021-08-30 2021-08-30 Consensus algorithm implementation method based on block chain

Publications (2)

Publication Number Publication Date
CN113438327A CN113438327A (en) 2021-09-24
CN113438327B true CN113438327B (en) 2021-11-30

Family

ID=77798270

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110999868.7A Active CN113438327B (en) 2021-08-30 2021-08-30 Consensus algorithm implementation method based on block chain

Country Status (1)

Country Link
CN (1) CN113438327B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107169765A (en) * 2017-05-11 2017-09-15 电子科技大学 A kind of method adjusted into Mobile state of being known together based on business degree of belief to block chain
CN109639837A (en) * 2019-01-31 2019-04-16 东南大学 Block chain DPoS common recognition method based on faith mechanism
CN110417872A (en) * 2019-07-08 2019-11-05 深圳供电局有限公司 A kind of edge network resource allocation methods towards mobile block chain
WO2019222993A1 (en) * 2018-05-25 2019-11-28 北京大学深圳研究生院 Blockchain consensus method based on trust relationship
CN110519246A (en) * 2019-08-15 2019-11-29 安徽师范大学 Based on the degree of belief calculation method for trusting block chain link point
CN111292098A (en) * 2020-01-15 2020-06-16 北京航空航天大学 Trusted service supply chain-oriented block chain consensus mechanism construction method
CN112328694A (en) * 2020-11-16 2021-02-05 深圳壹账通智能科技有限公司 Method and device for adjusting node trust degree in block chain, electronic equipment and storage medium
CN113132401A (en) * 2021-04-25 2021-07-16 深圳大学 Data processing method and device based on block chain

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107169765A (en) * 2017-05-11 2017-09-15 电子科技大学 A kind of method adjusted into Mobile state of being known together based on business degree of belief to block chain
WO2019222993A1 (en) * 2018-05-25 2019-11-28 北京大学深圳研究生院 Blockchain consensus method based on trust relationship
CN109639837A (en) * 2019-01-31 2019-04-16 东南大学 Block chain DPoS common recognition method based on faith mechanism
CN110417872A (en) * 2019-07-08 2019-11-05 深圳供电局有限公司 A kind of edge network resource allocation methods towards mobile block chain
CN110519246A (en) * 2019-08-15 2019-11-29 安徽师范大学 Based on the degree of belief calculation method for trusting block chain link point
CN111292098A (en) * 2020-01-15 2020-06-16 北京航空航天大学 Trusted service supply chain-oriented block chain consensus mechanism construction method
CN112328694A (en) * 2020-11-16 2021-02-05 深圳壹账通智能科技有限公司 Method and device for adjusting node trust degree in block chain, electronic equipment and storage medium
CN113132401A (en) * 2021-04-25 2021-07-16 深圳大学 Data processing method and device based on block chain

Also Published As

Publication number Publication date
CN113438327A (en) 2021-09-24

Similar Documents

Publication Publication Date Title
CN108881165B (en) Multi-center authentication system with block issuing mechanism
US11611445B2 (en) Changing smart contracts recorded in block chains
CN109542979B (en) Fast synchronization and simple data storage mode of block chain system
CN107547606B (en) Data processing method, cluster manager, resource manager and data processing system
US20210006408A1 (en) Block chain-based node device, method for operating node device, and data processing system
CN107861991B (en) Receipt data processing method and device, computer equipment and storage medium
US7770065B2 (en) File data restoring system and method of computer operating system and software thereof
CN107609188A (en) Data syn-chronization method of calibration based on GoldenGate
CN111291000A (en) Block chain-based file acquisition method, equipment and storage medium
DE102006003146A1 (en) Device and method for reading out a data word and device and method for storing a data block
CN104778123A (en) Method and device for detecting system performance
CN113438327B (en) Consensus algorithm implementation method based on block chain
CN110851862B (en) Private and privacy data protection method in alliance chain
CN113111125B (en) Business evidence-storing method based on block chain
CN112003701B (en) Block self-checking and synchronizing method and device
CN111143341B (en) Block chain account book weight reducing method based on intelligent contracts
CN111131329A (en) Data consensus method and device for block chain system and hardware equipment
CN111524009A (en) Transaction verification method and device for blockchain system and hardware equipment
CN111708734A (en) Metadata access method, system, device and medium for distributed system
CN112950384A (en) Processing system, method, computer equipment and storage medium based on cache technology
CN110765207B (en) Method for data synchronization between systems
CN111090710A (en) Distribution network multi-time scale graph-model abnormal automatic maintenance method
CN111917826A (en) PBFT consensus algorithm based on block chain intellectual property protection
CN114969077A (en) Service data processing method and device
CN112600874B (en) Node joining method and device, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant