bihs differs from hotstuff in two aspects:
- the votes are splitted into
(height, view)
like pbft - the possible block for each height is bivalent, either the one proposed by current leader(which can be calculated after the confirmation of the previous block), or a deterministic empty block.
So bihs doesn't have the requirement to know leader for future block, it's as safe as pbft, while the complexity is still O(n)
.
var (
store StateDB
p2p P2P
conf Config
)
# all you need to do is to provide the implementations for Block/StateDB/P2P interfaces
store = ...
p2p = ...
hs := New(store , p2p , conf)
hs.Start()
# after this, you can propose blocks when it's your turn
hs.Propose(someBlk)
# you can also wait for the confirmation of some block easily
hs.Wait(context.Background(), height)