Documentation
¶
Index ¶
- func CommitmentBytes(nodeId, commitmentAtxId []byte) []byte
- type OptionFunc
- func WithCommitment(commitment []byte) OptionFunc
- func WithPosition(position uint64) OptionFunc
- func WithProviderID(id uint) OptionFunc
- func WithScryptParams(params config.ScryptParams) OptionFunc
- func WithStartAndEndPosition(start, end uint64) OptionFunc
- func WithVRFDifficulty(difficulty []byte) OptionFunc
- type WorkOracleResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommitmentBytes ¶ added in v0.2.2
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 WithCommitment ¶ added in v0.2.2
func WithCommitment(commitment []byte) OptionFunc
WithCommitment sets the commitment to use for the oracle.
func WithPosition ¶ added in v0.2.2
func WithPosition(position uint64) OptionFunc
WithPosition sets the index of one label to compute.
func WithProviderID ¶ added in v0.6.0
func WithProviderID(id uint) OptionFunc
WithProviderID sets the ID of the openCL provider to use.
func WithScryptParams ¶ added in v0.5.1
func WithScryptParams(params config.ScryptParams) OptionFunc
WithScryptParams sets the parameters for the scrypt algorithm. At the moment only configuring N is supported. r and p are fixed at 1 (due to limitations in the OpenCL implementation).
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.
func WithVRFDifficulty ¶ added in v0.6.0
func WithVRFDifficulty(difficulty []byte) OptionFunc
WithVRFDifficulty sets the difficulty for the VRF Nonce. It is used as a PoW to make creating identities expensive and thereby prevent Sybil attacks.
type WorkOracleResult ¶ added in v0.2.2
type WorkOracleResult struct {
Output []byte // Output are the computed labels
Nonce *uint64 // Nonce is the nonce of the proof of work
}
WorkOracleResult is the result of a call to WorkOracle. It contains the computed labels and a nonce for 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).