difficulty

package
v0.0.0-...-6db25f1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adjuster

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

func NewAdjuster

func NewAdjuster(windowSize int, targetTime float64) *Adjuster

func (*Adjuster) AddBlock

func (a *Adjuster) AddBlock(timestamp int64, difficulty uint32)

func (*Adjuster) GetNextDifficulty

func (a *Adjuster) GetNextDifficulty() uint32

type Calculator

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

func NewCalculator

func NewCalculator(targetBlockTime, windowSize int64) *Calculator

func (*Calculator) Calculate

func (c *Calculator) Calculate(timestamps []int64, difficulties []uint32) uint32

type TargetCalculator

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

TargetCalculator calculates mining targets based on difficulty

func NewTargetCalculator

func NewTargetCalculator(maxTargetHex string) *TargetCalculator

func (*TargetCalculator) DifficultyToTarget

func (tc *TargetCalculator) DifficultyToTarget(difficulty uint32) *big.Int

func (*TargetCalculator) TargetToDifficulty

func (tc *TargetCalculator) TargetToDifficulty(target *big.Int) uint32

type Window

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

func NewWindow

func NewWindow(size int) *Window

func (*Window) Add

func (w *Window) Add(timestamp int64, difficulty uint32)

func (*Window) GetAverageTime

func (w *Window) GetAverageTime() float64

Jump to

Keyboard shortcuts

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