nova-privacy-sdk
v1.0.1
Published
SDK for Nova Privacy - Private cryptocurrency transactions on Solana. Fork of Privacy Cash SDK.
Maintainers
Readme
Nova Privacy SDK
SDK for Nova Privacy - Private cryptocurrency transactions on Solana. Enable private deposits, withdrawals, and transfers for SOL and SPL tokens (including NOVA token).
🔗 Fork Information
This SDK is a fork of the Privacy Cash SDK.
Original Project: Privacy Cash
Original Repository: Privacy-Cash/privacy-cash-sdk
We extend our gratitude to the Privacy Cash team for their excellent work. This fork includes:
- Support for Nova Privacy program (
SHLD11qQaY6h2N3ozXUWJEJitk1zGm9tvvAC7rjxpsp) - NOVA token support with dedicated tree address
- Custom SOL and NOVA tree configurations
- Enhanced private transaction capabilities
🚀 Features
- Private SOL Transactions - Deposit and withdraw SOL privately
- Private SPL Token Transactions - Support for NOVA, USDC, USDT, and other SPL tokens
- Zero-Knowledge Proofs - Leverages zk-SNARKs for privacy
- Mainnet Ready - Fully configured for Solana mainnet
- TypeScript Support - Full TypeScript definitions included
📦 Installation
npm install nova-privacy-sdkor
yarn add nova-privacy-sdk🔧 Quick Start
import { PrivacyCash } from 'nova-privacy-sdk';
import { Keypair } from '@solana/web3.js';
// Initialize client
const client = new PrivacyCash({
RPC_url: 'https://api.mainnet-beta.solana.com',
owner: yourPrivateKey // Keypair, number[], Uint8Array, or base58 string
});
// Deposit SOL privately
const depositResult = await client.deposit({
lamports: 0.1 * 1_000_000_000 // 0.1 SOL
});
// Check private balance
const balance = await client.getPrivateBalance();
console.log('Private balance:', balance.lamports / 1_000_000_000, 'SOL');
// Withdraw SOL privately
const withdrawResult = await client.withdraw({
lamports: 0.05 * 1_000_000_000, // 0.05 SOL
recipientAddress: '9BWSPeFXTyQTPiPNWjWoaN6biqjktTmzMzqDpkEnova'
});
// Deposit NOVA token
const novaMint = new PublicKey('3SkFJRqMPTKZLqKK1MmY2mvAm711FGAtJ9ZbL6r1coin');
await client.depositSPL({
mintAddress: novaMint,
amount: 100 // 100 NOVA tokens
});📚 API Reference
SOL Transactions
deposit({ lamports })- Deposit SOL to private balancewithdraw({ lamports, recipientAddress? })- Withdraw SOL from private balancegetPrivateBalance()- Get current private SOL balance
SPL Token Transactions
depositSPL({ mintAddress, amount, base_units })- Deposit SPL tokens privatelywithdrawSPL({ mintAddress, amount, base_units, recipientAddress? })- Withdraw SPL tokens privatelygetPrivateBalanceSpl(mintAddress)- Get private balance for a specific SPL token
Utility Functions
clearCache()- Clear cached UTXO datasetLogger(logger)- Set custom logger function
⚙️ Configuration
The SDK uses environment variables for configuration. Create a .env file:
# Your forked program ID
NEXT_PUBLIC_PROGRAM_ID=SHLD11qQaY6h2N3ozXUWJEJitk1zGm9tvvAC7rjxpsp
# RPC URL (optional, defaults to public mainnet)
RPC_URL=https://api.mainnet-beta.solana.com
# Tree addresses (optional, defaults configured)
# NEXT_PUBLIC_SOL_TREE=DUnk81NBY7gUYRekT7GAwTU7jvabiVVwcMKZkRDs3dW9
# NEXT_PUBLIC_NOVA_TREE=9CJ8jwAXJ7GrYtrMmD4gXBpTC59DMX7a91yMVpz25enZ
# NEXT_PUBLIC_NOVA_MINT=3SkFJRqMPTKZLqKK1MmY2mvAm711FGAtJ9ZbL6r1coin
# NEXT_PUBLIC_NOVASOL_TREE=FZfbN2fY3aj7hTwh87dKMfuVwpaEipY3TuGpmYJnsWcG
# NEXT_PUBLIC_NOVASOL_MINT=noVaLtLjRoMLaYXom5Msk8zBmuPT7uk9m7rnKsU2bDN🌳 Supported Tokens
- SOL - Native Solana token (Tree:
DUnk81NBY7gUYRekT7GAwTU7jvabiVVwcMKZkRDs3dW9) - NOVA - Nova Privacy token (
3SkFJRqMPTKZLqKK1MmY2mvAm711FGAtJ9ZbL6r1coin, Tree:9CJ8jwAXJ7GrYtrMmD4gXBpTC59DMX7a91yMVpz25enZ) - NOVASOL - Nova SOL token (
noVaLtLjRoMLaYXom5Msk8zBmuPT7uk9m7rnKsU2bDN, Tree:FZfbN2fY3aj7hTwh87dKMfuVwpaEipY3TuGpmYJnsWcG) - USDC - USD Coin
- USDT - Tether USD
- ZEC - Zcash token
- ORE - Ore token
🔒 Privacy Features
- UTXO Model - Uses unspent transaction outputs for privacy
- Zero-Knowledge Proofs - Proves transaction validity without revealing details
- Encrypted Outputs - All transaction outputs are encrypted
- No Linkability - Transactions cannot be linked to sender or receiver
📖 Examples
Check the /example folder for complete working examples:
cd example
npm install
cp ../.env_sample .env
# Edit .env with your configuration
npx ts-node index.ts🧪 Testing
# Run unit tests
npm test
# Run end-to-end tests (requires .env with PRIVATE_KEY and RPC_URL)
npm run teste2e📋 Requirements
- Node.js version 24 or above
- Solana wallet with sufficient balance for transaction fees
⚠️ Disclaimer
This SDK has been forked from Privacy Cash and modified for Nova Privacy. While based on audited code from Privacy Cash, please fully test before using in production and be aware of inherent software risks.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
🙏 Credits
This SDK is a fork of the Privacy Cash SDK.
Privacy Cash - https://www.privacycash.org/
Original Privacy Cash SDK was audited by Zigtur. We extend our gratitude to the Privacy Cash team for their excellent work on the original SDK.
📝 License
ISC
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📧 Support
For issues and questions, please open an issue on the GitHub repository.
