Skip to content

Instantly share code, notes, and snippets.

@ilap
Last active October 18, 2020 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilap/231d277cfbf6e0f54553b845aa4ae203 to your computer and use it in GitHub Desktop.
Save ilap/231d277cfbf6e0f54553b845aa4ae203 to your computer and use it in GitHub Desktop.
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