types

package
v0.0.0-...-d7dfbf7 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DifficultySize = 16
View Source
const (
	DonationAddress = "4AeEwC2Uik2Zv4uooAUWjQb2ZvcLDBmLXN4rzSn3wjBoY8EKfNkSUqeg5PxcnWTwB1b2V39PDwU9gaNE5SnxSQPYQyoQtr7"
)
View Source
const HashSize = 32

Variables

View Source
var MaxDifficulty = Difficulty(uint128.Max)
View Source
var ZeroDifficulty = Difficulty(uint128.Zero)

Functions

This section is empty.

Types

type Bytes

type Bytes []byte

func (Bytes) MarshalJSON

func (b Bytes) MarshalJSON() ([]byte, error)

func (Bytes) String

func (b Bytes) String() string

func (*Bytes) UnmarshalJSON

func (b *Bytes) UnmarshalJSON(buf []byte) error

type Difficulty

type Difficulty uint128.Uint128

func DifficultyFrom64

func DifficultyFrom64(v uint64) Difficulty

func DifficultyFromBytes

func DifficultyFromBytes(buf []byte) Difficulty

func DifficultyFromPoW

func DifficultyFromPoW(powHash Hash) Difficulty

func DifficultyFromString

func DifficultyFromString(s string) (Difficulty, error)

func MustDifficultyFromString

func MustDifficultyFromString(s string) Difficulty

func NewDifficulty

func NewDifficulty(lo, hi uint64) Difficulty

func (Difficulty) Add

func (d Difficulty) Add(v Difficulty) Difficulty

Add All calls can wrap

func (Difficulty) Add64

func (d Difficulty) Add64(v uint64) Difficulty

Add64 All calls can wrap

func (Difficulty) And

func (d Difficulty) And(v Difficulty) Difficulty

func (Difficulty) And64

func (d Difficulty) And64(v uint64) Difficulty

func (Difficulty) Big

func (d Difficulty) Big() *big.Int

Big returns u as a *big.Int.

func (Difficulty) Bytes

func (d Difficulty) Bytes() []byte

func (Difficulty) CheckPoW

func (d Difficulty) CheckPoW(pow Hash) bool

func (Difficulty) Cmp

func (d Difficulty) Cmp(v Difficulty) int

func (Difficulty) Cmp64

func (d Difficulty) Cmp64(v uint64) int

func (Difficulty) Div

func (d Difficulty) Div(v Difficulty) Difficulty

func (Difficulty) Div64

func (d Difficulty) Div64(v uint64) Difficulty

func (Difficulty) Equals

func (d Difficulty) Equals(v Difficulty) bool

func (Difficulty) Equals64

func (d Difficulty) Equals64(v uint64) bool

func (Difficulty) Float64

func (d Difficulty) Float64() float64

func (Difficulty) IsZero

func (d Difficulty) IsZero() bool

func (Difficulty) LeadingZeros

func (d Difficulty) LeadingZeros() int

func (Difficulty) Len

func (d Difficulty) Len() int

func (Difficulty) Lsh

func (d Difficulty) Lsh(n uint) (s Difficulty)

func (Difficulty) MarshalJSON

func (d Difficulty) MarshalJSON() ([]byte, error)

func (Difficulty) Mod

func (d Difficulty) Mod(v Difficulty) (r Difficulty)

func (Difficulty) Mod64

func (d Difficulty) Mod64(v uint64) (r uint64)

func (Difficulty) Mul

func (d Difficulty) Mul(v Difficulty) Difficulty

Mul All calls can wrap

func (Difficulty) Mul64

func (d Difficulty) Mul64(v uint64) Difficulty

Mul64 All calls can wrap

func (Difficulty) OnesCount

func (d Difficulty) OnesCount() int

func (Difficulty) Or

func (Difficulty) Or64

func (d Difficulty) Or64(v uint64) Difficulty

func (Difficulty) PutBytes

func (d Difficulty) PutBytes(b []byte)

func (Difficulty) PutBytesBE

func (d Difficulty) PutBytesBE(b []byte)

func (Difficulty) QuoRem

func (d Difficulty) QuoRem(v Difficulty) (q, r Difficulty)

func (Difficulty) QuoRem64

func (d Difficulty) QuoRem64(v uint64) (q Difficulty, r uint64)

func (Difficulty) Reverse

func (d Difficulty) Reverse() Difficulty

func (Difficulty) ReverseBytes

func (d Difficulty) ReverseBytes() Difficulty

func (Difficulty) RotateLeft

func (d Difficulty) RotateLeft(k int) Difficulty

func (Difficulty) RotateRight

func (d Difficulty) RotateRight(k int) Difficulty

func (Difficulty) Rsh

func (d Difficulty) Rsh(n uint) (s Difficulty)

func (*Difficulty) Scan

func (d *Difficulty) Scan(src any) error

func (Difficulty) String

func (d Difficulty) String() string

func (Difficulty) StringNumeric

func (d Difficulty) StringNumeric() string

func (Difficulty) Sub

func (d Difficulty) Sub(v Difficulty) Difficulty

Sub All calls can wrap

func (Difficulty) Sub64

func (d Difficulty) Sub64(v uint64) Difficulty

Sub64 All calls can wrap

func (Difficulty) Target

func (d Difficulty) Target() uint64

Target Finds a 64-bit target for mining (target = 2^64 / difficulty) and rounds up the result of division Because of that, there's a very small chance that miners will find a hash that meets the target but is still wrong (hash * difficulty >= 2^256) A proper difficulty check is in check_pow()

func (Difficulty) TrailingZeros

func (d Difficulty) TrailingZeros() int

func (*Difficulty) UnmarshalJSON

func (d *Difficulty) UnmarshalJSON(b []byte) error

func (*Difficulty) Value

func (d *Difficulty) Value() (driver.Value, error)

func (Difficulty) Xor

func (d Difficulty) Xor(v Difficulty) Difficulty

func (Difficulty) Xor64

func (d Difficulty) Xor64(v uint64) Difficulty

type Hash

type Hash [HashSize]byte
var ZeroHash Hash

func HashFromBytes

func HashFromBytes(buf []byte) (h Hash)

func HashFromString

func HashFromString(s string) (Hash, error)

func MustHashFromString

func MustHashFromString(s string) Hash

func (Hash) Compare

func (h Hash) Compare(other Hash) int

Compare consensus way of comparison

func (Hash) MarshalJSON

func (h Hash) MarshalJSON() ([]byte, error)

func (*Hash) Scan

func (h *Hash) Scan(src any) error

func (Hash) String

func (h Hash) String() string

func (Hash) Uint64

func (h Hash) Uint64() uint64

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(b []byte) error

func (*Hash) Value

func (h *Hash) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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