One of the most important aspects of a blockchain is group consensus. All network members form an agreement to provide data verifiability and reliability. There is never one party in control of how data gets inserted or modified on the blockchain. Members form an agreement on any new data by attesting to the validity and correctness of the data.
See Blockchain Key Concepts for an overview on Blockchain consensus algorithms.
STRATO uses the Practical Byzantine Fault Tolerance Consensus Algorithm to achieve network consensus. PBFT requires a ⅔ majority of members to reach consensus. It also is ideal for synchronous networks or possible failures as it allows up to ⅓ of members to temporarily disconnect, be out of sync with each other, or even attest to bad blocks (the member is said to be "byzantine").
PBFT uses a multi-stage communication strategy to allow for a strong network confidence. When a new block is proposed, it is broadcast to the other nodes. After a node receives a proposal for a new block, it validates the contents of the block. A node checks that the block contains valid data. After this is done, the node broadcasts its initial decision to the network. This decision, called the prepare message does not finalize the block. A node then receives incoming prepare messages from the network. After it has received ⅔ votes in agreement, it broadcasts a "commit" message with this decision. Once the initial proposer node receives ⅔ commit messages, the block is confirmed and inserted into chain. At this point the transactions in the block are executed and their results are recorded in the state.
Block creation in the STRATO PBFT system is very simple. A proposer node collects the necessary signatures, nonces, and transactions, and forms a block. It is then broadcast to the network.
Since STRATO networks are formed with trusted parties, there is no need use Proof of Work or Proof of Stake algorithms. Therefore block creation can be done in an efficient manner without needing to worry about token values or mistrusting other members. This allows for several benefits:
- Vastly less power and resources consumption.
- Extremely high transaction throughput (time from transaction creation to transaction being inserted into a block) in a STRATO blockchain network, with a
STRATO PBFT Implementation
In order to facilitate rapid block creation, STRATO enables nodes in a network to Validator and Non-Validator nodes. Typically only a subset of nodes within a network are assigned as validator nodes. This allows for fewer messages sent between nodes, resulting in faster transaction validation and shorter block times. Since a node must communicate with every other validator node, the number of messages within the network that must be sent does not scale linearly with the number of nodes on the network. If every new node on the network were a validator nodes, validation would quickly be an expensive operation. By keeping the number of validator nodes relatively constant despite the growing network size, it ensures the network always performs at an optimal speed.
A Validator Node verifies that the data within a block is correct and subsequently inserts into the Blockchain. It participates in the consensus algorithm with other Validator Nodes to make an agreement on the blockchain state. The Root Node (initial node) of a network is automatically assigned as a validator.
A validator checks the following fields in a block to ensure the proposed block is valid:
- Transaction Root
- Confirms the hash of the transaction root is the same as the hash that this node arrives at after creating its own transaction root from the transactions contained within this block.
- Parent Hash
- The Parent Hash of block
Nmust be the hash of block
- The Parent Hash of block
- Block Proposer
- The Block Proposer must be the same as the proposer recorded in the this node.
- Current Validators
- A block contains the list of current validators on the network; the block's list must be the same as this node's list of proposers.
At any given moment, a single validator node acts as the Proposer Node of the network. The proposer node receives new transactions and creates a block out of that data. Once a full block has been created, it is broadcasted to the rest of the validator nodes for validation. STRATO uses "rounds" to choose new proposers. A round is simply a 10 second period of time for which a given node is the proposer. The current round is recorded by storing the current in a node. In each new round, a new proposer node is selected automatically by the network. Like other mechanisms on the blockchain, the round number and new proposer node must be agreed upon by at least ⅔ of the network's validator nodes to be a valid change.
A Non-Validator Node does not participate in the verification or creation of new blocks. It may send transactions and complete all other normal operations.
Managing Validator Nodes
A user of a validator node can elect to or another validator node. This is accomplished by a validator voting to administer the specified action. A two-thirds majority consensus on the same vote decision is required for the vote's action to be administered. Every block in the chain contains a field for a single vote from a node. Only a proposer node may insert their own vote into a block. Whenever a new block is executed, the vote in the block (if any) is accumulated with the existing votes. This is done by each validator node. Once a ⅔ majority is met for the vote, than the network will execute that vote, either "registering" the new node as a validator, or removing it as one.
A node wants to add a new node as a validator. There are currently 10 Validator Nodes on the network. This node issues an "add" vote for the new node. The user of the first node then tells the users of the rest of the network to cast a vote. Each node within the network then casts their vote (or chooses to withhold their vote). After each validator node has been a proposer at least once, all of the votes will have been received. If at any point the tally of "add" votes for the new node reaches 7 (⅔ of 10), the new node will be added as a validator, resulting in 11 validator nodes in the network.
Issuing a Vote from a Node
To cast a vote for a validator node, first retrieve the address of the node using the
get-address tool from the node being voted on:
The address of the current node.
Use the following command line tool from the STRATO program:
- The address of the new node to add.
- A comma-separated list of the current validator nodes' IP addresses and port.
- STRATO uses port 8080 to communicate with peers unless configured otherwise.
- The listed nodes should have the address of current node (where the command is being executed) in the
- A counter used to ensure the same vote from a node is never duplicated. The nonce for a given vote must be greater than the previous greatest nonce. The nonce is shared amongst the entire network.
- Sets the vote direction to remove the specified node.
- Vote direction will be to add if not provided.
- Enables network communication over the https protocol.
Vote in node as a validator to a network with two other existing validators.
./strato --blockstanbul-vote --recipient=841de5684asde7592ac3be11a3845cedaa096f2f \ --nodes=188.8.131.52:8080,184.108.40.206:8080 --nonce=4 --https
A new vote will have been added from the current node.
submitting a vote into pbft consensus + blockstanbul-vote --recipient=841de5684asde7592ac3be11a3845cedaa096f2f --nodes=220.127.116.11:8080,18.104.22.168:8080 --nonce=4 --votingdir=false Sender (admin node) address: ab98ff84fe4d33136ac1b828b09a074af86a455a Starting nonce: 4 Sending the vote to the following nodes: ["22.214.171.124:8080" , "126.96.36.199:8080"]
It is best practice to wait 10 seconds between each vote command to ensure that previous vote was executed properly.
You may confirm that a validator was added after a deciding vote by checking the
strato-sequencer logs in the strato_1 container of STRATO.
In STRATO Getting Started versions prior to 3.2.0, the following command could be used to obtain the list of validators:
docker exec -i strato_strato_1 bash -c "tail -n 100 logs/strato-sequencer | grep showctx/validators | tail -n 1 | cut -d '|' -f 4"
BlockApps uses the term "Blockstanbul" as a play on words of the Istanbul BFT Consensus Algorithm. Blockstanbul is BlockApps implementation of the same algorithm.