github.com/klaytn/klaytn@v1.12.1/consensus/clique/doc.go (about)

     1  // Copyright 2018 The klaytn Authors
     2  // This file is part of the klaytn library.
     3  //
     4  // The klaytn library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The klaytn library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the klaytn library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  /*
    18  Package clique implements PoA (Proof of Authority) consensus engine which is mainly for private chains.
    19  
    20  Consensus Engine Overview
    21  
    22  In clique, only pre-selected nodes can propose a block. The list of these nodes are described in the header's extra field and the list can be changed by calling Propose() API.
    23  
    24  The sequence of proposers is decided by the block number and the number of nodes which can propose a block. If a proposer proposes a block in its turn (in-turn), it will have a blockscore(formerly known as difficulty) of 2.
    25  If a proposer proposes a block in other node's turn (out-of-turn), it will have a blockscore of 1.
    26  
    27  If an in-turn proposer didn't propose a block for some time, other nodes start to propose their block with a blockscore of 1. So the block generation can continue.
    28  But there can be a fork because several nodes can propose a block at the same time.
    29  In this case, a block reorganization will happen based on total blockscore (the sum of all blockscore from the genesis block to the current one).
    30  */
    31  package clique