Documentation ¶
Overview ¶
Package bftcosi store a novel way of scaling BFT for high scale internet applications especially blockchains
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Announce ¶
type Announce struct { *cosi.Announcement TYPE RoundType Timeout uint64 }
Announce is the struct used during the announcement phase (of both rounds)
type BFTSignature ¶
type BFTSignature struct { // cosi signature of the commit round. Sig *cosi.Signature Msg []byte // List of peers that did not want to sign. Exceptions []cosi.Exception }
BFTSignature is what a bftcosi protocol outputs. It contains the signature, the message and some possible exceptions.
type ChallengeCommit ¶
type ChallengeCommit struct { TYPE RoundType *cosi.Challenge // Signature is the basic signature Challenge / response Signature *cosi.Signature // Exception is the list of peers that did not want to sign. It's needed for // verifying the signature. It can not be spoofed otherwise the signature // would be wrong. Exceptions []cosi.Exception }
ChallengeCommit is the challenge used by BftCoSi during the "commit" phase. It contains the basic challenge (out of the block we want to sign) + the signature of the "prepare" round. It also contains the exception list coming from the "prepare" phase. This exception list has been collected by the root during the response of the "prepare" phase and broadcast it through the challenge of the "commit". These are needed in order to verify the signature and to see how many peers did not sign. It's not spoofable because otherwise the signature verification will be wrong.
type ChallengePrepare ¶
ChallengePrepare is the challenge used by ByzCoin during the "prepare" phase. It contains the basic challenge plus the message from which the challenge has been generated.
type Commitment ¶
type Commitment struct { TYPE RoundType *cosi.Commitment }
Commitment is the commitment packets that is sent for both rounds
type ProtocolBFTCoSi ¶
type ProtocolBFTCoSi struct { // the node we are represented-in *sda.TreeNodeInstance Msg []byte // contains filtered or unexported fields }
ProtocolBFTCoSi is the main struct for running the protocol
func NewBFTCoSiProtocol ¶
func NewBFTCoSiProtocol(n *sda.TreeNodeInstance, verify VerificationFunction) (*ProtocolBFTCoSi, error)
NewBFTCoSiProtocol returns a new bftcosi struct
func (*ProtocolBFTCoSi) Dispatch ¶
func (bft *ProtocolBFTCoSi) Dispatch() error
Dispatch listens on all channels and implements the sda.ProtocolInstance interface.
func (*ProtocolBFTCoSi) RegisterOnDone ¶
func (bft *ProtocolBFTCoSi) RegisterOnDone(fn func())
RegisterOnDone registers a callback to call when the bftcosi protocols has really finished
func (*ProtocolBFTCoSi) RegisterOnSignatureDone ¶
func (bft *ProtocolBFTCoSi) RegisterOnSignatureDone(fn func(*BFTSignature))
RegisterOnSignatureDone register a callback to call when the bftcosi protocol reached a signature on the block
func (*ProtocolBFTCoSi) Signature ¶
func (bft *ProtocolBFTCoSi) Signature() *BFTSignature
Signature will generate the final signature, the output of the BFTCoSi protocol.
func (*ProtocolBFTCoSi) Start ¶
func (bft *ProtocolBFTCoSi) Start() error
Start will start both rounds "prepare" and "commit" at same time. The "commit" round will wait till the end of the "prepare" round during its challenge phase.
type Response ¶
Response is the struct used by ByzCoin during the response. It contains the response + the basic exception list.
type RoundType ¶
type RoundType int32
RoundType is a type to know if we are in the "prepare" round or the "commit" round
type VerificationFunction ¶
VerificationFunction can be passes to each protocol node. It will be called (in a go routine) during the (start/handle) challenge prepare phase of the protocol