|
1 | | -# Tornado Cash Privacy Solution [](https://github.com/tornadocash/tornado-core/actions/workflows/build.yml) [](https://coveralls.io/github/tornadocash/tornado-core?branch=master) |
| 1 | +# Tornado Cash Privacy Solution for Solana |
| 2 | + |
| 3 | +A privacy solution for Solana based on zkSNARKs. It improves transaction privacy by breaking the on-chain link between the sender and recipient addresses. It uses a Solana program that accepts SOL deposits that can be withdrawn by a different address. Whenever SOL is withdrawn by the new address, there is no way to link the withdrawal to the deposit, ensuring complete privacy. |
| 4 | + |
| 5 | +[](https://opensource.org/licenses/MIT) |
| 6 | +[](https://github.com/your-username/tornado-svm/actions) |
| 7 | +[](https://your-username.github.io/tornado-svm/) |
| 8 | + |
| 9 | +## Overview |
| 10 | + |
| 11 | +To make a deposit, a user generates a secret and sends its hash (called a commitment) along with the deposit amount to the Tornado program. The program accepts the deposit and adds the commitment to its Merkle tree of deposits. |
| 12 | + |
| 13 | +Later, the user decides to make a withdrawal. To do that, the user provides a zkSNARK proof that they possess a secret to an unspent commitment from the program's Merkle tree. The zkSNARK technology allows this to happen without revealing which exact deposit corresponds to this secret. The program checks the proof and transfers the deposited funds to the address specified for withdrawal. An external observer will be unable to determine which deposit this withdrawal came from. |
| 14 | + |
| 15 | +## Features |
| 16 | + |
| 17 | +- **Privacy**: Breaks the on-chain link between sender and recipient addresses |
| 18 | +- **Non-custodial**: Users maintain control of their funds at all times |
| 19 | +- **Optimized for Solana**: Designed to be efficient with Solana's compute units |
| 20 | +- **Relayer support**: Allows third-party relayers to pay for gas fees |
| 21 | +- **Multiple denominations**: Supports different deposit amounts |
| 22 | + |
| 23 | +## Architecture |
| 24 | + |
| 25 | +The system consists of the following main components: |
| 26 | + |
| 27 | +```mermaid |
| 28 | +graph TD |
| 29 | + A[Client] -->|Interact| B[Solana Program] |
| 30 | + B -->|Store| C[Merkle Tree] |
| 31 | + B -->|Verify| D[zkSNARK Verifier] |
| 32 | + E[User] -->|Use| A |
| 33 | +``` |
| 34 | + |
| 35 | +For more details, see the [Architecture Overview](https://your-username.github.io/tornado-svm/architecture.html). |
| 36 | + |
| 37 | +## Installation |
| 38 | + |
| 39 | +### Prerequisites |
| 40 | + |
| 41 | +- Rust 1.60+ |
| 42 | +- Solana CLI 1.16.0+ |
| 43 | +- Node.js 14+ |
| 44 | + |
| 45 | +### Build |
| 46 | + |
| 47 | +```bash |
| 48 | +# Clone the repository |
| 49 | +git clone https://github.com/your-username/tornado-svm.git |
| 50 | +cd tornado-svm |
| 51 | + |
| 52 | +# Build the Solana program |
| 53 | +cargo build-bpf |
| 54 | + |
| 55 | +# Install the CLI tool |
| 56 | +cd client |
| 57 | +npm install |
| 58 | +``` |
| 59 | + |
| 60 | +## Usage |
| 61 | + |
| 62 | +### Initialize a Tornado Instance |
| 63 | + |
| 64 | +```bash |
| 65 | +# Create a new Tornado instance with a denomination of 1 SOL and a Merkle tree height of 20 |
| 66 | +npx tornado-cli initialize --denomination 1000000000 --height 20 |
| 67 | +``` |
| 68 | + |
| 69 | +### Deposit |
| 70 | + |
| 71 | +```bash |
| 72 | +# Generate a commitment |
| 73 | +npx tornado-cli generate-commitment |
| 74 | + |
| 75 | +# Deposit 1 SOL |
| 76 | +npx tornado-cli deposit --instance <INSTANCE_ADDRESS> --commitment <COMMITMENT> --amount 1 |
| 77 | +``` |
| 78 | + |
| 79 | +### Withdraw |
| 80 | + |
| 81 | +```bash |
| 82 | +# Generate a proof |
| 83 | +npx tornado-cli generate-proof --note <NOTE_PATH> --root <MERKLE_ROOT> --recipient <RECIPIENT_ADDRESS> |
| 84 | + |
| 85 | +# Withdraw to a recipient address |
| 86 | +npx tornado-cli withdraw --instance <INSTANCE_ADDRESS> --proof <PROOF> --root <MERKLE_ROOT> --nullifier-hash <NULLIFIER_HASH> --recipient <RECIPIENT_ADDRESS> |
| 87 | +``` |
| 88 | + |
| 89 | +For more detailed usage instructions, see the [Quick Start Guide](https://your-username.github.io/tornado-svm/usage/quick-start.html). |
| 90 | + |
| 91 | +## Documentation |
| 92 | + |
| 93 | +Comprehensive documentation is available at [https://your-username.github.io/tornado-svm/](https://your-username.github.io/tornado-svm/). |
| 94 | + |
| 95 | +The documentation includes: |
| 96 | + |
| 97 | +- [Architecture Overview](https://your-username.github.io/tornado-svm/architecture.html) |
| 98 | +- [Algorithms](https://your-username.github.io/tornado-svm/algorithms/) |
| 99 | +- [Data Structures](https://your-username.github.io/tornado-svm/data-structures/) |
| 100 | +- [Usage Guide](https://your-username.github.io/tornado-svm/usage/) |
| 101 | +- [API Reference](https://your-username.github.io/tornado-svm/api/) |
| 102 | +- [Development Guide](https://your-username.github.io/tornado-svm/development/) |
| 103 | + |
| 104 | +## Security |
| 105 | + |
| 106 | +The security of this program relies on the security of the zkSNARK implementation and the Merkle tree. The zkSNARK proofs ensure that only the owner of a commitment can withdraw the corresponding deposit, and the Merkle tree ensures that each commitment can only be spent once. |
| 107 | + |
| 108 | +## Performance |
| 109 | + |
| 110 | +The program is optimized for Solana's compute units: |
| 111 | + |
| 112 | +- Deposit gas cost: ~200,000 CUs |
| 113 | +- Withdraw gas cost: ~300,000 CUs |
| 114 | + |
| 115 | +## Contributing |
| 116 | + |
| 117 | +Contributions are welcome! Please feel free to submit a Pull Request. |
| 118 | + |
| 119 | +## License |
| 120 | + |
| 121 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
2 | 122 |
|
3 | 123 | Tornado Cash is a non-custodial Ethereum and ERC20 privacy solution based on zkSNARKs. It improves transaction privacy by breaking the on-chain link between the recipient and destination addresses. It uses a smart contract that accepts ETH deposits that can be withdrawn by a different address. Whenever ETH is withdrawn by the new address, there is no way to link the withdrawal to the deposit, ensuring complete privacy. |
4 | 124 |
|
@@ -176,4 +296,4 @@ zkutil setup -c build/circuits/withdraw.json -p build/circuits/withdraw.params |
176 | 296 | zkutil export-keys -c build/circuits/withdraw.json -p build/circuits/withdraw.params -r build/circuits/withdraw_proving_key.json -v build/circuits/withdraw_verification_key.json |
177 | 297 | zkutil generate-verifier -p build/circuits/withdraw.params -v build/circuits/Verifier.sol |
178 | 298 | sed -i -e 's/pragma solidity \^0.6.0/pragma solidity 0.5.17/g' ./build/circuits/Verifier.sol |
179 | | -``` |
| 299 | +``` |
0 commit comments