algorand

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: GPL-3.0, LGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrMsgTooLarge = iota
	ErrDecode
	ErrInvalidMsgCode
	ErrProtocolVersionMismatch
	ErrNoStatusMsg
	ErrExtraHandshakeMsg
	ErrSuspendedPeer
)
View Source
const ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message
View Source
const ProtocolName = "algorand"
View Source
const Version = 0x1

Variables

View Source
var ProtocolLengths = []uint64{16}

Number of implemented message corresponding to different protocol versions.

View Source
var ProtocolVersions = []uint{Version}

Supported versions of the eth protocol (first is primary).

Functions

func EidosBlockReward

func EidosBlockReward(num *big.Int, config *params.ChainConfig) *big.Int

Types

type Algorand

type Algorand struct {
	// contains filtered or unexported fields
}

Algorand is a consensus engine based byzantine problem

func New

func New(ctx *node.ServiceContext, chainConfig *params.ChainConfig, db ethdb.Database) *Algorand

func (*Algorand) APIs

func (ar *Algorand) APIs(chain consensus.ChainReader) []rpc.API

APIs returns the RPC APIs this consensus engine provides.

func (*Algorand) Author

func (ar *Algorand) Author(header *types.Header) (common.Address, error)

func (*Algorand) CalcDifficulty

func (ar *Algorand) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int

CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty that a new block should have.

func (*Algorand) Close

func (ar *Algorand) Close() error

Close terminates any background threads maintained by the consensus engine

func (*Algorand) Coinbase

func (ar *Algorand) Coinbase(header *types.Header) common.Address

func (*Algorand) Finalize

func (ar *Algorand) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction,
	uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)

Finalize runs any post-transaction state modifications (e.g. block rewards) and assembles the final block. Note: The block header and state database might be updated to reflect any consensus rules that happen at finalization (e.g. block rewards).

func (*Algorand) Prepare

func (ar *Algorand) Prepare(chain consensus.ChainReader, header *types.Header) error

Prepare initializes the consensus fields of a block header according to the rules of a particular engine. The changes are executed inline.

func (*Algorand) Seal

func (ar *Algorand) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error

Seal generates a new block for the given input block with the local miner's seal place on top.

func (*Algorand) SealHash

func (ar *Algorand) SealHash(header *types.Header) common.Hash

func (*Algorand) VerifyHeader

func (ar *Algorand) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error

VerifyHeader checks whether a header conforms to the consensus rules of a given engine. Verifying the seal may be done optionally here, or explicitly via the VerifySeal method.

func (*Algorand) VerifyHeaders

func (ar *Algorand) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)

VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers concurrently. The method returns a quit channel to abort the operations and a results channel to retrieve the async verifications (the order is that of the input slice).

func (*Algorand) VerifySeal

func (ar *Algorand) VerifySeal(chain consensus.ChainReader, header, parent *types.Header) error

VerifySeal checks whether the crypto seal on a header is valid according to the consensus rules of the given engine.

func (*Algorand) VerifyUncles

func (ar *Algorand) VerifyUncles(chain consensus.ChainReader, block *types.Block) error

VerifyUncles verifies that the given block's certification

type Miner

type Miner struct {
	// contains filtered or unexported fields
}

Miner creates blocks and make consensus using Algorand and gossip p2p.

func NewMiner

func NewMiner(eth core.Backend, config *params.ChainConfig, mux *event.TypeMux, engine consensus.Engine, ephemeralKeyDir string, gasFloor, gasCeil uint64) *Miner

func (*Miner) HashRate

func (m *Miner) HashRate() (tot uint64)

func (*Miner) Mining

func (m *Miner) Mining() bool

func (*Miner) Pending

func (m *Miner) Pending() (*types.Block, *state.StateDB)

Pending returns the currently pending block and associated state.

func (*Miner) PendingBlock

func (m *Miner) PendingBlock() *types.Block

PendingBlock returns the currently pending block.

Note, to access both the pending block and the pending state simultaneously, please use Pending(), as the pending state can change between multiple method calls

func (*Miner) Protocols

func (m *Miner) Protocols() []p2p.Protocol

func (*Miner) SetEtherbase

func (m *Miner) SetEtherbase(addr common.Address)

func (*Miner) SetExtra

func (m *Miner) SetExtra(extra []byte) error

func (*Miner) SetRecommitInterval

func (m *Miner) SetRecommitInterval(interval time.Duration)

func (*Miner) Start

func (m *Miner) Start(coinbase common.Address)

func (*Miner) StartService

func (m *Miner) StartService()

func (*Miner) Stop

func (m *Miner) Stop()

func (*Miner) StopService

func (m *Miner) StopService()

type NodeInfo

type NodeInfo struct {
}

type PeerInfo

type PeerInfo struct {
	Version uint32
	Height  uint64
	Round   uint32
}

type ProtocolManager

type ProtocolManager struct {
	SubProtocols []p2p.Protocol
	// contains filtered or unexported fields
}

func NewProtocolManager

func NewProtocolManager(eth core.Backend, config *params.ChainConfig, mux *event.TypeMux, engine consensus.Engine, ephemeralKeyDir string, gasFloor, gasCeil uint64) *ProtocolManager

func (*ProtocolManager) Broadcast

func (pm *ProtocolManager) Broadcast(code uint64, data interface{})

func (*ProtocolManager) GetLeaderProposalValue

func (pm *ProtocolManager) GetLeaderProposalValue(height uint64, round uint32) *core.ProposalLeaderData

func (*ProtocolManager) GetProposalBlock

func (pm *ProtocolManager) GetProposalBlock(height uint64, value common.Hash) *core.ProposalBlockData

func (*ProtocolManager) GossipInterval

func (pm *ProtocolManager) GossipInterval() time.Duration

func (*ProtocolManager) HR

func (pm *ProtocolManager) HR() (uint64, uint32)

func (*ProtocolManager) Mining

func (pm *ProtocolManager) Mining() bool

func (*ProtocolManager) NodeInfo

func (pm *ProtocolManager) NodeInfo() *NodeInfo

NodeInfo returns metadata about the host node

func (*ProtocolManager) Publish

func (pm *ProtocolManager) Publish(marker []byte, msgCode uint64, data interface{})

func (*ProtocolManager) Request

func (pm *ProtocolManager) Request(marker []byte, blockMarker common.Hash)

func (*ProtocolManager) RoundVoteSet

func (pm *ProtocolManager) RoundVoteSet(height uint64, round uint32) *core.RoundVoteSet

func (*ProtocolManager) Stake

func (pm *ProtocolManager) Stake() uint64

func (*ProtocolManager) Start

func (pm *ProtocolManager) Start()

func (*ProtocolManager) StartMining

func (pm *ProtocolManager) StartMining()

Start only starts miner

func (*ProtocolManager) Stop

func (pm *ProtocolManager) Stop()

func (*ProtocolManager) StopMining

func (pm *ProtocolManager) StopMining()

Stop only stops miner

func (*ProtocolManager) Sub

func (pm *ProtocolManager) Sub(marker []byte, duration time.Duration)

func (*ProtocolManager) UnSub

func (pm *ProtocolManager) UnSub(marker []byte)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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