Documentation ¶
Index ¶
- Constants
- func CacheSize(block uint64) uint64
- func CalcCacheSize(epoch int) uint64
- func CalcDatasetSize(epoch int) uint64
- func CalcSeedHash(epoch int) []byte
- func DatasetSize(block uint64) uint64
- func GenerateCache(dest []uint32, epoch uint64, seed []byte)
- func GenerateDataset(dest []uint32, epoch uint64, cache []uint32)
- func HashimotoFull(dataset []uint32, hash []byte, nonce uint64) ([]byte, []byte)
- func HashimotoLight(size uint64, cache []uint32, hash []byte, nonce uint64) ([]byte, []byte)
- func SealHash(header *types.Header) (hash common.Hash)
- func SeedHash(block uint64) []byte
- type Hasher
Constants ¶
const (
EpochLength = 30000 // Blocks per epoch
)
Variables ¶
This section is empty.
Functions ¶
func CacheSize ¶
CacheSize returns the size of the ethash verification cache that belongs to a certain block number.
func CalcCacheSize ¶
CalcCacheSize calculates the cache size for epoch. The cache size grows linearly, however, we always take the highest prime below the linearly growing threshold in order to reduce the risk of accidental regularities leading to cyclic behavior.
func CalcDatasetSize ¶
CalcDatasetSize calculates the dataset size for epoch. The dataset size grows linearly, however, we always take the highest prime below the linearly growing threshold in order to reduce the risk of accidental regularities leading to cyclic behavior.
func CalcSeedHash ¶
func DatasetSize ¶
DatasetSize returns the size of the ethash mining dataset that belongs to a certain block number.
func GenerateCache ¶
GenerateCache creates a verification cache of a given size for an input seed. The cache production process involves first sequentially filling up 32 MB of memory, then performing two passes of Sergio Demian Lerner's RandMemoHash algorithm from Strict Memory Hard Hashing Functions (2014). The output is a set of 524288 64-byte values. This method places the result into dest in machine byte order.
func GenerateDataset ¶
GenerateDataset generates the entire ethash dataset for mining. This method places the result into dest in machine byte order.
func HashimotoFull ¶
HashimotoFull aggregates data from the full dataset (using the full in-memory dataset) in order to produce our final value for a particular header hash and nonce.
func HashimotoLight ¶
HashimotoLight aggregates data from the full dataset (using only a small in-memory cache) in order to produce our final value for a particular header hash and nonce.
Types ¶
type Hasher ¶
type Hasher struct {
// contains filtered or unexported fields
}