Documentation ¶
Index ¶
- Constants
- Variables
- func EidosBlockReward(num *big.Int, config *params.ChainConfig) *big.Int
- type Algorand
- func (ar *Algorand) APIs(chain consensus.ChainReader) []rpc.API
- func (ar *Algorand) Author(header *types.Header) (common.Address, error)
- func (ar *Algorand) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (ar *Algorand) Close() error
- func (ar *Algorand) Coinbase(header *types.Header) common.Address
- func (ar *Algorand) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (ar *Algorand) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (ar *Algorand) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (ar *Algorand) SealHash(header *types.Header) common.Hash
- func (ar *Algorand) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (ar *Algorand) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (ar *Algorand) VerifySeal(chain consensus.ChainReader, header, parent *types.Header) error
- func (ar *Algorand) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
- type Miner
- func (m *Miner) HashRate() (tot uint64)
- func (m *Miner) Mining() bool
- func (m *Miner) Pending() (*types.Block, *state.StateDB)
- func (m *Miner) PendingBlock() *types.Block
- func (m *Miner) Protocols() []p2p.Protocol
- func (m *Miner) SetEtherbase(addr common.Address)
- func (m *Miner) SetExtra(extra []byte) error
- func (m *Miner) SetRecommitInterval(interval time.Duration)
- func (m *Miner) Start(coinbase common.Address)
- func (m *Miner) StartService()
- func (m *Miner) Stop()
- func (m *Miner) StopService()
- type NodeInfo
- type PeerInfo
- type ProtocolManager
- func (pm *ProtocolManager) Broadcast(code uint64, data interface{})
- func (pm *ProtocolManager) GetLeaderProposalValue(height uint64, round uint32) *core.ProposalLeaderData
- func (pm *ProtocolManager) GetProposalBlock(height uint64, value common.Hash) *core.ProposalBlockData
- func (pm *ProtocolManager) GossipInterval() time.Duration
- func (pm *ProtocolManager) HR() (uint64, uint32)
- func (pm *ProtocolManager) Mining() bool
- func (pm *ProtocolManager) NodeInfo() *NodeInfo
- func (pm *ProtocolManager) Publish(marker []byte, msgCode uint64, data interface{})
- func (pm *ProtocolManager) Request(marker []byte, blockMarker common.Hash)
- func (pm *ProtocolManager) RoundVoteSet(height uint64, round uint32) *core.RoundVoteSet
- func (pm *ProtocolManager) Stake() uint64
- func (pm *ProtocolManager) Start()
- func (pm *ProtocolManager) StartMining()
- func (pm *ProtocolManager) Stop()
- func (pm *ProtocolManager) StopMining()
- func (pm *ProtocolManager) Sub(marker []byte, duration time.Duration)
- func (pm *ProtocolManager) UnSub(marker []byte)
Constants ¶
const ( ErrMsgTooLarge = iota ErrDecode ErrInvalidMsgCode ErrProtocolVersionMismatch ErrNoStatusMsg ErrExtraHandshakeMsg ErrSuspendedPeer )
const ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message
const ProtocolName = "algorand"
const Version = 0x1
Variables ¶
var ProtocolLengths = []uint64{16}
Number of implemented message corresponding to different protocol versions.
var ProtocolVersions = []uint{Version}
Supported versions of the eth protocol (first is primary).
Functions ¶
func EidosBlockReward ¶
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) 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) 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 ¶
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) 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 ¶
VerifySeal checks whether the crypto seal on a header is valid according to the consensus rules of the given engine.
func (*Algorand) VerifyUncles ¶
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 (*Miner) PendingBlock ¶
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) SetEtherbase ¶
func (*Miner) SetRecommitInterval ¶
func (*Miner) StartService ¶
func (m *Miner) StartService()
func (*Miner) StopService ¶
func (m *Miner) StopService()
type ProtocolManager ¶
type ProtocolManager struct { SubProtocols []p2p.Protocol // contains filtered or unexported fields }
func NewProtocolManager ¶
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) UnSub ¶
func (pm *ProtocolManager) UnSub(marker []byte)