ethash

package
v0.9.24 Latest Latest
Warning

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

Go to latest
Published: May 26, 2015 License: LGPL-2.1-or-later Imports: 19 Imported by: 0

README

Build Status Windows Build Status

Ethash

For details on this project, please see the Ethereum wiki: https://github.com/ethereum/wiki/wiki/Ethash

Coding Style for C++ code:

Follow the same exact style as in cpp-ethereum

Coding Style for C code:

The main thing above all is code consistency.

  • Tabs for indentation. A tab is 4 spaces
  • Try to stick to the K&R, especially for the C code.
  • Keep the line lengths reasonable. No hard limit on 80 characters but don't go further than 110. Some people work with multiple buffers next to each other. Make them like you :)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDir = defaultDir()

Functions

func GetSeedHash

func GetSeedHash(blockNum uint64) ([]byte, error)

func MakeDAG

func MakeDAG(blockNum uint64, dir string) error

MakeDAG pre-generates a DAG file for the given block number in the given directory. If dir is the empty string, the default directory is used.

Types

type Ethash

type Ethash struct {
	*Light
	*Full
}

Ethash combines block verification with Light and nonce searching with Full into a single proof of work.

func New

func New() *Ethash

New creates an instance of the proof of work. A single instance of Light is shared across all instances created with New.

func NewForTesting

func NewForTesting() (*Ethash, error)

NewForTesting creates a proof of work for use in unit tests. It uses a smaller DAG and cache size to keep test times low. DAG files are stored in a temporary directory.

Nonces found by a testing instance are not verifiable with a regular-size cache.

type Full

type Full struct {
	Dir string // use this to specify a non-default DAG directory
	// contains filtered or unexported fields
}

Full implements the Search half of the proof of work.

func (*Full) GetHashrate

func (pow *Full) GetHashrate() int64

func (*Full) Search

func (pow *Full) Search(block pow.Block, stop <-chan struct{}) (nonce uint64, mixDigest []byte)

func (*Full) Turbo

func (pow *Full) Turbo(on bool)

type Light

type Light struct {
	// contains filtered or unexported fields
}

Light implements the Verify half of the proof of work. It uses a small in-memory cache to verify the nonces found by Full.

func (*Light) Verify

func (l *Light) Verify(block pow.Block) bool

Verify checks whether the block's nonce is valid.

Jump to

Keyboard shortcuts

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