Documentation ΒΆ
Overview ΒΆ
Package hyperdrive a high-level package for running multiple instances of the Hyperdrive consensus algorithm for over multiple shards. The Hyperdrive interface is the main entry point for users.
Index ΒΆ
- Variables
- type Block
- type BlockIterator
- type BlockPlan
- type BlockState
- type BlockStorage
- type BlockTxs
- type Blockchain
- type Blocks
- type Broadcaster
- type Hash
- type Hashes
- type Height
- type Hyperdrive
- type Message
- type Messages
- type Observer
- type Options
- type Process
- type ProcessState
- type ProcessStorage
- type Replica
- type Replicas
- type Round
- type Shard
- type Shards
- type Signatories
- type Signatory
- type Signature
- type Signatures
- type Timestamp
- type Validator
Constants ΒΆ
This section is empty.
Variables ΒΆ
var ( StandardBlockKind = block.Standard RebaseBlockKind = block.Rebase BaseBlockKind = block.Base NewBlock = block.New NewBlockHeader = block.NewHeader )
var ( // NewSignatory returns a Signatory from an ECDSA public key by serializing // the ECDSA public key into bytes and hashing it with SHA256. NewSignatory = id.NewSignatory )
Functions ΒΆ
This section is empty.
Types ΒΆ
type Block ΒΆ added in v0.2.0
A Block is an atomic unit of data upon which consensus is reached. Everything upon which consensus is needed should be put into a block, and consensus can only be reached on a block by block basis (there is no finer-grained way to express consensus).
type BlockIterator ΒΆ added in v0.2.0
type BlockIterator = replica.BlockIterator
type BlockPlan ΒΆ added in v0.3.0
A BlockPlan represents application-specific data that is needed to execute the transactions in a block. No assumptions are made about the format of this plan.
type BlockState ΒΆ added in v0.2.0
The BlockState represents application-specific state.
type BlockStorage ΒΆ added in v0.2.0
type BlockStorage = replica.BlockStorage
type BlockTxs ΒΆ added in v0.3.0
BlockTxs represent the application-specific transactions that are being proposed as part of a block. An application that wishes to achieve consensus on activity within the application should represent this activity as transactions, serialise them into bytes, and put them into a block. No assumptions are made about the format of these transactions.
type Blockchain ΒΆ added in v0.2.0
type Blockchain = process.Blockchain
type Broadcaster ΒΆ added in v0.2.0
type Broadcaster = replica.Broadcaster
type Hash ΒΆ added in v0.2.0
A Hash is the `[32]byte` output of a hashing function. Hyperdrive uses SHA256 for hashing.
type Hyperdrive ΒΆ
type Hyperdrive interface { Start() Rebase(sigs Signatories) HandleMessage(message Message) }
Hyperdrive manages multiple `Replicas` from different `Shards`.
func New ΒΆ
func New(options Options, pStorage ProcessStorage, blockStorage BlockStorage, blockIterator BlockIterator, validator Validator, observer Observer, broadcaster Broadcaster, shards Shards, privKey ecdsa.PrivateKey) Hyperdrive
New returns a new `Hyperdrive` instance that wraps multiple replica instances. One replica instance will be created per Shard, but all replica instances will use the same interfaces and private key. Replicas will not be created for shards for which the replica is not a signatory. This means that rebasing can shuffle Signatories, but it cannot introduce new ones or remove existing ones (this will be supported in future updates).
hyper := hyperdrive.New( hyperdrive.Options{}, pStorage, bStorage, bIter, validator, observer, broadcaster, shards, privKey, ) hyper.Start() for { select { case <-ctx.Done(): break case message, ok := <-messagesFromNetwork: if !ok { break } hyper.HandleMessage(message) } }
type ProcessState ΒΆ added in v0.2.0
type ProcessStorage ΒΆ added in v0.2.0
type ProcessStorage = replica.ProcessStorage
type Round ΒΆ added in v0.2.0
The Round in a consensus algorithm at which a block was proposed/committed.
type Signatories ΒΆ added in v0.2.0
type Signatories = id.Signatories
Signatories is a wrapper around the `[]Signatory` type.
type Signatory ΒΆ added in v0.2.0
A Signatory is the `[32]byte` resulting from hashing an ECDSA public key. It represents the public identity of a content author and can be used to authenticate content that has been signed.
type Signature ΒΆ added in v0.2.0
A Signature is the `[65]byte` output of an ECDSA signing algorithm. Hyperdrive uses the secp256k1 curve for ECDSA signing.
type Signatures ΒΆ added in v0.2.0
type Signatures = id.Signatures
Signatures is a wrapper around the `[]Signature` type.