core

package
v0.0.0-...-7f98e96 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 6 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockHash

func BlockHash(b *Block) []byte

BlockHash computes the hash of a given block. For obvious reasons this does not include the signature.

Types

type Block

type Block struct {
	Preblock
	ID             uint64
	AdditionalData []Data
	Signature      *multi.Signature
}

Block is a preblock that has been processed and signed by committee members. It is the final building block of the blockchain produced by the protocol.

func ToBlock

func ToBlock(pb *Preblock, id uint64, additionalData []Data) *Block

ToBlock creates a block from a given preblock and additional data.

type BlockSink

type BlockSink chan<- *Block

BlockSink is an output channel for the blockchain produced.

type BlockSource

type BlockSource <-chan *Block

BlockSource is a source of blocks.

type BuildInterpreter

type BuildInterpreter func(config io.Reader, log zerolog.Logger) (Interpreter, BlockSource, error)

BuildInterpreter using the given config and logger.

type BuildOrderer

type BuildOrderer func(config io.Reader, log zerolog.Logger) (Orderer, PreblockSource, error)

BuildOrderer using the given config and logger.

type BuildValidator

type BuildValidator func(config io.Reader, log zerolog.Logger) (Validator, DataSource, error)

BuildValidator using the given config and logger.

type Data

type Data []byte

Data is a packet of binary data that is embedded in a single unit.

type DataSource

type DataSource interface {
	GetData() Data
}

DataSource is a provider of Data.

type Interpreter

type Interpreter interface {
	Service
	Set(PreblockSource)
}

Interpreter represents a process for interpreting preblocks into blocks.

type Orderer

type Orderer interface {
	Service
	Set(DataSource)
}

Orderer represents a process used for ordering data into preblocks.

type Preblock

type Preblock struct {
	Data        []Data
	RandomBytes []byte
}

Preblock is a set of Data from units contained in one timing round (block) together with some RandomBytes produced by common randomness.

func NewPreblock

func NewPreblock(data []Data, randomBytes []byte) *Preblock

NewPreblock constructs a preblock from given data and randomBytes.

type PreblockSink

type PreblockSink chan<- *Preblock

PreblockSink is a channel on which preblocks are written.

type PreblockSource

type PreblockSource <-chan *Preblock

PreblockSource is a channel providing new preblocks.

type Service

type Service interface {
	Start() error
	Stop()
}

Service that can be started and stopped.

type Validator

type Validator interface {
	Service
	Set(BlockSource)
}

Validator represents a process that accepts data and pushes it to the orderer, while waiting for blocks from the interpreter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL