Documentation ¶
Index ¶
- func SipHash24(v [4]uint64, nonce uint64, rotE uint8) uint64
- func SipHashBlock(v [4]uint64, nonce uint64, rotE uint8, xorAll bool) uint64
- type CuckarooContext
- type CuckaroodContext
- type CuckaroomContext
- type CuckaroozContext
- type CuckatooContext
- type CuckooParams
- type PowContext
- type Proof
- type ProofOfWork
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CuckarooContext ¶
type CuckarooContext struct {
// contains filtered or unexported fields
}
CuckarooContext is a Cuckatoo cycle context. Only includes the verifier for now.
func NewCuckarooCtx ¶
func NewCuckarooCtx(chainType consensus.ChainType, edgeBits uint8, proofSize int) (*CuckarooContext, error)
NewCuckarooCtx instantiates a new CuckarooContext as a PowContext
func (*CuckarooContext) SetHeaderNonce ¶
func (c *CuckarooContext) SetHeaderNonce(header []uint8, nonce *uint32)
SetHeaderNonce sets the header nonce.
func (*CuckarooContext) Verify ¶
func (c *CuckarooContext) Verify(proof Proof) error
Verify verifies the Cuckatoo context.
type CuckaroodContext ¶
type CuckaroodContext struct {
// contains filtered or unexported fields
}
CuckaroodContext is a Cuckatoo cycle context. Only includes the verifier for now.
func NewCuckaroodCtx ¶
func NewCuckaroodCtx(chainType consensus.ChainType, edgeBits uint8, proofSize int) (*CuckaroodContext, error)
NewCuckaroodCtx instantiates a new CuckaroodContext as a PowContext. Note that this can't be moved in the PoWContext trait as this particular trait needs to be convertible to an object trait.
func (*CuckaroodContext) SetHeaderNonce ¶
func (c *CuckaroodContext) SetHeaderNonce(header []uint8, nonce *uint32)
SetHeaderNonce sets the header nonce.
func (*CuckaroodContext) Verify ¶
func (c *CuckaroodContext) Verify(proof Proof) error
Verify verifies the Cuckatoo context.
type CuckaroomContext ¶
type CuckaroomContext struct {
// contains filtered or unexported fields
}
CuckaroomContext is a Cuckaroom cycle context. Only includes the verifier for now.
func NewCuckaroomCtx ¶
func NewCuckaroomCtx(chainType consensus.ChainType, edgeBits uint8, proofSize int) (*CuckaroomContext, error)
NewCuckaroomCtx instantiates a new CuckaroomContext as a PowContext. Note that this can't / be moved in the PoWContext trait as this particular trait needs to be / convertible to an object trait.
func (*CuckaroomContext) SetHeaderNonce ¶
func (c *CuckaroomContext) SetHeaderNonce(header []uint8, nonce *uint32)
SetHeaderNonce sets the header nonce.
func (*CuckaroomContext) Verify ¶
func (c *CuckaroomContext) Verify(proof Proof) error
Verify verifies the Cuckaroom context.
type CuckaroozContext ¶
type CuckaroozContext struct {
// contains filtered or unexported fields
}
CuckaroozContext is a Cuckarooz cycle context. Only includes the verifier for now.
func NewCuckaroozCtx ¶
func NewCuckaroozCtx(chainType consensus.ChainType, edgeBits uint8, proofSize int) (*CuckaroozContext, error)
NewCuckaroozCtx instantiates a new CuckaroozContext as a PowContext. Note that this can't / be moved in the PoWContext trait as this particular trait needs to be / convertible to an object trait.
func (*CuckaroozContext) SetHeaderNonce ¶
func (c *CuckaroozContext) SetHeaderNonce(header []uint8, nonce *uint32)
SetHeaderNonce sets the header nonce.
func (*CuckaroozContext) Verify ¶
func (c *CuckaroozContext) Verify(proof Proof) error
Verify verifies the Cuckaroom context.
type CuckatooContext ¶
type CuckatooContext struct {
// contains filtered or unexported fields
}
CuckatooContext is a Cuckatoo solver context.
func NewCuckatooCtx ¶
func NewCuckatooCtx(chainType consensus.ChainType, edgeBits uint8, proofSize int, maxSols uint32) (*CuckatooContext, error)
NewCuckatooCtx instantiates a new CuckatooContext as a PowContext
func (*CuckatooContext) SetHeaderNonce ¶
func (c *CuckatooContext) SetHeaderNonce(header []uint8, nonce *uint32)
SetHeaderNonce sets the header nonce.
func (*CuckatooContext) Verify ¶
func (c *CuckatooContext) Verify(proof Proof) error
Verify verifies the Cuckatoo context.
type CuckooParams ¶
type CuckooParams struct {
// contains filtered or unexported fields
}
CuckooParams is a utility struct to calculate commonly used Cuckoo parameters calculated from header, nonce, edge_bits, etc.
type PowContext ¶
type PowContext interface { // Sets the header along with an optional nonce at the end solve: whether to // set up structures for a solve (true) or just validate (false) SetHeaderNonce(header []uint8, nonce *uint32) // Verify a solution with the stored parameters Verify(proof Proof) error }
PowContext is a generic interface for a solver/verifier providing common interface into Cuckoo-family PoW
func NoCuckarooCtx ¶
func NoCuckarooCtx() (PowContext, error)
NoCuckarooCtx error returned for cuckaroo request beyond HardFork4
type Proof ¶
type Proof struct { // Power of 2 used for the size of the cuckoo graph EdgeBits uint8 // The nonces Nonces []uint64 }
Proof is a Cuck(at)oo Cycle proof of work, consisting of the edge_bits to get the graph size (i.e. the 2-log of the number of edges) and the nonces of the graph solution. While being expressed as u64 for simplicity, nonces a.k.a. edge indices range from 0 to (1 << edge_bits) - 1
The hash of the `Proof` is the hash of its packed nonces when serializing them at their exact bit size. The resulting bit sequence is padded to be byte-aligned.
type ProofOfWork ¶
type ProofOfWork struct { // Total accumulated difficulty since genesis block TotalDifficulty uint64 // Variable difficulty scaling factor fo secondary proof of work SecondaryScaling uint32 // Nonce increment used to mine this block. Nonce uint64 // Proof of work data. Proof Proof }
ProofOfWork is a block header information pertaining to the proof of work
func (*ProofOfWork) EdgeBits ¶
func (p *ProofOfWork) EdgeBits() uint8
EdgeBits is the edge bits used for the cuckoo cycle size on this proof
func (*ProofOfWork) IsPrimary ¶
func (p *ProofOfWork) IsPrimary() bool
IsPrimary is whether this proof of work is for the primary algorithm (as opposed / to secondary). Only depends on the edge_bits at this time.
func (*ProofOfWork) IsSecondary ¶
func (p *ProofOfWork) IsSecondary() bool
IsSecondary is whether this proof of work is for the secondary algorithm (as opposed / to primary). Only depends on the edge_bits at this time.