I am unable to create a new topic, so I am sharing this OPSEC research here instead. Moderators: please feel free to move this to its own topic if you wish.
Best Practices for Shielded Note Management and Networking Considerations
The following are some recommendations from my independent research into best practices for shielded note management. Feedback is appreciated. I’m posting anon for this one.
Networking Considerations
I mention this first because, while it doesn’t have anything to do with note management, if you get this wrong then nothing below matters and your transactions will be linked to your IP address.
A recently leaked Chainalysis video revealed that Chainalysis runs many nodes and attempts to make connections to all other nodes on the network. Then for each new transaction they see, they log the IP address of the first node that gossiped that transaction to one of Chainalysis’ nodes. This allows Chainalysis to identify through which node a given transaction was first submitted with a high level of certainty.
It is thus of critical importance to your privacy that you DO NOT use your own personal node to broadcast your transactions, because doing so reveals that the transaction was initiated from your (node’s) IP address.
The leaked video also reveals that Chainalysis runs many public RPC servers and records the IP addresses and RPC requests of computers that use them. This means that if you unknowingly connect to one of these malicious RPCs and use it to broadcast your transaction, they will link your IP address to your transaction.
These are not hypothetical or rare attacks. These are two of the primary methods that adversaries like Chainalysis use to weaken user privacy. For nearly every transaction that takes place on every major cryptocurrency network, Chainalysis (and likely others) can do a DB query and see an associated IP address of either the node or the RPC user that submitted that transaction.
The takeaway: to best protect your privacy you should use a public, third-party node and interact with it only over a VPN or Tor.
Advanced users can use their own personal nodes to read from the chain while using public third-party nodes over VPN/Tor to write to it.
In the future perhaps we’ll see Zcash nodes implement a gossiping protocol like Dandelion, which introduces delays between gossips in order to thwart these kinds of gossip timing attacks. The leaked video suggested that such protocols are effective at thwarting these kinds of attacks in practice.
Note Management
The overarching principle behind good note management is to accomplish your task (sending, receiving, and storing money) while leaking as little information as possible. All of the following recommendations stem from this principle.
All transactions should use a standard fee chosen by a popular wallet.
Receiving money
-
Ideally always receive money to a shielded address if possible.
-
Preferably receive money to a unique shielded address.
So you do not unnecessarily reveal to a subset of people who paid you that they paid the same person.
If you MUST us a transparent address then consider the following recommendations:
-
Preferably receive money to a unique transparent address.
So you do not unnecessarily reveal that a subset of people who paid you have paid the same person. -
The only thing you ever do with a transparent UTXO is sweep it into one of your own shielded accounts.
-
When sweeping transparent UTXOs into your your shielded account, the sweep transaction should follow these recommendations.
-
A sweep transaction’s inputs should have ONLY UTXOs for a SINGLE transparent address.
So you do not unnecessarily reveal that two or more of your transparent addresses are linked. -
A sweep transaction’s inputs should have NO shielded inputs.
So you do not unnecessarily reveal that the owner of the transparent address already has a non-zero amount of shielded funds. That is, so you do not unnecessarily reveal that you are not a first-time user of the Zcash network. -
A sweep transaction’s input should have EXACTLY ONE shielded output, one that is controlled by you.
So an observer cannot know that you have more than one shielded note. This is the minimum amount of information possible for such a transaction.
-
Internal note management
Do these actions after receiving any value to your wallet and before sending any value out of your wallet.
-
Make sure all transparent UTXOs have been swept into a shielded address as outlined above.
-
Consolidation: If you have more than one shielded note then consolidate them all into a single note as follows.
-
Each consolidation transaction’s input should have EXACTLY TWO notes and its output should have EXACTLY ONE note that has the combined value (less the transaction fee).
This prevents leaking any unnecessary information about how many notes the transaction sender owns. -
Repeat until you have only one note that holds all of your shielded funds.
-
-
Note value truncation: If your single note has any non-zero decimals after the gas-price decimals, then truncate the note value as follows.
- The truncation transaction’s input should have EXACTLY ONE note in (your only note) and it’s output should have EXACTLY TWO notes out: a new primary note with the sub-gas-decimals zeroed out, and the rest in an undependable note that holds the dust. The “dust note” should be discarded.
In practice the dust can simply be sent to a shielded address in a throw-away wallet that you delete. This thwarts any dust-tracking attacks.
- The truncation transaction’s input should have EXACTLY ONE note in (your only note) and it’s output should have EXACTLY TWO notes out: a new primary note with the sub-gas-decimals zeroed out, and the rest in an undependable note that holds the dust. The “dust note” should be discarded.
Sending money to other people
Ideally you will always send money to a receiver’s shielded address. When you send money to a receiver’s shielded address:
-
The spend transaction’s input should contain EXACTLY ONE input: your one and only shielded note.
So you do not unnecessarily reveal any more information about the number of notes you have than is necessary. -
The spend transaction’s output should contain EXACTLY TWO outputs: the receiver’s shielded note, and a shielded change address for you. The change address is important: you MUST NOT spend the entirety of your input note to the receiver. You MUST send yourself a non-zero amount of change.
So you do not unnecessarily reveal what your exact shielded balance was to your receiver.
If you must send money to a receiver’s transparent address:
-
The spend transaction’s input should contain EXACTLY ONE input: your one and only shielded note.
So you do not unnecessarily reveal any more information about the number of notes you have than is necessary. -
The spend transaction’s output should contain EXACTLY TWO outputs: the receiver’s new transparent UTXO, and a shielded change address for you. As above, the change address is important.
In both cases, do not use the memo field unless absolutely necessary, as it leaks info the receiver. Retrieving memo info can also leak info to third-party RPC providers, so it best to only retrieve memo data if you need to.
After each spend of money, redo any internal note management steps that are required.
Considerations for More Advanced Threats
Ephemeral wallet hops
If it is important to you that there is no way to prove that you sent someone money, even if you are wrench-attacked into revealing your wallet private seed, the following procedure works:
- Be sure you are following recommendations from the Networking Considerations section.
- Create a new, ephemeral wallet.
- Send some funds from your existing shielded address to the shielded address in the ephemeral wallet.
- Send the funds from the ephemeral wallet to the final receiver with an empty memo field.
- Securely delete all key material related to the ephemeral wallet.
- After that, nobody, not even you, can prove that you sent money to the receiver.
Unknowns
I have not been able to wrap my head around the implications of moving funds from one shielded pool to another in an optimal information-preserving way. Any insights here would be greatly appreciated.
Tip jar
In case you’d like to support this kind of research.
orchard:
u1h3cevhydssr6crutxr4enur99l8gedg7a48wmqxua59z0j8fpfyhpjpxe5hh5f90x07desgenudgustr3fypn52qh9zxa92hzgfmt9ck
sapling:
zs1a570qynmfxh80qfnsptx2407utwk3cs7qwqnzyk8uq78udwrvwwk3q0lkv8mhjqnvw6ckwkfnwh
I appreciate any thoughts, criticisms, and other ideas you have related to note management.
Thank you.