Tornado Cash - How it Works | DeFi + Zero Knowledge Proof

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ส.ค. 2021
  • This video explains how Tornado Cash uses zk-SNARK to protect privacy.
    Deposit 0:45
    Why does everyone deposit the same amount of ETH? 1:52
    Wrong way to withdraw 2:46
    Correct way to withdraw - zero knowledge proof 4:04
    Nullifier? 5:17
    How is deposit hash (commitment) stored? 6:58
    How to build a Merkle tree 7:19
    Merkle tree in Tornado Cash 7:53
    How to insert commitment into Merkle tree of Tornado Cash 8:32
    How to prove commitment is in the Merkle tree 10:18
    Tools used by Tornado Cash (Circom, snarkjs) 11:51
    tornado.cash/
    github.com/tornadocash/tornad...
    #Solidity #SmartContract #TornadoCash #ZeroKnowledgeProof #Ethereum #スマートコントラクト
    Follow
    / programmersmart
    / discord
    t.me/smartcontractprogrammer
    smartcontractprogrammer.com
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 88

  • @smartcontractprogrammer
    @smartcontractprogrammer  2 ปีที่แล้ว +9

    Deposit 0:45
    Why does everyone deposit the same amount of ETH? 1:52
    Wrong way to withdraw 2:46
    Correct way to withdraw - zero knowledge proof 4:04
    Nullifier? 5:17
    How is deposit hash (commitment) stored? 6:58
    How to build a Merkle tree 7:19
    Merkle tree in Tornado Cash 7:53
    How to insert commitment into Merkle tree of Tornado Cash 8:32
    How to prove commitment is in the Merkle tree 10:18
    Tools used by Tornado Cash (Circom, snarkjs) 11:51

  • @patricklao9762
    @patricklao9762 ปีที่แล้ว +3

    just wanted to say your videos have been super helpful. please keep creating them. thank you!

  • @kjack1932
    @kjack1932 2 ปีที่แล้ว +6

    Nice work as always. Your channel will blow up as DeFi continues to see more adoption. Keep it up 👍🏾

    • @t-jayconceptventures8895
      @t-jayconceptventures8895 ปีที่แล้ว +1

      MESSIER M87 IS THE BEST CRYPTOCURRENCY OF 2022-23. 1000X FOR LONG TERM HOLDERS. @messierM87 #M87 #cultdao #shiba #shibainu #shibarium #hex #pulsechain #pulsex #volt #eth #ada #kiba #crypto #1000x

  • @csebastian3
    @csebastian3 ปีที่แล้ว +1

    This explanation was excellent! Thank you.

  • @clementdean5157
    @clementdean5157 2 ปีที่แล้ว +1

    Great video! Keep on going man!

  • @isaac-wv4ti
    @isaac-wv4ti 2 ปีที่แล้ว +8

    youre a gem, taz. thank you

  • @jessebusma5339
    @jessebusma5339 ปีที่แล้ว +1

    AMAZING SIMPLE EXPLANATION

  • @dev.regotube
    @dev.regotube 2 ปีที่แล้ว +1

    仕組みの動画待ってました!

  • @cryptoholictrades6121
    @cryptoholictrades6121 2 ปีที่แล้ว +2

    You are a G ! Respect !!!

  • @khanghoang377
    @khanghoang377 ปีที่แล้ว

    Thank you for your video, it's really helpful

  • @DarianCraciun
    @DarianCraciun 2 ปีที่แล้ว +7

    Hi! First off, I want to say that your channel is a gold mine for blockchain programming! Keep up the good work!
    I have one question related to this vid: Does a (successful) withdrawal action change the Merkle tree?

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 ปีที่แล้ว +1

      no, only deposits

    • @DarianCraciun
      @DarianCraciun 2 ปีที่แล้ว +1

      @@smartcontractprogrammer Thanks, I was thinking so after a quick look over the source code, but wasn't sure.

  • @PaulFidika
    @PaulFidika ปีที่แล้ว +3

    The US government: tHiS maTh iS ilLegal!

  • @kalinduabeysinghe8917
    @kalinduabeysinghe8917 2 ปีที่แล้ว +1

    Beautifully explained

    • @t-jayconceptventures8895
      @t-jayconceptventures8895 ปีที่แล้ว +1

      MESSIER M87 IS THE BEST CRYPTOCURRENCY OF 2022-23. 1000X FOR LONG TERM HOLDERS. @messierM87 #M87 #cultdao #shiba #shibainu #shibarium #hex #pulsechain #pulsex #volt #eth #ada #kiba #crypto #1000x

  • @zobberdog6990
    @zobberdog6990 2 ปีที่แล้ว +2

    Love the diagrammatic analysis, makes it simplier

  • @wrenchplays5698
    @wrenchplays5698 2 ปีที่แล้ว +1

    Really amazing video I became a fan in 1 day....please please can you make a fully detailed video about flash loan arbitrage using AAVE or DYDX please....
    Lots of love form india

  • @topworld6802
    @topworld6802 ปีที่แล้ว

    Excellent explain.

  • @barmooj
    @barmooj 6 หลายเดือนก่อน

    Thanks for the video, it's been 2 years and it still rocks!
    I have a question, why Merkle tree? can't a simple map store the "coin" hash and a simple index to be used instead of passing the root?

    • @smartcontractprogrammer
      @smartcontractprogrammer  6 หลายเดือนก่อน

      If I remember correctly, I think the point of using a merkle tree is that it can be used with zero knowledge proof so that no one except the sender knows which merkle leaf they are spending

  • @romanstorm4046
    @romanstorm4046 2 ปีที่แล้ว +1

    Great video!

    • @t-jayconceptventures8895
      @t-jayconceptventures8895 ปีที่แล้ว +1

      MESSIER M87 IS THE BEST CRYPTOCURRENCY OF 2022-23. 1000X FOR LONG TERM HOLDERS. @messierM87 #M87 #cultdao #shiba #shibainu #shibarium #hex #pulsechain #pulsex #volt #eth #ada #kiba #crypto #1000x

  • @salem232
    @salem232 2 ปีที่แล้ว +1

    😍 awesome follow up video !! Visual was super helpful ~~ although my mind is still spinning in tornado trying to think about it !! By the way, 🦁 is protesting ~

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 ปีที่แล้ว +1

      Leo the Lion asked Charlie the Cat to deposit for him

    • @salem232
      @salem232 2 ปีที่แล้ว +2

      @@smartcontractprogrammer 🤣🤣

    • @startat3098
      @startat3098 2 ปีที่แล้ว +1

      @@salem232 LOL you are the stable member of his great videos!

    • @salem232
      @salem232 2 ปีที่แล้ว +2

      @@startat3098 😎 I have OG memership

    • @startat3098
      @startat3098 2 ปีที่แล้ว +1

      @@salem232 Plus one!

  • @newbreedofgeek
    @newbreedofgeek 2 ปีที่แล้ว +5

    This is incredible!
    But you mentioned that the withdrawer needs the proof and the nullifier to take out funds and the contract uses the nullifier to make sure double spend does not happen.
    But as the withdrawer is providing the nullifier, can’t this be used to identify the depositor? Ie as she knew the the nullifier and sent the proof - we can just compare nullifiers and identify them?

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 ปีที่แล้ว +4

      nullifier hash is provided into the smart contract.
      nullifier is part of the zero knowledge proof.
      no knowledge is leaked.

  • @manuelbyrne
    @manuelbyrne 2 ปีที่แล้ว +2

    ps: could we make a tornado cash smart contract in other chains, like avalanche and fantom, or even on layer 2 like Polygon??

  • @cigulev
    @cigulev 11 หลายเดือนก่อน

    It was soooo goodie

  • @DevrajSinghRawat
    @DevrajSinghRawat 2 ปีที่แล้ว +1

    Mind blowing

    • @t-jayconceptventures8895
      @t-jayconceptventures8895 ปีที่แล้ว

      MESSIER M87 IS THE BEST CRYPTOCURRENCY OF 2022-23. 1000X FOR LONG TERM HOLDERS. @messierM87 #M87 #cultdao #shiba #shibainu #shibarium #hex #pulsechain #pulsex #volt #eth #ada #kiba #crypto #1000x

  • @troykessler3188
    @troykessler3188 2 ปีที่แล้ว +18

    Really great video! I just have one question, if we ask tornado for the c2 hash in order to provide the hashes to zk-snark, wouldn't it know that we are looking for the c3 hash and therefore revealing our identity? Or is there something I'm missing?

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 ปีที่แล้ว +12

      All commitments are logged
      github.com/tornadocash/tornado-core/blob/master/contracts/Tornado.sol#L69
      So the merkle tree can be built offchain without querying the contract

    • @nuritas8424
      @nuritas8424 ปีที่แล้ว +5

      Awesome question

  • @manuelbyrne
    @manuelbyrne 2 ปีที่แล้ว +2

    Thanks for the video! I would love to watch you program a clone of tornado cash, and see in code this explanation work!! Do you think you can do it? Cheers

  • @japservice1053
    @japservice1053 ปีที่แล้ว +1

    Rocket 🚀 🚀 🚀

  • @makkm322
    @makkm322 2 ปีที่แล้ว +2

    Hey Taz can you clarify, the merkle root is a public parameter? And the rest of the hashes are private? Or are only the initial hashes of the secret and nullifier public only? But if the all the initial hashes are public anyone can find out the hash of the merkle root, right?

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 ปีที่แล้ว +1

      merkle root is public
      github.com/tornadocash/tornado-core/blob/master/contracts/MerkleTreeWithHistory.sol#L31
      hashes (commitments) used to construct the merkle tree is public
      > But if the all the initial hashes are public anyone can find out the hash of the merkle root, right?
      yes
      proving that your hash is in the merkle tree is zero knowledge

    • @makkm322
      @makkm322 2 ปีที่แล้ว +1

      @@smartcontractprogrammer Thanks, that makes more sense

    •  2 ปีที่แล้ว +5

      @@smartcontractprogrammer Hi, I still don't get the point. If hashes are public, anyone can see hashes of c2 and c3 (example from video) and construct the merkle root.

    • @enricobottazzi8350
      @enricobottazzi8350 2 ปีที่แล้ว +3

      @ Same question here, how do I actually prove that my hash is in the merkle tree?

    • @mikiw42
      @mikiw42 ปีที่แล้ว

      @ there is a bug there in my opinion, at the lowest level you don't store a c0, c1 etc you store h(c0), h(c1) etc... this is how it works

  • @hgfuhgvg
    @hgfuhgvg ปีที่แล้ว

    How to hide the connections between the tx that deposited and one that withdrew w.r.t. tx fee? Both need fee which needs to come from *somewhere*. This fee source can be used to link deposits and withdrawals.

  • @Reason4Termination
    @Reason4Termination 2 ปีที่แล้ว +1

    The best tool for scammers, hackers, and robbers! :D

    • @Bryrye236
      @Bryrye236 28 วันที่ผ่านมา

      Cars are very useful to these types of people as well. Along with cellphones, computers, guns, costumes, boats, mail, email etc. The list goes on and on. Yet nobody ever suggests we get rid of these things, except for guns. I think the motivation to get rid of guns is the same one trying to ban crypto and privacy block chains.

  • @6365bharath
    @6365bharath 8 วันที่ผ่านมา

    At the end you said without revealing c3, we are able to prove. But we had to pass c3 and the other hashes right?

    • @smartcontractprogrammer
      @smartcontractprogrammer  3 วันที่ผ่านมา

      I don't remember but I think yes. You need to pass your hash and the Merkle proof that includes your hash

  • @pawekedzia1223
    @pawekedzia1223 2 ปีที่แล้ว +7

    I don't understand one thing, the whole Merkle tree with all of the leaves' hashes is public, so anybody can generate proof for any leaf hash. C3 hash is also public so I can take, c2, z1, z2 and generate the proof. That doesn't prove that I know the secret and nullifier for c3.
    How does the tornado cash algorithm know that I actually know the secrets and nullifier for that c3 leaf?

    • @mattdaf1sh195
      @mattdaf1sh195 2 ปีที่แล้ว +2

      yea i also dont understand this

    • @enricobottazzi8350
      @enricobottazzi8350 2 ปีที่แล้ว +2

      @@mattdaf1sh195 Same here

    • @mikiw42
      @mikiw42 ปีที่แล้ว

      there is a bug there in my opinion, at the lowest level you don't store a c0, c1 etc you store h(c0), h(c1) etc... this is how it works

    • @barmooj
      @barmooj 6 หลายเดือนก่อน

      It's one year later though here is the answer. Since hashes are not reversible even if you know c3 you cannot figure out the seed and thus the secret and nullifier.
      And to generate the proof you need that exact secret and nullifier.

  • @jejunegamingtv1359
    @jejunegamingtv1359 2 ปีที่แล้ว

    this video is a gem. zk-snark videos please!

  • @nomadshiba
    @nomadshiba ปีที่แล้ว

    how can you generate the root hash, if you only have your own hash?
    you dont have any of the other hashes, thats where im lost
    EDIT: oh ok figured it out

  • @saiaditya4397
    @saiaditya4397 ปีที่แล้ว

    would love to listen more about the zk smart contract creation..

  • @todayscreator8662
    @todayscreator8662 ปีที่แล้ว

    great video

  • @GymRatCrypto
    @GymRatCrypto ปีที่แล้ว

    hey im doing a show on tornado cash today - id love to have you on - ill be showing this video on stream

  • @BlackSkyMusicTV
    @BlackSkyMusicTV 2 ปีที่แล้ว

    And I’m not getting what you mean with wrong way to withdrawal.. there is only 1 way, pasting they key that is given at the time of deposit , at least that’s all I saw

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 ปีที่แล้ว

      wrong way to implement a withdraw, a withdraw that doesn't protect privacy

    • @BlackSkyMusicTV
      @BlackSkyMusicTV 2 ปีที่แล้ว

      @@smartcontractprogrammer but there is only 1 way to withdrawal which is using the key note , that’s it.

  • @BlackSkyMusicTV
    @BlackSkyMusicTV 2 ปีที่แล้ว

    How long should you wait to withdraw l?

  • @justkaz7104
    @justkaz7104 9 หลายเดือนก่อน

    912

  • @user-mc7xd7qh1q
    @user-mc7xd7qh1q ปีที่แล้ว

    Now they banned it. Sad

  • @naufaldbei4234
    @naufaldbei4234 ปีที่แล้ว

    Will we ever see the next episode now that tornado has been sanction by the us government?

  • @ratha22
    @ratha22 2 ปีที่แล้ว

    This is only for Eth, How about Bitcoin,

  • @Hmmm313
    @Hmmm313 2 หลายเดือนก่อน

    Wtf did i just watched???😅😅😅

  • @THEH2OFORMULA
    @THEH2OFORMULA ปีที่แล้ว

    This is the old dial up internet system. VPN for crypto wallet is coming soon please.

  • @irshad2879
    @irshad2879 2 ปีที่แล้ว

    Nice work. Looking forward to future videos on zk-snarks

  • @liffidmonky1216
    @liffidmonky1216 8 หลายเดือนก่อน +1

    Have you done the video about zk-SNAKRS?