Package naive
import "github.com/SmartBFT-Go/consensus/examples/naive_chain"
- Overview
- Index
- type Block
- type BlockData
- func BlockDataFromBytes(rawBlock []byte) *BlockData
- func (b BlockData) ToBytes() []byte
- type BlockHeader
- func BlockHeaderFromBytes(rawHeader []byte) *BlockHeader
- func (header BlockHeader) ToBytes() []byte
- type Chain
- func NewChain(id uint64, in Ingress, out Egress, logger smart.Logger, opts NetworkOptions, testDir string) *Chain
- func (chain *Chain) Listen() Block
- func (chain *Chain) Order(txn Transaction) error
- type Egress
- type FwdMessage
- func (*FwdMessage) Descriptor() ([]byte, []int)
- func (m *FwdMessage) GetPayload() []byte
- func (m *FwdMessage) GetSender() uint64
- func (*FwdMessage) ProtoMessage()
- func (m *FwdMessage) Reset()
- func (m *FwdMessage) String() string
- func (m *FwdMessage) XXX_DiscardUnknown()
- func (m *FwdMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FwdMessage) XXX_Merge(src proto.Message)
- func (m *FwdMessage) XXX_Size() int
- func (m *FwdMessage) XXX_Unmarshal(b []byte) error
- type Ingress
- type NetworkOptions
- type Node
- func NewNode(id uint64, in Ingress, out Egress, deliverChan chan<- *Block, logger smart.Logger, opts NetworkOptions, testDir string) *Node
- func (n *Node) AssembleProposal(metadata []byte, requests [][]byte) bft.Proposal
- func (n *Node) Deliver(proposal bft.Proposal, signature []bft.Signature) bft.Reconfig
- func (n *Node) Nodes() []uint64
- func (*Node) RequestID(req []byte) bft.RequestInfo
- func (*Node) RequestsFromProposal(proposal bft.Proposal) []bft.RequestInfo
- func (n *Node) SendConsensus(targetID uint64, message *smartbftprotos.Message)
- func (n *Node) SendTransaction(targetID uint64, request []byte)
- func (*Node) Sign(msg []byte) []byte
- func (n *Node) SignProposal(bft.Proposal) *bft.Signature
- func (n *Node) Start()
- func (n *Node) Stop()
- func (*Node) Sync() bft.SyncResponse
- func (*Node) VerificationSequence() uint64
- func (*Node) VerifyConsenterSig(_ bft.Signature, prop bft.Proposal) error
- func (*Node) VerifyProposal(proposal bft.Proposal) ([]bft.RequestInfo, error)
- func (*Node) VerifyRequest(val []byte) (bft.RequestInfo, error)
- func (*Node) VerifySignature(signature bft.Signature) error
- type Transaction
- func TransactionFromBytes(rawTxn []byte) *Transaction
- func (txn Transaction) ToBytes() []byte
Package files
chain.go
node.go
test_message.pb.go
type Block struct {
Sequence uint64
PrevHash string
Transactions []Transaction
}
type BlockData struct {
Transactions [][]byte
}
func BlockDataFromBytes(rawBlock []byte) *BlockData
func (BlockData) ToBytes
¶
func (b BlockData) ToBytes() []byte
type BlockHeader struct {
Sequence int64
PrevHash string
DataHash string
}
func BlockHeaderFromBytes(rawHeader []byte) *BlockHeader
func (header BlockHeader) ToBytes() []byte
type Chain struct {
}
func NewChain(id uint64, in Ingress, out Egress, logger smart.Logger, opts NetworkOptions, testDir string) *Chain
func (*Chain) Listen
¶
func (chain *Chain) Listen() Block
func (*Chain) Order
¶
func (chain *Chain) Order(txn Transaction) error
type Egress map[int]chan<- proto.Message
type FwdMessage struct {
Sender uint64 `protobuf:"varint,1,opt,name=sender,proto3" json:"sender,omitempty"`
Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*FwdMessage) Descriptor() ([]byte, []int)
func (m *FwdMessage) GetPayload() []byte
func (m *FwdMessage) GetSender() uint64
func (*FwdMessage) ProtoMessage()
func (*FwdMessage) Reset
¶
func (m *FwdMessage) Reset()
func (*FwdMessage) String
¶
func (m *FwdMessage) String() string
func (m *FwdMessage) XXX_DiscardUnknown()
func (m *FwdMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (m *FwdMessage) XXX_Merge(src proto.Message)
func (*FwdMessage) XXX_Size
¶
func (m *FwdMessage) XXX_Size() int
func (m *FwdMessage) XXX_Unmarshal(b []byte) error
type Ingress map[int]<-chan proto.Message
type NetworkOptions struct {
NumNodes int
BatchSize uint64
BatchTimeout time.Duration
}
type Node struct {
}
func NewNode(id uint64, in Ingress, out Egress, deliverChan chan<- *Block, logger smart.Logger, opts NetworkOptions, testDir string) *Node
func (n *Node) AssembleProposal(metadata []byte, requests [][]byte) bft.Proposal
func (n *Node) Deliver(proposal bft.Proposal, signature []bft.Signature) bft.Reconfig
func (*Node) Nodes
¶
func (n *Node) Nodes() []uint64
func (*Node) RequestID(req []byte) bft.RequestInfo
func (*Node) RequestsFromProposal(proposal bft.Proposal) []bft.RequestInfo
func (n *Node) SendConsensus(targetID uint64, message *smartbftprotos.Message)
func (n *Node) SendTransaction(targetID uint64, request []byte)
func (*Node) Sign
¶
func (*Node) Sign(msg []byte) []byte
func (n *Node) SignProposal(bft.Proposal) *bft.Signature
func (*Node) Start
¶
func (n *Node) Start()
func (*Node) Stop
¶
func (n *Node) Stop()
func (*Node) Sync
¶
func (*Node) Sync() bft.SyncResponse
func (*Node) VerificationSequence() uint64
func (*Node) VerifyConsenterSig(_ bft.Signature, prop bft.Proposal) error
func (*Node) VerifyProposal(proposal bft.Proposal) ([]bft.RequestInfo, error)
func (*Node) VerifyRequest(val []byte) (bft.RequestInfo, error)
func (*Node) VerifySignature(signature bft.Signature) error
type Transaction struct {
ClientID string
ID string
}
func TransactionFromBytes(rawTxn []byte) *Transaction
func (Transaction) ToBytes
¶
func (txn Transaction) ToBytes() []byte