Documentation ¶
Index ¶
- Constants
- Variables
- func ChooseTableDimension_Set() (height uint64, width uint64)
- func Convert56to64Des(x56 uint64) uint64
- func Convert64to56Des(x64 uint64) uint64
- func HashHeaderWithDigest(headerNoNonce common.Hash, mixDigest common.Hash) common.Hash
- type API
- type PoIC
- func (p *PoIC) APIs(chain consensus.ChainHeaderReader) []rpc.API
- func (p *PoIC) Author(header *types.Header) (common.Address, error)
- func (p *PoIC) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int
- func (p *PoIC) ClearTable() error
- func (p *PoIC) Close() error
- func (p *PoIC) CreateTableBinary(tableSize uint64) error
- func (p *PoIC) CreateTableBinarySuffix(tableSize uint64) error
- func (p *PoIC) CreateTableSet(tableSize uint64, numberOfTables uint64) error
- func (p *PoIC) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, ...)
- func (p *PoIC) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (p *PoIC) FindKeyForHashMultiThread(hashOfHeader *common.Hash, numOfBits uint64, stop <-chan struct{}) (*types.BlockNonce, error)
- func (p *PoIC) FindKeyForHashMultiThreadSuffix(hashOfHeader *common.Hash, numOfBits uint64, stop <-chan struct{}, ...) (*types.BlockNonce, error, *types.Block, uint64)
- func (p *PoIC) FindKeyForHashMultiThreadWholeTable(hashOfHeader *common.Hash, numOfBits uint64, stop <-chan struct{}) (*types.BlockNonce, error)
- func (p *PoIC) GetCurrentRowBinary(startPosition uint64, endPosition uint64) (key uint64, val uint64, newPosition uint64, err error)
- func (p *PoIC) GetTable() *TradeoffTable
- func (p *PoIC) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error
- func (p *PoIC) Seal(chain consensus.ChainHeaderReader, block *types.Block, ...) error
- func (ethash *PoIC) SealHash(header *types.Header) (hash common.Hash)
- func (p *PoIC) SearchRow(value uint64, rows []uint64, numOfBits uint64) *uint64
- func (p *PoIC) SearchTableFoRows(value uint64, numOfBits uint64, abort chan struct{}) ([]uint64, error)
- func (p *PoIC) VerifyEntrySuffix(hashOfHeader *common.Hash, key uint64, numOfBits uint64) error
- func (p *PoIC) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header) error
- func (p *PoIC) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header) (chan<- struct{}, <-chan error)
- func (p *PoIC) VerifySeal(chain consensus.ChainHeaderReader, header *types.Header) error
- func (p *PoIC) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
- type TradeoffTable
- type TradeoffTablePartial
- type TradeoffTableSet
Constants ¶
const ( TABLE_WIDTH uint64 = 1 << 2 TABLE_HEIGHT uint64 = 1 << 2 )
const FILL_MASK uint64 = 0x00FFFFFFFFFFFFFF
const OUTER_DIGEST = false
digest se cita sa spoljnog izvora + timestamp
const ( //number of seconds that passed since block's creation and reading outer data OUTER_TIME_DELTA int64 = 3 )
Variables ¶
var ( FrontierBlockReward *big.Int = big.NewInt(5e+18) // Block reward in wei for successfully mining a block ByzantiumBlockReward *big.Int = big.NewInt(3e+18) // Block reward in wei for successfully mining a block upward from Byzantium )
TODO: PROVERITI OVO Ethash proof-of-work protocol constants.
var POW_MASKS = [...]byte{0x0, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF}
Functions ¶
func Convert56to64Des ¶
func Convert64to56Des ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API exposes ethash 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 PoIC ¶
type PoIC struct {
// contains filtered or unexported fields
}
func (*PoIC) APIs ¶
func (p *PoIC) APIs(chain consensus.ChainHeaderReader) []rpc.API
APIs implements consensus.Engine, returning the user facing RPC APIs.
func (*PoIC) 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 (*PoIC) CalcDifficulty ¶
func (p *PoIC) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int
CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty that a new block should have. TODO Treba staviti neko vreme
func (*PoIC) ClearTable ¶
func (*PoIC) CreateTableBinary ¶
func (*PoIC) CreateTableBinarySuffix ¶
KORISTIM OVU VERZIJU! creates table that only compares suffixes (the numbers in table are only suffixes not whole 64 bit numbers)
func (*PoIC) CreateTableSet ¶
creates a set of smaller tables with forks that are kept in tmp dir and mmaped the name of each table is tabela_{redBr}_{fork}_{widh}x{height}.csv if fork is 0, no fork is used
func (*PoIC) Finalize ¶
func (p *PoIC) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body)
Finalize implements consensus.Engine, accumulating the block and uncle rewards. func (p *PoIC) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, withdrawals []*types.Withdrawal) {
func (*PoIC) FinalizeAndAssemble ¶
func (p *PoIC) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, 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 (p *PoIC) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, error) {
func (*PoIC) FindKeyForHashMultiThread ¶
func (*PoIC) FindKeyForHashMultiThreadSuffix ¶
func (*PoIC) FindKeyForHashMultiThreadWholeTable ¶
func (*PoIC) GetCurrentRowBinary ¶
func (*PoIC) GetTable ¶
func (p *PoIC) GetTable() *TradeoffTable
func (*PoIC) Prepare ¶
Prepare initializes the consensus fields of a block header according to the rules of a particular engine. The changes are executed inline. Prepare implements consensus.Engine, initializing the difficulty field of a header to conform to the ethash protocol. The changes are done inline.
func (*PoIC) Seal ¶
func (p *PoIC) Seal(chain consensus.ChainHeaderReader, 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. samo rudarenje se desava Ovde
func (*PoIC) SearchTableFoRows ¶
func (*PoIC) VerifyEntrySuffix ¶
func (*PoIC) VerifyHeader ¶
VerifyHeader checks whether a header conforms to the consensus rules of a given engine.
func (*PoIC) VerifyHeaders ¶
func (p *PoIC) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header) (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 (*PoIC) VerifySeal ¶
VerifySeal checks whether the crypto seal on a header is valid according to the consensus rules of the given engine.
func (*PoIC) VerifyUncles ¶
VerifyUncles verifies that the given block's uncles conform to the consensus rules of a given engine.
type TradeoffTable ¶
type TradeoffTable struct {
// contains filtered or unexported fields
}
type TradeoffTablePartial ¶
type TradeoffTablePartial struct {
// contains filtered or unexported fields
}
type TradeoffTableSet ¶
type TradeoffTableSet struct {
// contains filtered or unexported fields
}