Documentation ¶
Index ¶
- Variables
- func CalcDifficulty(config *entity.ChainConfig, time uint64, parent *block2.Header) *big.Int
- func CreateOctell(chainConfig *entity.ChainConfig, config *Config) consensus.Engine
- func SeedHash(block uint64) []byte
- type API
- type Config
- type Mode
- type Octell
- func (o *Octell) APIs(chain consensus.ChainHeaderReader) []rpc.API
- func (o *Octell) Author(header *block2.Header) (entity.Address, error)
- func (octell *Octell) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *block2.Header) *big.Int
- func (o *Octell) Close() error
- func (octell *Octell) Finalize(chain consensus.ChainHeaderReader, header *block2.Header, ...)
- func (o *Octell) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *block2.Header, ...) (*block2.Block, error)
- func (octell *Octell) Prepare(chain consensus.ChainHeaderReader, header *block2.Header) error
- func (o *Octell) Seal(chain consensus.ChainHeaderReader, b *block2.Block, ...) error
- func (octell *Octell) SealHash(header *block2.Header) (hash entity.Hash)
- func (octell *Octell) SetThreads(threads int)
- func (o *Octell) StopRemoteSealer() error
- func (o *Octell) VerifyHeader(chain consensus.ChainHeaderReader, header *block2.Header, seal bool) error
- func (o *Octell) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*block2.Header, seals []bool) (chan<- struct{}, <-chan error)
- type OctellStart
Constants ¶
This section is empty.
Variables ¶
var ( FrontierBlockReward = big.NewInt(5e+18) // wei成功挖掘区块的区块奖励 ByzantiumBlockReward = big.NewInt(3e+18) // wei成功从拜占庭向上挖掘一个区块的区块奖励 ConstantinopleBlockReward = big.NewInt(2e+18) // wei成功从君士坦丁堡向上挖掘一个区块的区块奖励 )
var ErrInvalidDumpMagic = errors.New("invalid dump magic")
Functions ¶
func CalcDifficulty ¶
CalcDifficulty是难度调整算法。它返回在给定父块的时间和难度的时间创建新块时应具有的难度。
func CreateOctell ¶
func CreateOctell(chainConfig *entity.ChainConfig, config *Config) consensus.Engine
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API exposes ethash related methods for the RPC interface.
func (*API) GetWork ¶
GetWork returns a work package for external miner.
The work package consists of 3 strings:
result[0] - 32 bytes hex encoded current block header pow-hash result[1] - 32 bytes hex encoded seed hash used for DAG result[2] - 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty result[3] - hex encoded block number
func (*API) SubmitHashrate ¶
SubmitHashrate can be used for remote miners to submit their hash rate. This enables the node to report the combined hash rate of all miners which submit work through this node.
It accepts the miner hash rate and an identifier which must be unique between nodes.
func (*API) SubmitWork ¶
SubmitWork can be used by external miner to submit their POW solution. It returns an indication if the work was accepted. Note either an invalid solution, a stale work a non-existent work will return false.
type Config ¶
type Config struct { CacheDir string CachesInMem int CachesOnDisk int CachesLockMmap bool DatasetDir string DatasetsInMem int DatasetsOnDisk int DatasetsLockMmap bool PowMode Mode // 设置后,远程密封器发送的通知将是块头JSON对象,而不是工作包数组。 NotifyFull bool }
Config是octell的配置参数。
type Octell ¶
type Octell struct { Config *Config //`autoInjectLang:"octell.Config"` //启动项配置 // contains filtered or unexported fields }
Octell是一个基于实现Octell算法的工作证明的共识引擎。
func (*Octell) APIs ¶
func (o *Octell) APIs(chain consensus.ChainHeaderReader) []rpc.API
API实现共识。引擎,返回面向用户的RPC API。
func (*Octell) CalcDifficulty ¶
func (octell *Octell) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *block2.Header) *big.Int
CalcDifficulty是难度调整算法。它返回在给定父块的时间和难度的时间创建新块时应具有的难度。
func (*Octell) Finalize ¶
func (octell *Octell) Finalize(chain consensus.ChainHeaderReader, header *block2.Header, ob *operationdb.OperationDB, txs []*block2.Transaction, uncles []*block2.Header)
Finalize实现共识。引擎,累积积木和叔叔奖励,设置标题的最终状态
func (*Octell) FinalizeAndAssemble ¶
func (o *Octell) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *block2.Header, ob *operationdb.OperationDB, txs []*block2.Transaction, uncles []*block2.Header, receipts []*block2.Receipt) (*block2.Block, error)
FinalizeAndAssemble 实现共识。引擎,累积积木和叔叔奖励,设置最终状态并组装积木。
func (*Octell) Prepare ¶
Prepare implements consensus.Engine, initializing the difficulty field of a header to conform to the ethash protocol. The changes are done inline.
func (*Octell) Seal ¶
func (o *Octell) Seal(chain consensus.ChainHeaderReader, b *block2.Block, results chan<- *block2.Block, stop <-chan struct{}) error
Seal实现共识。引擎,试图找到满足模块难度要求的nonce。
func (*Octell) SetThreads ¶
SetThreads更新当前启用的挖掘线程数。 调用此方法不会开始挖掘,只会设置线程数。 如果指定为零,矿工将使用机器的所有芯。允许将线程数设置为零以下,并将导致矿工闲置,而不进行任何工作。
func (*Octell) VerifyHeader ¶
func (o *Octell) VerifyHeader(chain consensus.ChainHeaderReader, header *block2.Header, seal bool) error
VerifyHeader检查标头是否符合股票以太坊ethash引擎的共识规则。
func (*Octell) VerifyHeaders ¶
func (o *Octell) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*block2.Header, seals []bool) (chan<- struct{}, <-chan error)
VerifyHeaders与VerifyHeader类似,但同时验证一批标头。该方法返回退出通道以中止操作,返回结果通道以检索异步验证。
type OctellStart ¶
type OctellStart struct { }
func (OctellStart) Start ¶
func (os OctellStart) Start()