miner

package
v0.1.1-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2018 License: GPL-3.0 Imports: 20 Imported by: 2

Documentation

Overview

Package miner provides proof-of-work mining capability

Index

Constants

View Source
const (
	// EventProposedBlock represent an event about a
	// block to be mined.
	EventProposedBlock = "event.proposedBlock"

	// EventFoundBlock represents an event about
	// a block with a valid PoW nonce
	EventFoundBlock = "event.foundBlock"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FoundBlock

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

FoundBlock represents a block with a valid nonce

type Miner

type Miner struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Miner provides proof-of-work computation, difficulty calculation and prepares a mine block for processing.

func NewMiner

func NewMiner(mineKey *crypto.Key, blockMaker types.BlockMaker,
	event *emitter.Emitter, cfg *config.EngineConfig,
	log logger.Logger) *Miner

NewMiner creates a Miner instance

func (*Miner) APIs

func (m *Miner) APIs() jsonrpc.APISet

APIs returns all API handlers

func (*Miner) Begin

func (m *Miner) Begin() error

Begin starts proof-of-work computation and all managing functions

func (*Miner) OnNewBlock

func (m *Miner) OnNewBlock(newBlock *core.Block, chain types.ChainReader)

OnNewBlock is called when a new block has been appended to the main chain. We must restart a new mining round.

func (*Miner) SetNumThreads

func (m *Miner) SetNumThreads(n int)

SetNumThreads sets the number of threads performing PoW computation

func (*Miner) Stop

func (m *Miner) Stop()

Stop the miner

type Worker

type Worker struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Worker performs proof-of-work computation

func (*Worker) Stop

func (w *Worker) Stop()

Stop the worker

Directories

Path Synopsis
Package blakimoto provides functionalities for performing and verifying proof-of-work computation.
Package blakimoto provides functionalities for performing and verifying proof-of-work computation.

Jump to

Keyboard shortcuts

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