Documentation ¶
Index ¶
- func GenerateChainAndSave(gspec *core.Genesis, blockCount uint, path string, ...) error
- func ProduceSimpleTestChain(path string, blockCount uint) error
- func ProduceTestChainFromGenesisFile(sourceGenesis string, outputPath string, blockCount uint, ...) error
- func WriteChain(chain *core.BlockChain, filename string, start uint64) error
- type SealingEthash
- func (e *SealingEthash) APIs(chain consensus.ChainReader) []rpc.API
- func (e *SealingEthash) Author(header *types.Header) (common.Address, error)
- func (e *SealingEthash) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (e *SealingEthash) Close() error
- func (e *SealingEthash) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...)
- func (e *SealingEthash) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (e *SealingEthash) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (e *SealingEthash) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (e *SealingEthash) SealHash(header *types.Header) common.Hash
- func (e *SealingEthash) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (e *SealingEthash) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (e *SealingEthash) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- func (e *SealingEthash) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateChainAndSave ¶
func GenerateChainAndSave(gspec *core.Genesis, blockCount uint, path string, blockModifier func(i int, gen *core.BlockGen)) error
GenerateChainAndSave produces a chain based on the genesis-config with valid proof of work, and block difficulty modified by the OffsetTime function in the per-block post-processing function.
func ProduceSimpleTestChain ¶
ProduceSimpleTestChain : The first of multiple chains exhibiting different characteristics for differing test purposes. This chain involves two accounts that transfer funds to each other in alternating blocks. These functions save the chain.rlp and genesis.json to the specified path. blockCount indicates the desired chain length in blocks.
func ProduceTestChainFromGenesisFile ¶
func ProduceTestChainFromGenesisFile(sourceGenesis string, outputPath string, blockCount uint, blockTimeInSeconds uint) error
ProduceTestChainFromGenesisFile Produce a test chain with no transactions or other modifications based on an externally specified genesis file. The blockTimeInSeconds is used to manipulate the block difficulty
func WriteChain ¶
func WriteChain(chain *core.BlockChain, filename string, start uint64) error
WriteChain - save blockchain to file
Types ¶
type SealingEthash ¶
SealingEthash is intended for use with chain_makers GenerateChain to produce blocks with a valid proof of work
func NewSealingEthash ¶
func NewSealingEthash(config ethash.Config, notify []string, noverify bool) *SealingEthash
NewSealingEthash : ctor
func (*SealingEthash) APIs ¶
func (e *SealingEthash) APIs(chain consensus.ChainReader) []rpc.API
APIs returns the RPC APIs this consensus engine provides.
func (*SealingEthash) Author ¶
Author retrieves the Ethereum address of the account that minted the given block, which may be different from the header's coinbase if a consensus engine is based on signatures.
func (*SealingEthash) CalcDifficulty ¶
func (e *SealingEthash) 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 (*SealingEthash) Close ¶
func (e *SealingEthash) Close() error
Close terminates any background threads maintained by the consensus engine.
func (*SealingEthash) Finalize ¶
func (e *SealingEthash) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header)
Finalize wraps ethhash engine
func (*SealingEthash) FinalizeAndAssemble ¶
func (e *SealingEthash) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)
FinalizeAndAssemble implements consensus.Engine, accumulating the block and uncle rewards, setting the final state and assembling the block.
func (*SealingEthash) Prepare ¶
func (e *SealingEthash) 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 (*SealingEthash) Seal ¶
func (e *SealingEthash) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error
Seal generates a new sealing request for the given input block and pushes the result into the given channel.
Note, the method returns immediately and will send the result async. More than one result may also be returned depending on the consensus algorithm.
func (*SealingEthash) SealHash ¶
func (e *SealingEthash) SealHash(header *types.Header) common.Hash
SealHash returns the hash of a block prior to it being sealed.
func (*SealingEthash) VerifyHeader ¶
func (e *SealingEthash) 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 (*SealingEthash) VerifyHeaders ¶
func (e *SealingEthash) 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 (*SealingEthash) VerifySeal ¶
func (e *SealingEthash) VerifySeal(chain consensus.ChainReader, header *types.Header) error
VerifySeal checks whether the crypto seal on a header is valid according to the consensus rules of the given engine.
func (*SealingEthash) VerifyUncles ¶
func (e *SealingEthash) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
VerifyUncles verifies that the given block's uncles conform to the consensus rules of a given engine.