Skip to content

PBFT Consensus

We allow users to select between two consensus algorithms based on their network performance requirements. We offer PBFT as a configurable option (Practical Byzantine Fault Tolerance) and default POW (Proof-of-Work).

What is PBFT?

Blockchain consensus mechanisms are designed to be Byzantine Fault Tolerant, which means that a majority of actors can reach an agreement on whether or not the state of a network is reliable. PBFT is faster than Proof of Work (our current consensus algorithm), and is designed for permissioned networks where the identities of the participants are known to others.

Configure PBFT

In strato-getting-started run ./strato.sh --keygen --{count}, where count is the number of private key and address pairs to generate:

$ ./strato.sh keygen --3

It returns all the addresses that should be supplied as the --validators flag to the validators environment variable in ./strato.sh, and the privatekey should be used as the blockstanbulPrivateKey environment variable for ./strato.sh

("NODEKEY","--validator")

("1LIvpddQGiWgZ6fGpGWtSmdad7+PQwjPiY9NzEPGeS0=",
"3691c53a1d701d685f5ae733f2db65f77548b921")
("whsKIbsqhs6NNe9gB1h3voXuEbvccC+sUlvnn3lDgmA=",
"5bf36705eb469e1e064b932d9529bbce798b2cfd")
("x93Pwq0Vca+FCbueVEHJgTqi2eceH+uG+khG1G24WvE=",
"39e7ac367acf5d00f882562956ba221da9214a92")

"All validators:"

[
    "3691c53a1d701d685f5ae733f2db65f77548b921",
    "44f015d874e0ac281e38368d8ed1d540c9a9330b",
    "39e7ac367acf5d00f882562956ba221da9214a92",
]

From our JSON blob, we can supply one of the private keys to blockstanbulPrivateKey, and we can supply each validator to validators. The startup command should look something like this:

blockstanbulPrivateKey="1LIvpddQGiWgZ6fGpGWtSmdad7
+PQwjPiY9NzEPGeS0="
evmDebugMode=true
tmpblockstanbul=true \ 
validators='

[
    "3691c53a1d701d685f5ae733f2db65f77548b921",
    "44f015d874e0ac281e38368d8ed1d540c9a9330b",
    "39e7ac367acf5d00f882562956ba221da9214a92",
]' 

./strato.sh

Once this is run, our node will be running PBFT with the provided validator addresses as validators in each voting round.

Consensus Monitoring API (Coming Soon!)

Users can view the current vote round through a dedicated API route:

GET /blockstanbul/validators which returns a list of validator addresses

GET /blockstanbul/config which returns JSON with the initial config:

{
    "epoch_length": 1000,
    "request_timeout": 1000,
    "block_period": 1000,
}

GET /blockstanbul/status which returns JSON describing the current state of consensus:

Latest messages received per peer
Latest message sent
Block hash of block being considered
Current state (NewRound | Preprepared | Prepared | Committed)
Round number
Sequence number