Technical analysis how to realize private transactions through zk-SNARK in NEAR

  1. Unspent output
  2. transaction
  3. Token deposit and withdrawal
  4. Transaction Fees
  5. future development
  6. Conclusion

Unspent output

transaction

  • Given public input 1, public input 2…
  • Know some kind of private input 1, private input 2…
  • Can get [some conclusion]
  • Given Merkel root and two hashes OUT_HASH1 and OUT_HASH2,
  • There are four such UTXOs: IN1, IN2, OUT1, OUT2, two Merkel proofs P1 and P2 and a private key x,
  • The hash values ​​corresponding to OUT1 and OUT2 are OUT_HASH1 and OUT_HASH2 respectively; the receivers in IN1 and IN2 are equivalent to the public key X corresponding to x; merkel proves that P1 and P2 are in the Merkel tree determined by Merkel root Contains valid proofs of IN1 and IN2; the sum of the quantities in IN1 and IN2 is equal to the sum of the quantities in OUT1 and OUT2.
  • Given Merkel root, and two hashes OUT_HASH1 and OUT_HASH2, the other two hashes NULLIFIER1 and NULLIFIER2,
  • There are four such UTXOs: IN1, IN2, OUT1, OUT2, two Merkel proofs P1 and P2 and a private key x,
  • The hash corresponding to OUT1 and OUT2 are OUT_HASH1 and OUT_HASH2 respectively; the receivers in IN1 and IN2 are equivalent to the public key X corresponding to x; Merkel proves that P1 and P2 are included in the tree with the determined Merkel root Valid proof of IN1 and IN2; the sum of IN1 and IN2 is equal to the sum of OUT1 and OUT2; and hash (IN1, x) is equal to NULLIFIER1, hash (IN2, x) is equal to NULLIFIER2

Token deposit and withdrawal

  • Given a Merkel tree, two hash values ​​OUT_HASH1 and OUT_HASH2, two other hash values ​​NULLIFIER1 and NULLIFIER2, and a delta value.
  • It is known that for IN1, IN2, OUT1, and OUT2, four UTXOs are counted, two Merkel proofs P1 and P2, and a private key x,
  • Then the hash values ​​corresponding to OUT1 and OUT2 are OUT_HASH1 and OUT_HASH2; the transaction receivers in IN1 and IN2 are equivalent to the public key X corresponding to the private key x; Merkel proves that P1 and P2 have a given hash root Valid proof of the merkel tree containing IN1 and IN2; the number of IN1 and IN2 is equal to OUT1, the sum of OUT2 plus the delta value; hash (IN1, x) is equal to NULLIFIER1; hash (IN2, x) is equal to NULLIFIE2R.

Transaction Fees

future development

Pay

Decoupling signature and proof

  • Given Merkel root, two hashes OUT_HASH1 and OUT_HASH2, and two other hashes NULLIFIER1 and NULLIFIER2
  • It is known that there are four UTXOs IN1, IN2, OUT1, OUT2, two Merkel proofs P1 and P2, a decryption key d and a signature s.
  • The hash values ​​corresponding to OUT1 and OUT2 are OUT_HASH1 and OUT_HASH2; the receivers in IN1 and IN2 are equivalent to the public key X corresponding to d; Merkel proves that P1 and P2 are the Merkel tree of the given hash root and contain IN1 , Valid proof of IN2; the sum of IN1 and IN2 is equal to the sum of OUT1 and OUT2; hash (IN1, d) is equal to NULLIFIER1; hash (IN2, d) is equal to NULLIFIER2, s is message (IN1, IN2, OUT1, OUT2 ) Signature and is valid for d.

Support more tokens

Conclusion

--

--

--

区块链新闻,比特币行情,比特币价格分析,数字货币新闻资讯

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

TOKENPLAY DEVELOPMENT STRATEGY IN 2022

Why is Blockchain so important

Why This New Platform Could Capture a Large Share of the $51 Billion Online Gambling Market

Is Blockchain the answer to loyalty programs?

DeFi Series ⅕ — What Is DeFi?

This is the 45th conversation of #block101-S2#-

How Will Blockchain Disrupt Online Gambling?

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
比特币新闻 — 区块链新闻

比特币新闻 — 区块链新闻

区块链新闻,比特币行情,比特币价格分析,数字货币新闻资讯

More from Medium

Event Recap — Haverford Idea Hack

Offseason Amendments 2022

Create Your Own Token and SOL on Solana

How to make money Using Launch Jacking?