Documentation ¶
Overview ¶
NOTE: At the time of implementation, the VRF library is only used with consensus, but may be extracted into shared/crypto when/if it will be needed elsewhere.
Index ¶
Constants ¶
View Source
const ( NilPrivateKeyError = "private key cannot be nil" BadAppHashLengthError = "the last block hash must be at least %d bytes in length" )
View Source
const (
VRFOutputSize = sha512.Size // See github.com/ProtonMail/go-ecvrf for details
)
Variables ¶
View Source
var (
ErrNilPrivateKey = errors.New(NilPrivateKeyError)
)
Functions ¶
func CreateVRFRandReader ¶
func ErrBadAppHashLength ¶
func GenerateVRFKeys ¶
func GenerateVRFKeys(reader io.Reader) (*SecretKey, *VerificationKey, error)
Types ¶
type SecretKey ¶
type SecretKey ecvrf.PrivateKey
func (*SecretKey) VerificationKey ¶
func (key *SecretKey) VerificationKey() (*VerificationKey, error)
type VRFOutput ¶
type VRFOutput []byte // Uniformally distributed output that can be normalized to be used in a binomial distribution.
type VRFProof ¶
type VRFProof []byte // A proof to verify that VRFOutput belongs to a certain publicKey.
These are slices rather than arrays in order to more easily comply with the underlying `go-ecvrf/ecvrf` library.
type VerificationKey ¶
func VerificationKeyFromBytes ¶
func VerificationKeyFromBytes(data []byte) (*VerificationKey, error)
func (*VerificationKey) Bytes ¶
func (key *VerificationKey) Bytes() []byte
Click to show internal directories.
Click to hide internal directories.