Documentation
¶
Index ¶
- func Mod(data []byte, mod int64) int64
- func RandaoID(height uint64) string
- func Uint64ToBytes(i uint64) []byte
- type Attestation
- type Attestations
- type Block
- type Hash
- type HashRequest
- type Message
- type Network
- type Node
- type Randao
- type RandaoStatus
- type RawMessage
- type SeedRequest
- type Server
- type ServerConfig
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Uint64ToBytes ¶
Types ¶
type Attestation ¶
type Attestations ¶
type Attestations struct { Attestations map[[32]byte]Attestation // contains filtered or unexported fields }
func NewAttestations ¶
func NewAttestations() Attestations
func (*Attestations) Add ¶
func (a *Attestations) Add(attestation Attestation)
func (*Attestations) Size ¶
func (a *Attestations) Size() int
type Block ¶
type Block struct { Hash Hash HexHash string Height uint64 PrevHash Hash HexPrevHash string TimeStamp time.Time Data []Message Proposer Validator Signature []byte Attestations Attestations `json:"-"` // contains filtered or unexported fields }
func (*Block) ComputeHash ¶
type HashRequest ¶
type Network ¶
type Network struct { // TotalStake uint64 Validators []Validator }
func (*Network) NewServer ¶
func (n *Network) NewServer(config ServerConfig) *Server
type Node ¶
type Node struct { PublicKey ed25519.PublicKey PrivateKey ed25519.PrivateKey Head *Block Blocks []*Block Messages []Message // contains filtered or unexported fields }
func NewNodeWithKey ¶
func (*Node) AddMessage ¶
func (*Node) VerifyBlock ¶
type Randao ¶
type Randao struct { ID string OnFinish func(result []byte) Status RandaoStatus Validators [][32]byte Hashs map[[32]byte][]byte Seeds map[[32]byte][]byte Result []byte // contains filtered or unexported fields }
func (*Randao) AddHash ¶
func (r *Randao) AddHash(req HashRequest) error
func (*Randao) AddSeed ¶
func (r *Randao) AddSeed(req SeedRequest) error
type RandaoStatus ¶
type RandaoStatus int64
const ( RandaoStatusHash RandaoStatus = iota RandaoStatusSeed RandaoStatusFinished )
type RawMessage ¶
type RawMessage []byte
func (RawMessage) Data ¶
func (m RawMessage) Data() []byte
func (RawMessage) Verify ¶
func (m RawMessage) Verify() bool
type SeedRequest ¶
type Server ¶
type Server struct { Config ServerConfig *Node Randaos map[string]*Randao NextProposer Validator // contains filtered or unexported fields }
func (*Server) OnRandaoFinish ¶
type ServerConfig ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.