Documentation ¶
Index ¶
- Variables
- func BinaryRepresentationMinBits(val uint64) int
- func DataSize(numLabels uint64, labelSize uint) uint64
- func InitFileName(index int) string
- func IsInitFile(file os.FileInfo) bool
- func NumLabels(dataSize uint64, labelSize uint) uint64
- func ParseFileIndex(fileName string) (int, error)
- func PowDifficulty(numLabels uint64) []byte
- func ProvingDifficulty(numLabels uint64, B, k1 uint32) uint64
- func PutUintBE(b []byte, v uint64)
- func Size(itemBitSize, numItems uint) uint
- func UInt64LE(b []byte) uint64
- func Uint64MulOverflow(a, b uint64) bool
- func UintBE(b []byte) uint64
- type Challenge
- type ConfigMismatchError
- type NonceValue
- type PostMetadata
- type Proof
- type ProofMetadata
- type VRFNonce
- type VRFNonceMetadata
Constants ¶
This section is empty.
Variables ¶
var ( ErrInitNotStarted = errors.New("not started") ErrInitNotCompleted = errors.New("not completed") ErrProofNotExist = errors.New("proof doesn't exist") )
var ( // OwnerReadWriteExec is a standard owner read / write / exec file permission. OwnerReadWriteExec = os.FileMode(0o700) // OwnerReadWrite is a standard owner read / write file permission. OwnerReadWrite = os.FileMode(0o600) )
var ZeroChallenge = make(Challenge, 32)
Functions ¶
func InitFileName ¶
func IsInitFile ¶
func ParseFileIndex ¶ added in v0.8.7
func PowDifficulty ¶ added in v0.2.2
PowDifficulty returns the target difficulty of finding a nonce in `numLabels` labels. It is calculated such that a high percentage of smeshers find at least one computed label below the difficulty threshold. The difficulty is calculated as follows:
difficulty = 8 * 2^256 / numLabels
The probability of finding a label below the difficulty threshold within numLabels approaches ~ 99.97% the bigger numLabels gets. Within 1.15 * numLabels the probability approaches 99.99% of finding at least one label below the difficulty threshold.
func ProvingDifficulty ¶
ProvingDifficulty returns the target difficulty of finding a nonce in `numLabels` labels.
func Uint64MulOverflow ¶
Types ¶
type ConfigMismatchError ¶
func (ConfigMismatchError) Error ¶
func (err ConfigMismatchError) Error() string
type NonceValue ¶ added in v0.8.7
type NonceValue []byte
func (NonceValue) MarshalJSON ¶ added in v0.8.7
func (n NonceValue) MarshalJSON() ([]byte, error)
func (*NonceValue) UnmarshalJSON ¶ added in v0.8.7
func (n *NonceValue) UnmarshalJSON(data []byte) (err error)
type PostMetadata ¶ added in v0.2.2
type PostMetadata struct { NodeId []byte CommitmentAtxId []byte LabelsPerUnit uint64 NumUnits uint32 MaxFileSize uint64 Nonce *uint64 `json:",omitempty"` NonceValue NonceValue `json:",omitempty"` LastPosition *uint64 `json:",omitempty"` }
PostMetadata is the data associated with the PoST init procedure, persisted in the datadir next to the init files.