hashValidation

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RXVerifier

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

func NewRXVerifier

func NewRXVerifier(server string) *RXVerifier

NewRXVerifier returns a RXVerifier instance, which is used to wrap a connection to the RandomX verificaton daemon. It expects a server argument, which should be the HTTP interface including the port, but this is optional if the daemon is running on the default port/localhost bindings

func (*RXVerifier) Hash

func (s *RXVerifier) Hash(input []byte, seed []byte) ([]byte, error)

Hash performs an actual round of hashing against a given input, for RandomX, this sends it off to the verifier

func (*RXVerifier) Info

func (s *RXVerifier) Info() (*ValidatorInfo, error)

Info returns the information available from the /info endpoint in the daemon

func (*RXVerifier) NewSeed

func (s *RXVerifier) NewSeed(input []byte) error

NewSeed sets the seed value into the remote daemon and updates the local seed directly.

func (*RXVerifier) SetCurrentSeed

func (s *RXVerifier) SetCurrentSeed(input []byte)

SetCurrentSeed is used to overwrite the current seed in an RXVerifier setup, this is largely for multithreaded implementations where multiple clients need to synchronize their seed across instances together

type Validator

type Validator interface {
	Hash(input []byte, seed []byte) ([]byte, error)
	NewSeed(input []byte) error
	SetCurrentSeed(input []byte)
	Info() (ValidatorInfo, error)
}

type ValidatorInfo

type ValidatorInfo struct {
	RandomxService string `json:"randomx_service"`
	Algorithm      string `json:"algorithm"`
	Threads        int    `json:"threads"`
	Seed           string `json:"seed"`
	Hashes         int    `json:"hashes"`
}

Jump to

Keyboard shortcuts

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