<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">OALibJ</journal-id><journal-title-group><journal-title>Open Access Library Journal</journal-title></journal-title-group><issn pub-type="epub">2333-9705</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/oalib.1106713</article-id><article-id pub-id-type="publisher-id">OALibJ-102632</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Biomedical&amp;Life Sciences</subject><subject> Business&amp;Economics</subject><subject> Chemistry&amp;Materials Science</subject><subject> Computer Science&amp;Communications</subject><subject> Earth&amp;Environmental Sciences</subject><subject> Engineering</subject><subject> Medicine&amp;Healthcare</subject><subject> Physics&amp;Mathematics</subject><subject> Social Sciences&amp;Humanities</subject></subj-group></article-categories><title-group><article-title>
 
 
  A Consensus Mechanism Based on an Improved Genetic Algorithm
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Chen</surname><given-names>Yang</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Tao</surname><given-names>Wang</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Kun</surname><given-names>Wang</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib></contrib-group><aff id="aff1"><addr-line>The College of Nuclear Technology and Automation Engineering, Chengdu University of Technology, Chengdu, China</addr-line></aff><pub-date pub-type="epub"><day>01</day><month>09</month><year>2020</year></pub-date><volume>07</volume><issue>09</issue><fpage>1</fpage><lpage>6</lpage><history><date date-type="received"><day>12,</day>	<month>August</month>	<year>2020</year></date><date date-type="rev-recd"><day>28,</day>	<month>August</month>	<year>2020</year>	</date><date date-type="accepted"><day>1,</day>	<month>September</month>	<year>2020</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  
    An important feature of blockchain technology is that all participants jointly maintain transaction data and can achieve mutual trust relationships without integrated control, which relies on distributed consensus algorithms. Practical Byzantine Fault Tolerant algorithm (PBFT) is a fault-tolerant algorithm based on state machine replication, which solves the Byzantine error, that is, the malicious behavior of nodes. In PBFT, all participating nodes are divided into the primary node and backup nodes. When this primary node commits evil or fails, it will elect a primary node again for message communication. The genetic algorithm (GA) is a computer simulation study inspired by the natural biological genetic evolution criterion “natural selection, survival of the fittest”. Genetic algorithm is actually a method to find the optimal solution. According to it, the best primary node is selected in the PBFT algorithm to improve consensus efficiency. The consensus algorithm is the guarantee of the decentralization feature in blockchain technology. The PBFT algorithm is a commonly used consensus algorithm. However, this algorithm has the following problems: when the primary node fails, it must be selected again, which leads to a decrease in consensus efficiency. This paper proposes a consensus mechanism based on an improved genetic algorithm, which uses an improved genetic algorithm to select the primary node. According to the genetic algorithm, the best primary node is selected, and it meets the minimum number of errors or evils and the highest transaction efficiency with other backup nodes. The improved consensus algorithm can effectively reduce system delay and improve consensus efficiency. 
  
 
</p></abstract><kwd-group><kwd>Consensus Mechanism</kwd><kwd> Genetic Algorithm</kwd><kwd> Improvement</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>In blockchain system, the consensus algorithm enables all participants to jointly maintain transaction data and achieve mutual trust relationships without integrated control. Consensus algorithms can be roughly divided into proof-based consensus algorithms and voting-based consensus algorithms; the most classic consensus voting-based algorithm is the PBFT algorithm. But this consensus algorithm has some problems to improve. Then many variant consensus algorithms are presented to issue the shortcomings of PBFT. In BBFT [<xref ref-type="bibr" rid="scirp.102632-ref1">1</xref>], it uses the topology tree structure and message aggregation to reduce the communication complexity. Liu et al. presented the FastBFT [<xref ref-type="bibr" rid="scirp.102632-ref2">2</xref>] in 2018. It uses a message aggregation and trust execution environments technique to improve the PBFT. Since in PBFT, the total number of nodes is 3f + 1 (f is the number of fault nodes), then Giuliana Santos Veronese et al. propose MinBFT [<xref ref-type="bibr" rid="scirp.102632-ref3">3</xref>] and Rudiger Kaitza et al. present CheapBFT [<xref ref-type="bibr" rid="scirp.102632-ref4">4</xref>]. Their methods all reduce the total nodes’ number from 3f + 1 to 2f + 1. Zyzzyva [<xref ref-type="bibr" rid="scirp.102632-ref5">5</xref>] is a Speculative Byzantine Fault Tolerance which is proposed by Ramakrishna Kotla et al. It changes three-protocol of PBFT to improve performance. HAO et al. proposed the CDBFT [<xref ref-type="bibr" rid="scirp.102632-ref6">6</xref>]. It combines DPOS and PBFT to reduce the participation probability of malicious replicas in the consensus process. Jeon et al. proposed the DBFT [<xref ref-type="bibr" rid="scirp.102632-ref7">7</xref>] which makes optimization for the application of public blockchain. Among all the PBFT variant algorithms, few have improved the algorithm by changing the way the master node is selected. So this article proposes a consensus mechanism based on an improved genetic algorithm. BAGLEY took the lead in using the concept of “genetic algorithm” in the paper [<xref ref-type="bibr" rid="scirp.102632-ref8">8</xref>] in 1967. The improved genetic algorithm is used to obtain the best primary node when it is selected. After calculation, the algorithm improves transaction efficiency and processing time. The structure of the paper is as follows: Section 2 describes the traditional PBFT algorithm, Section 3 introduces the consensus algorithm based on the improved genetic algorithm, and Section 4 does a summary to this article.</p></sec><sec id="s2"><title>2. Practical Byzantine Fault Tolerance Algorithm</title><p>PBFT algorithm was presented by Castro and Liskvo in 1999 [<xref ref-type="bibr" rid="scirp.102632-ref9">9</xref>]. It requires that each consensus be executed in the same order on each copy, and each participant decides the content of the consensus by voting. PBFT adopts a three-phase protocol: PREPREPARE, PREPARE, and COMMIT.</p><p>PRE-PREPARE</p><p>In the PRE-PREPARE phase, the primary sends a pre-prepare message to all replica nodes.</p><p>PREPARE</p><p>When the backup node i has received the pre-prepare message, it enters the PREPARE phase, and sends the prepare message to other nodes. Besides it writes both the pre-prepare message and the prepare message to the log.</p><p>In the PBFT algorithm, the PRE-PREPARE phase and the PREPARE phase ensure that the non-faulty replica nodes agree on the ordering of requests in the same view. BFT systems shall guarantee safety and liveness in the presence of faulty servers and clients [<xref ref-type="bibr" rid="scirp.102632-ref10">10</xref>].</p><p>COMMIT</p><p>The replica joins in the COMMIT phase and broadcasts to all replicas the commit message. <xref ref-type="fig" rid="fig1">Figure 1</xref> is a flow chart of the three-phase agreement.</p><p>The above three steps determine the number of replicas in PBFT is 3f + 1 and the communication complexity is o(f<sup>2</sup>) (f is the number of faulty nodes).</p></sec><sec id="s3"><title>3. A Variant Consensus Mechanism Based on an Improved Genetic Algorithm</title><p>Since in the PBFT algorithm nodes are divided into the primary node and other replica nodes, and the primary node as a consensus node executes a three-phase protocol to complete transactions. Once the primary node fails, it will re-select, which will cause the efficiency of system transaction execution to decrease. Therefore, the selection of the primary node is very essential. This paper proposes an improved genetic algorithm to select the best primary node of PBFT. The improved genetic algorithm mainly uses the elitist strategy to retain the best individual, and the best individual does not undergo mutation, crossover and other operations, and directly enters the next generation. The improved algorithm not only improves convergence, but also ensures that the optimal individual characteristics are not destroyed in the evolution process [<xref ref-type="bibr" rid="scirp.102632-ref11">11</xref>] [<xref ref-type="bibr" rid="scirp.102632-ref12">12</xref>]. Firstly, each participant is involved in coding into the corresponding chromosomes to form the initial initial population. Secondly, select the master node according to the fitness function. Then use the elitist selection strategy to perform crossover and mutation operations to achieve the best primary node selection.</p><p>Step I</p><p>Encoding all participating codes to chromosome. Suppose there are m participating nodes, a chromosome of an m-dimensional vector is obtained after encoding, this dimension is the number of all participating nodes N = {n<sub>1</sub>, n<sub>2</sub>, ..., n<sub>i</sub>, ..., n<sub>m</sub>}.</p><p>Step II</p><p>Setting fitness function f ( n i ) = ∑ n i ∈ N Fau ( n i ) EFF ( n i ) for all encoded chromosomes. n<sub>i</sub> represents a legal chromosome, N represents the set of all chromosomes, Fau() represents the number of times that the node has problems, and Eff() represents the efficiency of the node’s transaction with other nodes. According to the f(n<sub>i</sub>) to obtain the optimal solution, the best primary node is selected.</p><p>Step III</p><p>Selecting the best master node according to the elitist selection strategy, and other nodes perform mutation and selection operations.</p><p>Step IV</p><p>When the termination conditions are met, the optimal solution of the function will be used as the primary node to participate in the implementation of the PBFT three-phase protocol.</p><p><xref ref-type="fig" rid="fig2">Figure 2</xref> is a flowchart of the improved algorithm.</p></sec><sec id="s4"><title>4. Conclusions</title><p>Latency is an important indicator to measure the performance of the blockchain. The delay is mainly affected by two aspects: one is the network communication performance when the message is propagated between nodes, and the other is the operating efficiency of the consensus algorithm. According to formula Delay = T<sub>Broadcast</sub> + T<sub>Consensus</sub>, in the fitness function f ( n i ) = ∑ n i ∈ N Fau ( n i ) EFF ( n i ) , if a node meets the minimum Fau() and the maximum Eff(), during the consensus process, T<sub>Broadcast</sub> decreases, so the entire Delay decreases. Compared with the traditional PBFT algorithm, the delay is effectively reduced.</p><p>This paper proposes a PBFT algorithm based on an improved genetic algorithm, which uses genetic algorithm to improve the selection strategy of the primary node, so that the improved PBFT algorithm consensus efficiency is higher.</p></sec><sec id="s5"><title>Conflicts of Interest</title><p>The authors declare no conflicts of interest regarding the publication of this paper.</p></sec><sec id="s6"><title>Cite this paper</title><p>Yang, C., Wang, T. and Wang, K. (2020) A Consensus Mechanism Based on an Improved Genetic Algorithm. Open Access Library Journal, 7: e6713. https://doi.org/10.4236/oalib.1106713</p></sec></body><back><ref-list><title>References</title><ref id="scirp.102632-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">https://github.com/bystackcom/BBFT-Whitepaper/blob/master/whitepaper.pdf</mixed-citation></ref><ref id="scirp.102632-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">Liu, J., Li, W., Karame, G., et al. (2016) Scalable Byzantine Consensus via Hardware-Assisted Secret Sharing. IEEE Transactions on Computers, 68, 139-151.  
&lt;br /&gt;https://doi.org/10.1109/TC.2018.2860009</mixed-citation></ref><ref id="scirp.102632-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">Veronese, G.S., Correia, M., Bessani, A.N., et al. (2013) Efficient Byzantine Fault-Tolerance. IEEE Transactions on Computers, 62, 16-30.</mixed-citation></ref><ref id="scirp.102632-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">Kapitza, R., Behl, J., Cachin, C., Distler, T., Kuhnle, S., Mohammadi, S.V., Schr¨oder-Preikschat, W. and Stengel, K. (2012) Cheapbft: Resource-Efficient Byzantine Fault Tolerance. Proceedings of the 7th ACM European Conference on Computer Systems, April 2012, 295-308.  
&lt;br /&gt;https://doi.org/10.1145/2168836.2168866</mixed-citation></ref><ref id="scirp.102632-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">Kotla, R.., Clement, A., Wong, E., et al. (2008) Zyzzyva: Speculative Byzantine Fault Tolerance. Speculative Byzantine Fault Tolerance.  
https://doi.org/10.1145/1294261.1294267</mixed-citation></ref><ref id="scirp.102632-ref6"><label>6</label><mixed-citation publication-type="other" xlink:type="simple">Wang, F.Y., Cai, S.S., Lin, T.C., et al. (2019) Study of Blockchains’s Consensus Mechanism Based on Credit. IEEE Access, PP(99), 1-1.  
https://doi.org/10.1109/ACCESS.2019.2891065</mixed-citation></ref><ref id="scirp.102632-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">Jeon, S., Doh, I. and Chae, K. (2018) RMBC: Randomized Mesh Blockchain Using DBFT Consensus Algorithm. 2018 International Conference on Information Networking (ICOIN), Chiang Mai, 10-12 January 2018.  
https://doi.org/10.1109/ICOIN.2018.8343211</mixed-citation></ref><ref id="scirp.102632-ref8"><label>8</label><mixed-citation publication-type="other" xlink:type="simple">Rudolph, G. (1994) Convergence Analysis of Canonical Genetic Algorithms. IEEE Transactions on Neural Networks, 5, 96. https://doi.org/10.1109/72.265964</mixed-citation></ref><ref id="scirp.102632-ref9"><label>9</label><mixed-citation publication-type="other" xlink:type="simple">Castro, M. and Liskov, B. (2002) Practical Byzantine Fault Tolerance. ACM Transactions on Computer Systems, 20, 398-461. https://doi.org/10.1145/571637.571640</mixed-citation></ref><ref id="scirp.102632-ref10"><label>10</label><mixed-citation publication-type="other" xlink:type="simple">Cai, Q., Lin, J., Li, F., et al. (2014) EFS: Efficient and Fault-Scalable Byzantine Fault Tolerant Systems against Faulty Clients. International Conference on Security and Privacy in Communication Networks: 10th International ICST Conference, SecureComm 2014, Beijing, 24-26 September 2014, Revised Selected Papers, Part I 305-322. &lt;br /&gt;https://doi.org/10.1007/978-3-319-23829-6_22</mixed-citation></ref><ref id="scirp.102632-ref11"><label>11</label><mixed-citation publication-type="other" xlink:type="simple">Ardjmand, E., et al. (2020) A Hybrid Artificial Neural Network, Genetic Algorithm and Column Generation Heuristic for Minimizing Makespan in Manual Order Picking Operations. Expert Systems with Applications, 159, 113566.  
https://doi.org/10.1016/j.eswa.2020.113566</mixed-citation></ref><ref id="scirp.102632-ref12"><label>12</label><mixed-citation publication-type="other" xlink:type="simple">Veeramsetty, V., Lakshmi, G.V.N. and Jayalaxmi, A. (2012) Optimal Allocation and Contingency Analysis of Embedded Generation Deployment in Distribution Network Using Genetic Algorithm. 2012 International Conference on Computing, Electronics and Electrical Technologies (ICCEET), Kumaracoil, 21-22 March 2012.  
https://doi.org/10.1109/ICCEET.2012.6203763</mixed-citation></ref></ref-list></back></article>