Skip to content

Instantly share code, notes, and snippets.

@gavinandresen
Last active March 8, 2021 17:45
Show Gist options
  • Save gavinandresen/a6c6311cb36e8be87745751a0b9e8a0f to your computer and use it in GitHub Desktop.
Save gavinandresen/a6c6311cb36e8be87745751a0b9e8a0f to your computer and use it in GitHub Desktop.

Minimal Viable Privacy Dapp

How much code would I have to write to make MetaMask use Tornado so I can get easy-to-use, private ETH transactions?

  1. command-line tool: connect to MetaMask-in-browser and print account balances, addresses to console
  2. Add --deposit option: figure out how many of what denonimation tornado deposits to make to zero-out account.
  3. ... use account's private key as HD MPK, use paths 86'/0'/... and 86'/1'/... to derive tornado notes (??how to get private key? Ask for 12-word backup??)
  4. ... deposit into those notes (use Thresher for any leftover balance after paying deposit transaction gas)
  5. Add option to display total balance stored in Tornado (via some magic). Q: Privacy problem if contract state queried from a single service/node?
  6. Add --send amount to_address option: derive temporary withdraw keypair
  7. ... withdraw amount sufficient for send to temporary address (smallest withdraw via relay, others can pay gas from temp address)
  8. ... send from temporary address to destination
  9. ... deposit change back into tornado (same process as --deposit)

TEST: re-import metamask wallet on another machine via 12-word backup; tool should be able to re-derive the notes and display balance stored in tornado.

All that code could be re-used in a Dapp with a nice deposit/send GUI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment