Skip to content

WIP - Hierarchical Deterministic Note #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yoyoismee
Copy link
Contributor

This is a WIP PR.

just wanna get some feedback before I spend more time on it.

motivation

to move a large sum through Torn would require multiple notes which might become messy.
(never experience that problem myself tho since I'm not that rich)

proposed ideas

the idea is to use a BIP39 style HD wallet to deterministically create multiple notes.
together with another function to deterministically create a deposit sequence.
we can use 1 note to control any amount of funds.

implementation

genCompactNote(currency, amount, netId)

create a note that contains currency, amount, netId and newly generated mnemonic.
note that unlike normal notes amount can be any number. e.g. 420 ETH is ok

createMultipleDeposit(mnemonic, amount )

deterministically generate deposits (the object with commitment, and others info) start from idx 0.
create deposit by using idx2 as secret and idx2 +1 as nullifier

recoverDepositFromMnemonic(mnemonic, idx)

create deposit based on mnemonic, idx.

taskSplit (amount, options )

greedy based task splitting.
e.g. 420.69 via ETH torn -> 4 * 100 + 2 * 10 + 6* 0.1

next step

if Torn commu/dev think we should go ahead with this feature.
the next step would be to complete the feature by implement

  • note parser
  • deposit flow
    • take in currency amount netID
    • create an HD note with that info
    • split tasks
    • generate enough deposits
    • loop through the tasks and make a deposit with the corresponding commitment
  • not sure if we should have a withdrawal flow. since the mass withdrawal is a bad idea.
  • command line

@yoyoismee
Copy link
Contributor Author

sample result
image

@ghost
Copy link

ghost commented Apr 22, 2022

@yoyoismee This is somewhat great feature for Tornado.Cash and it is actually better approach to manage multiple deposits than the on-chain backup feature as well!

Will be including this PR as well after some refactoring of cli.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant