ethashproof

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const CACHE_LEVEL uint64 = 15
View Source
const MAX_CACHE_SIZE int = 5

Variables

View Source
var (
	DefaultDir = defaultDir()
)

Functions

func CalculateDatasetMerkleRoot

func CalculateDatasetMerkleRoot(epoch uint64, saveCache bool) (mtree.Hash, error)
  1. Generate the dataset if needed
  2. Build merkle tree
  3. If saveCache is true, save root merkle tree of 10 levels to disk
  4. Return merkle root

func CalculateProof

func CalculateProof(blockno uint64, index uint32, cache *DatasetMerkleTreeCache) (mtree.Word, []mtree.Hash, error)

func PersistCache

func PersistCache(dirPath string, cache *DatasetMerkleTreeCache) error

func RLPHeader

func RLPHeader(header *types.Header) ([]byte, error)

Types

type DatasetMerkleTreeCache

type DatasetMerkleTreeCache struct {
	Epoch       uint64         `json:"epoch"`
	ProofLength uint64         `json:"proof_length"`
	CacheLength uint64         `json:"cache_length"`
	RootHash    mtree.Hash     `json:"root_hash"`
	Proofs      [][]mtree.Hash `json:"proofs"`
}

func LoadCache

func LoadCache(dirPath string, epoch int) (*DatasetMerkleTreeCache, error)

func (*DatasetMerkleTreeCache) Print

func (self *DatasetMerkleTreeCache) Print()

Directories

Path Synopsis
Package ethash implements the ethash proof-of-work consensus engine.
Package ethash implements the ethash proof-of-work consensus engine.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL