Documentation ¶
Index ¶
- func GenerateVDF(seed []byte, iterations, int_size_bits uint32) ([]byte, []byte)
- func GenerateVDFIteration(seed, x_blob []byte, iterations, int_size_bits uint32) ([]byte, []byte)
- func GenerateVDFWithStopChan(seed []byte, iterations, int_size_bits uint32, stop <-chan struct{}) ([]byte, []byte)
- func VerifyVDF(seed, proof_blob []byte, iterations, int_size_bits uint32) bool
- func VerifyVDFIteration(seed, x_blob, proof_blob []byte, iterations, int_size_bits uint32) bool
- type VDF
- func (vdf *VDF) Execute()
- func (vdf *VDF) ExecuteIteration(x_blob []byte)
- func (vdf *VDF) GetOutput() [516]byte
- func (vdf *VDF) GetOutputChannel() chan [516]byte
- func (vdf *VDF) IsFinished() bool
- func (vdf *VDF) Verify(proof [516]byte) bool
- func (vdf *VDF) VerifyIteration(x_blob [258]byte, proof [516]byte, iterations uint32) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateVDFIteration ¶
func GenerateVDFWithStopChan ¶
func VerifyVDFIteration ¶
Types ¶
type VDF ¶
type VDF struct {
// contains filtered or unexported fields
}
VDF is the struct holding necessary state for a hash chain delay function. Differs from harmony implementation in that difficulty is carried through as an unsigned int, because we can't travel backwards in time (yet ;) )
func (*VDF) Execute ¶
func (vdf *VDF) Execute()
Execute runs the VDF until it's finished and put the result into output channel. currently on i7-6700K, it takes about 14 seconds when iteration is set to 10000
func (*VDF) ExecuteIteration ¶
func (*VDF) GetOutput ¶
GetOutput returns the vdf output, which can be bytes of 0s is the vdf is not finished.
func (*VDF) GetOutputChannel ¶
GetOutputChannel returns the vdf output channel. VDF output consists of 258 bytes of serialized Y and 258 bytes of serialized Proof
func (*VDF) IsFinished ¶
IsFinished returns whether the vdf execution is finished or not.