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

Поделиться
HTML-код
  • Опубликовано: 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!

  • @csebastian3
    @csebastian3 Год назад +1

    This explanation was excellent! Thank you.

  • @clementdean5157
    @clementdean5157 2 года назад +1

    Great video! Keep on going man!

  • @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

  • @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 !!!

  • @zobberdog6990
    @zobberdog6990 2 года назад +2

    Love the diagrammatic analysis, makes it simplier

  • @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

  • @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.

  • @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

  • @topworld6802
    @topworld6802 Год назад

    Excellent explain.

  • @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

  • @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

  • @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.

  • @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!

  • @PaulFidika
    @PaulFidika Год назад +3

    The US government: tHiS maTh iS ilLegal!

  • @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  5 месяцев назад

      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

  • @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

  • @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??

  • @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

  • @cigulev
    @cigulev 11 месяцев назад

    It was soooo goodie

  • @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

  • @japservice1053
    @japservice1053 Год назад +1

    Rocket 🚀 🚀 🚀

  • @Reason4Termination
    @Reason4Termination 2 года назад +1

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

    • @Bryrye236
      @Bryrye236 26 дней назад

      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.

  • @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.

  • @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.

  • @6365bharath
    @6365bharath 6 дней назад

    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  День назад

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

  • @todayscreator8662
    @todayscreator8662 Год назад

    great video

  • @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

  • @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.

  • @saiaditya4397
    @saiaditya4397 Год назад

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

  • @BlackSkyMusicTV
    @BlackSkyMusicTV 2 года назад

    How long should you wait to withdraw l?

  • @ratha22
    @ratha22 2 года назад

    This is only for Eth, How about Bitcoin,

  • @user-mc7xd7qh1q
    @user-mc7xd7qh1q Год назад

    Now they banned it. Sad

  • @justkaz7104
    @justkaz7104 9 месяцев назад

    912

  • @naufaldbei4234
    @naufaldbei4234 Год назад

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

  • @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.

  • @liffidmonky1216
    @liffidmonky1216 8 месяцев назад +1

    Have you done the video about zk-SNAKRS?

  • @irshad2879
    @irshad2879 2 года назад

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