Zero Knowledge Proof and its Applications in Bitcoin

Zero Knowledge Proof

A zero knowledge proof lets one party (i.e., a prover), who claims to know a secret, convince another party (i.e., a verifier) that the claim is valid, whilst not revealing the secret.

Where’s Waldo?

Finding Waldo is a game where you have to find Waldo among a sea of people that look like him.

Finding Waldo
Cardboard with a Waldo shape cut
The back and the front of the cardboard
Cardboard big enough to hide the puzzle

Applications in Bitcoin

Because of the hiding nature of ZKP, it can be used in many cases where privacy is desirable. More importantly, it can also be used as a building block to construct more sophisticated protocols, as we demonstrate below.

Escrow via encrypt-and-swap¹

Alice wants to pay Bob in bitcoin to purchase physical goods. Alice and Bob generate a random private key a/b, with public key A/B, respectively. Alice encrypts her private key a under an escrow’s public key E and sends the ciphertext c = Enc(a, E) to Bob. She also sends Bob a zero-knowledge proof that c is indeed a encrypted with E. Vice versa, Bob does the same thing.

  • In the absence of a dispute, Alice sends a to Bob, who can move the fund.
  • In the presence of a dispute, the escrow chooses a winner. If the winner is Bob, he sends c to the escrow. The escrow decrypts c to get a and sends it back to Bob, who can redeem the fund. Likewise, Alice can take the fund if she is the winner.
  • Funds are locked in a normal bitcoin P2PKH address. Only parties involved know an escrow is involved, increasing privacy.
  • The escrow does not have to participate to deposit or withdraw funds when there is no dispute, potentially reducing its operating cost.
ZKP-based escrow full code

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
sCrypt

sCrypt

sCrypt (https://scrypt.io) is a company with a mission to provide integrated on-chain smart contracting solutions on Bitcoin SV