oracle

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitmentBytes added in v0.2.2

func CommitmentBytes(nodeId, commitmentAtxId []byte) []byte

CommitmentBytes returns the commitment bytes for the given Node ID and Commitment ATX ID.

Types

type OptionFunc added in v0.2.2

type OptionFunc func(*option) error

func WithBitsPerLabel added in v0.2.2

func WithBitsPerLabel(bitsPerLabel uint32) OptionFunc

WithBitsPerLabel sets the number of bits per label.

func WithCommitment added in v0.2.2

func WithCommitment(commitment []byte) OptionFunc

WithCommitment sets the commitment to use for the oracle.

func WithComputeLeaves added in v0.2.2

func WithComputeLeaves(enabled bool) OptionFunc

WithComputeLeaves instructs the oracle to compute the labels for PoST or not. By default computing leaves is enabled. It can be switched off to save time when continuing a run to compute a proof of work.

func WithComputePow added in v0.2.2

func WithComputePow(difficulty []byte) OptionFunc

WithComputePow instructs the oracle to compute a proof of work or not. If difficulty is nil, no PoW will be computed. Otherwise it specifies the difficulty of the PoW to be computed (higher values are more difficult). By default computing proof of work is disabled.

func WithComputeProviderID added in v0.2.2

func WithComputeProviderID(id uint) OptionFunc

WithComputeProviderID sets the ID of the compute provider to use.

func WithPosition added in v0.2.2

func WithPosition(position uint64) OptionFunc

WithPosition sets the index of one label to compute.

func WithSalt added in v0.2.2

func WithSalt(salt []byte) OptionFunc

WithSalt sets the salt to use for the oracle.

func WithScryptParams added in v0.5.1

func WithScryptParams(params config.ScryptParams) OptionFunc

func WithStartAndEndPosition added in v0.2.2

func WithStartAndEndPosition(start, end uint64) OptionFunc

WithStartAndEndPosition sets the range of indices of labels for the oracle to compute.

type WorkOracleResult added in v0.2.2

type WorkOracleResult struct {
	Output []byte  // Output are the computed labels (only if `WithComputeLeaves` is true - default yes).
	Nonce  *uint64 // Nonce is the nonce of the proof of work (only if `WithComputePow` is true - default no).
}

WorkOracleResult is the result of a call to WorkOracle. It contains the computed labels and the nonce as a proof of work.

func WorkOracle

func WorkOracle(opts ...OptionFunc) (WorkOracleResult, error)

WorkOracle computes labels for a given challenge for a Node with the provided CommitmentATX ID. The labels are computed using the specified compute provider (default: CPU).

Jump to

Keyboard shortcuts

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