Documentation ¶
Index ¶
- Constants
- Variables
- func CalcDifficulty(config *params.ChainConfig, time uint64, parent *types.Header) *big.Int
- func DeleteTester()
- func SeedHash(block uint64) []byte
- type API
- type Block
- type Config
- type Cuckoo
- func (cuckoo *Cuckoo) APIs(chain consensus.ChainReader) []rpc.API
- func (cuckoo *Cuckoo) Author(header *types.Header) (common.Address, error)
- func (cuckoo *Cuckoo) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (cuckoo *Cuckoo) Close() error
- func (cuckoo *Cuckoo) CuckooVerifyHeader(hash []byte, nonce uint64, sol *types.BlockSolution, number uint64, ...) (ok bool)
- func (cuckoo *Cuckoo) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (cuckoo *Cuckoo) Hashrate() float64
- func (cuckoo *Cuckoo) InitPlugin() error
- func (cuckoo *Cuckoo) Mine(block *types.Block, id int, seed uint64, abort chan struct{}, ...) (err error)
- func (cuckoo *Cuckoo) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (cuckoo *Cuckoo) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (cuckoo *Cuckoo) SealHash(header *types.Header) (hash common.Hash)
- func (cuckoo *Cuckoo) SetThreads(threads int)
- func (cuckoo *Cuckoo) Sha3Solution(sol *types.BlockSolution) []byte
- func (cuckoo *Cuckoo) Threads() int
- func (cuckoo *Cuckoo) Verify(block Block, hashNoNonce common.Hash, shareDiff *big.Int, ...) (bool, bool, int64)
- func (cuckoo *Cuckoo) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (cuckoo *Cuckoo) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (cuckoo *Cuckoo) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- func (cuckoo *Cuckoo) VerifySolution(hash []byte, nonce uint32, solution *types.BlockSolution, target big.Int) (bool, common.Hash)
- func (cuckoo *Cuckoo) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
- type CuckooFake
- func (cuckoo *CuckooFake) APIs(chain consensus.ChainReader) []rpc.API
- func (cuckoo *CuckooFake) Author(header *types.Header) (common.Address, error)
- func (cuckoo *CuckooFake) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (cuckoo *CuckooFake) Close() error
- func (cuckoo *CuckooFake) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (cuckoo *CuckooFake) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (cuckoo *CuckooFake) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (cuckoo *CuckooFake) SealHash(header *types.Header) (hash common.Hash)
- func (cuckoo *CuckooFake) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (cuckoo *CuckooFake) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (cuckoo *CuckooFake) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- func (cuckoo *CuckooFake) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
- type Mode
Constants ¶
const PLUGIN_PATH string = "plugins/"
const PLUGIN_POST_FIX string = "_helper_for_node.so"
Variables ¶
var ( FrontierBlockReward *big.Int = big.NewInt(7e+18) // Block reward in wei for successfully mining a block ByzantiumBlockReward *big.Int = big.NewInt(7e+18) // Block reward in wei for successfully mining a block upward from Byzantium ConstantinopleBlockReward = big.NewInt(7e+18) )
Cuckoo proof-of-work protocol constants.
var ErrInvalidDumpMagic = errors.New("invalid dump magic")
Functions ¶
func CalcDifficulty ¶
CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty that a new block should have when created at time given the parent block's time and difficulty.
func DeleteTester ¶
func DeleteTester()
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API exposes cuckoo related methods for the RPC interface.
func (*API) GetHashrate ¶
GetHashrate returns the current hashrate for local CPU miner and remote miner.
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
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 DatasetDir string DatasetsInMem int DatasetsOnDisk int PowMode Mode UseCuda bool UseOpenCL bool StrDeviceIds string Threads int Algorithm string }
compatiable with cuckoo interface
type Cuckoo ¶
type Cuckoo struct {
// contains filtered or unexported fields
}
func NewFakeDelayer ¶ added in v1.0.0
func NewFakeFailer ¶ added in v1.0.0
func NewFullFaker ¶
func NewFullFaker() *Cuckoo
func (*Cuckoo) Author ¶
Author implements consensus.Engine, returning the header's coinbase as the proof-of-work verified author of the block.
func (*Cuckoo) CalcDifficulty ¶
func (cuckoo *Cuckoo) 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 when created at time given the parent block's time and difficulty.
func (*Cuckoo) CuckooVerifyHeader ¶ added in v1.0.0
func (*Cuckoo) Finalize ¶
func (cuckoo *Cuckoo) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)
Finalize implements consensus.Engine, accumulating the block and uncle rewards, setting the final state and assembling the block.
func (*Cuckoo) InitPlugin ¶ added in v1.0.0
func (*Cuckoo) Prepare ¶
Prepare implements consensus.Engine, initializing the difficulty field of a header to conform to the cuckoo protocol. The changes are done inline.
func (*Cuckoo) SetThreads ¶
func (*Cuckoo) Sha3Solution ¶ added in v1.0.0
func (cuckoo *Cuckoo) Sha3Solution(sol *types.BlockSolution) []byte
func (*Cuckoo) VerifyHeader ¶
func (cuckoo *Cuckoo) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
VerifyHeader checks whether a header conforms to the consensus rules of the stock Cortex cuckoo engine.
func (*Cuckoo) VerifyHeaders ¶
func (cuckoo *Cuckoo) 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.
func (*Cuckoo) VerifySeal ¶
func (*Cuckoo) VerifySolution ¶
func (*Cuckoo) VerifyUncles ¶
VerifyUncles verifies that the given block's uncles conform to the consensus rules of the stock Cortex cuckoo engine.
type CuckooFake ¶ added in v1.0.0
type CuckooFake struct { }
func NewFaker ¶
func NewFaker() *CuckooFake
func (*CuckooFake) APIs ¶ added in v1.0.0
func (cuckoo *CuckooFake) APIs(chain consensus.ChainReader) []rpc.API
func (*CuckooFake) CalcDifficulty ¶ added in v1.0.0
func (cuckoo *CuckooFake) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
func (*CuckooFake) Close ¶ added in v1.0.0
func (cuckoo *CuckooFake) Close() error
func (*CuckooFake) Prepare ¶ added in v1.0.0
func (cuckoo *CuckooFake) Prepare(chain consensus.ChainReader, header *types.Header) error
func (*CuckooFake) Seal ¶ added in v1.0.0
func (cuckoo *CuckooFake) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error
func (*CuckooFake) SealHash ¶ added in v1.0.0
func (cuckoo *CuckooFake) SealHash(header *types.Header) (hash common.Hash)
func (*CuckooFake) VerifyHeader ¶ added in v1.0.0
func (cuckoo *CuckooFake) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
func (*CuckooFake) VerifyHeaders ¶ added in v1.0.0
func (cuckoo *CuckooFake) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
func (*CuckooFake) VerifySeal ¶ added in v1.0.0
func (cuckoo *CuckooFake) VerifySeal(chain consensus.ChainReader, header *types.Header) error
func (*CuckooFake) VerifyUncles ¶ added in v1.0.0
func (cuckoo *CuckooFake) VerifyUncles(chain consensus.ChainReader, block *types.Block) error