Skip to content

Instantly share code, notes, and snippets.

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

Keygeneration

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

Prove

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
}

reference

https://vincenthz.github.io/ouroboros-vrf-explanation/

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