Skip to content

Instantly share code, notes, and snippets.

Last active Oct 18, 2020
What would you like to do?
Simplified explanation of VRF.


it's identical to ed25519 (RFC8032) therefor sk(64) = seed(32) + pk(32)


prover = Prover(has_sk, has_pk)
verifier = Verifier(has_pk);

message = "The input to be hashed by VRF"
message_hash = prover.hash(vrf_sk, message) // it always produces the same ouptput from the same inputs.
message_proof = prover.prove(sk, message)   // rover generating the proof that the message_hash is the correct ouput
// And VRF allows anybody to deterministically obtain the `message_hash` from the `message_proof`.
message_hash = verifier.proof_to_hash(message_proof)

// i.e. prover.hash(vrf_sk, message) == verifier.proof_to_hash(prover.hash(vrf_sk, message))
// Also, message_proof allows a verifier to verify that `message_hash` is the correct hash of the input `message`.
// i.e. valid if:
if (message_hash == verifier.proof_to_hash(message_proof)) {
 return true
} else { 
 return false


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment