solvoid 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +302 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.1.2] - 2026-01-29
|
|
9
|
+
|
|
10
|
+
### Documentation Enhancement
|
|
11
|
+
- Added comprehensive README.md to npm package
|
|
12
|
+
- Enhanced API documentation with usage examples
|
|
13
|
+
- Improved getting started guide for developers
|
|
14
|
+
- Added troubleshooting section and best practices
|
|
15
|
+
|
|
16
|
+
### Package Updates
|
|
17
|
+
- Included README.md in npm package distribution
|
|
18
|
+
- Enhanced developer experience with complete documentation
|
|
19
|
+
- Updated package metadata for better discoverability
|
|
20
|
+
|
|
8
21
|
## [1.1.1] - 2026-01-29
|
|
9
22
|
|
|
10
23
|
### Documentation Update
|
package/README.md
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# SolVoid Privacy SDK
|
|
2
|
+
|
|
3
|
+
Zero-knowledge privacy protocol implementation for Solana blockchain applications.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
SolVoid enables privacy-preserving transactions on Solana through advanced zero-knowledge proof systems. This SDK provides TypeScript interfaces for integrating privacy functionality into Solana applications.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Zero-Knowledge Privacy**: Anonymous deposits and withdrawals using Groth16 zk-SNARKs
|
|
12
|
+
- **Merkle Tree Commitments**: Efficient state management with Poseidon hashing
|
|
13
|
+
- **Double-Spend Prevention**: Nullifier-based protection against replay attacks
|
|
14
|
+
- **Economic Controls**: Circuit breaker mechanisms and rate limiting
|
|
15
|
+
- **Multi-Signature Security**: Threshold validation for critical operations
|
|
16
|
+
- **TypeScript Support**: Full type safety and IntelliSense support
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install solvoid
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { SolVoidClient, Connection, Keypair } from 'solvoid';
|
|
28
|
+
import { Connection as SolanaConnection } from '@solana/web3.js';
|
|
29
|
+
|
|
30
|
+
// Initialize connection
|
|
31
|
+
const connection = new SolanaConnection('https://api.devnet.solana.com');
|
|
32
|
+
const client = new SolVoidClient(connection);
|
|
33
|
+
|
|
34
|
+
// Generate commitment for deposit
|
|
35
|
+
const commitment = await client.generateCommitment();
|
|
36
|
+
|
|
37
|
+
// Create shielded deposit
|
|
38
|
+
const depositTx = await client.createDeposit({
|
|
39
|
+
commitment,
|
|
40
|
+
amount: 1000000, // 0.001 SOL
|
|
41
|
+
recipient: Keypair.generate().publicKey
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Submit transaction
|
|
45
|
+
await connection.sendTransaction(depositTx);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Core Components
|
|
49
|
+
|
|
50
|
+
### Privacy Engine
|
|
51
|
+
|
|
52
|
+
Handles zero-knowledge proof generation and verification:
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { PrivacyEngine } from 'solvoid';
|
|
56
|
+
|
|
57
|
+
const engine = new PrivacyEngine();
|
|
58
|
+
const proof = await engine.generateWithdrawProof({
|
|
59
|
+
root: merkleRoot,
|
|
60
|
+
nullifier: nullifierHash,
|
|
61
|
+
recipient: userPublicKey,
|
|
62
|
+
amount: 1000000,
|
|
63
|
+
relayer: relayerPublicKey,
|
|
64
|
+
fee: 10000
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Merkle Tree Management
|
|
69
|
+
|
|
70
|
+
Efficient Merkle tree operations for privacy commitments:
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import { MerkleTree } from 'solvoid';
|
|
74
|
+
|
|
75
|
+
const tree = new MerkleTree(depth = 20);
|
|
76
|
+
const leafIndex = await tree.insert(commitment);
|
|
77
|
+
const proof = await tree.generateProof(leafIndex);
|
|
78
|
+
const root = tree.getRoot();
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Relayer Integration
|
|
82
|
+
|
|
83
|
+
Gasless transaction support through relayer networks:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { RelayerClient } from 'solvoid';
|
|
87
|
+
|
|
88
|
+
const relayer = new RelayerClient(relayerEndpoint);
|
|
89
|
+
const tx = await relayer.submitWithdrawal({
|
|
90
|
+
proof,
|
|
91
|
+
root,
|
|
92
|
+
nullifier,
|
|
93
|
+
recipient,
|
|
94
|
+
amount,
|
|
95
|
+
fee
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## API Reference
|
|
100
|
+
|
|
101
|
+
### SolVoidClient
|
|
102
|
+
|
|
103
|
+
Main client interface for SolVoid operations:
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
class SolVoidClient {
|
|
107
|
+
constructor(connection: Connection);
|
|
108
|
+
|
|
109
|
+
// Deposit operations
|
|
110
|
+
createDeposit(params: DepositParams): Promise<Transaction>;
|
|
111
|
+
generateCommitment(): Promise<Uint8Array>;
|
|
112
|
+
|
|
113
|
+
// Withdrawal operations
|
|
114
|
+
createWithdrawal(params: WithdrawalParams): Promise<Transaction>;
|
|
115
|
+
verifyWithdrawalProof(proof: ProofData): Promise<boolean>;
|
|
116
|
+
|
|
117
|
+
// Merkle tree operations
|
|
118
|
+
getMerkleRoot(): Promise<Uint8Array>;
|
|
119
|
+
generateMerkleProof(leafIndex: number): Promise<MerkleProof>;
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### PrivacyEngine
|
|
124
|
+
|
|
125
|
+
Core cryptographic operations:
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
class PrivacyEngine {
|
|
129
|
+
generateWithdrawProof(params: ProofParams): Promise<ProofData>;
|
|
130
|
+
verifyProof(proof: ProofData, publicInputs: Uint8Array[]): Promise<boolean>;
|
|
131
|
+
generateNullifier(secret: Uint8Array): Promise<Uint8Array>;
|
|
132
|
+
poseidonHash(inputs: Uint8Array[]): Promise<Uint8Array>;
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Types
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
interface DepositParams {
|
|
140
|
+
commitment: Uint8Array;
|
|
141
|
+
amount: number;
|
|
142
|
+
recipient: PublicKey;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface WithdrawalParams {
|
|
146
|
+
proof: ProofData;
|
|
147
|
+
root: Uint8Array;
|
|
148
|
+
nullifier: Uint8Array;
|
|
149
|
+
recipient: PublicKey;
|
|
150
|
+
relayer: PublicKey;
|
|
151
|
+
fee: number;
|
|
152
|
+
amount: number;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
interface ProofData {
|
|
156
|
+
a: Uint8Array[];
|
|
157
|
+
b: Uint8Array[][];
|
|
158
|
+
c: Uint8Array[];
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Configuration
|
|
163
|
+
|
|
164
|
+
### Environment Setup
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
import { SolVoidConfig } from 'solvoid';
|
|
168
|
+
|
|
169
|
+
const config: SolVoidConfig = {
|
|
170
|
+
cluster: 'devnet', // 'mainnet-beta', 'devnet', 'testnet', 'localnet'
|
|
171
|
+
programId: 'Fg6PaFpoGXkYsidMpSsu3SWJYEHp7rQU9YSTFNDQ4F5i',
|
|
172
|
+
relayerEndpoint: 'https://api.solvoid.io/relayer',
|
|
173
|
+
commitmentLevel: 'confirmed'
|
|
174
|
+
};
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Custom Verification Keys
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
import { VerificationKeyManager } from 'solvoid';
|
|
181
|
+
|
|
182
|
+
const vkManager = new VerificationKeyManager();
|
|
183
|
+
await vkManager.loadVerificationKey('withdraw', vkData);
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Security Considerations
|
|
187
|
+
|
|
188
|
+
### Key Management
|
|
189
|
+
|
|
190
|
+
- Store private keys securely using hardware wallets or secure enclaves
|
|
191
|
+
- Use different keys for different operations (deposit, withdrawal, relayer)
|
|
192
|
+
- Implement proper key rotation policies
|
|
193
|
+
|
|
194
|
+
### Privacy Best Practices
|
|
195
|
+
|
|
196
|
+
- Generate new commitments for each transaction
|
|
197
|
+
- Use different nullifiers to prevent correlation
|
|
198
|
+
- Consider timing attacks when submitting transactions
|
|
199
|
+
|
|
200
|
+
### Audit Trail
|
|
201
|
+
|
|
202
|
+
- Maintain logs of privacy operations for compliance
|
|
203
|
+
- Implement monitoring for unusual activity patterns
|
|
204
|
+
- Regular security audits of integration code
|
|
205
|
+
|
|
206
|
+
## Testing
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
import { SolVoidTestUtils } from 'solvoid';
|
|
210
|
+
|
|
211
|
+
// Test privacy operations
|
|
212
|
+
const testUtils = new SolVoidTestUtils();
|
|
213
|
+
await testUtils.setupTestEnvironment();
|
|
214
|
+
|
|
215
|
+
const testResult = await testUtils.testWithdrawFlow({
|
|
216
|
+
amount: 1000000,
|
|
217
|
+
testnet: true
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
console.log('Test result:', testResult.success);
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Performance
|
|
224
|
+
|
|
225
|
+
### Benchmarks
|
|
226
|
+
|
|
227
|
+
- **Proof Generation**: ~100ms (depending on circuit complexity)
|
|
228
|
+
- **Proof Verification**: ~1ms (constant time)
|
|
229
|
+
- **Merkle Proof**: ~10ms (depth 20 tree)
|
|
230
|
+
- **Transaction Size**: ~2KB (including proof data)
|
|
231
|
+
|
|
232
|
+
### Optimization Tips
|
|
233
|
+
|
|
234
|
+
- Batch multiple operations when possible
|
|
235
|
+
- Use connection pooling for high-throughput applications
|
|
236
|
+
- Implement proof caching for repeated operations
|
|
237
|
+
- Consider off-chain proof generation for better UX
|
|
238
|
+
|
|
239
|
+
## Troubleshooting
|
|
240
|
+
|
|
241
|
+
### Common Issues
|
|
242
|
+
|
|
243
|
+
**Proof Verification Fails**
|
|
244
|
+
- Check verification key integrity
|
|
245
|
+
- Verify public input formatting
|
|
246
|
+
- Ensure circuit parameters match
|
|
247
|
+
|
|
248
|
+
**Transaction Too Large**
|
|
249
|
+
- Optimize proof parameters
|
|
250
|
+
- Use compression for large transactions
|
|
251
|
+
- Consider transaction batching
|
|
252
|
+
|
|
253
|
+
**Connection Issues**
|
|
254
|
+
- Verify RPC endpoint connectivity
|
|
255
|
+
- Check network configuration
|
|
256
|
+
- Implement retry logic with exponential backoff
|
|
257
|
+
|
|
258
|
+
### Debug Mode
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
import { SolVoidLogger } from 'solvoid';
|
|
262
|
+
|
|
263
|
+
const logger = new SolVoidLogger({ level: 'debug' });
|
|
264
|
+
logger.enableDebugMode();
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Contributing
|
|
268
|
+
|
|
269
|
+
We welcome contributions to the SolVoid SDK. Please see our [contributing guidelines](CONTRIBUTING.md) for details.
|
|
270
|
+
|
|
271
|
+
### Development Setup
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
git clone https://github.com/privacy-zero/solvoid.git
|
|
275
|
+
cd solvoid/sdk
|
|
276
|
+
npm install
|
|
277
|
+
npm run build
|
|
278
|
+
npm test
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## License
|
|
282
|
+
|
|
283
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
284
|
+
|
|
285
|
+
## Support
|
|
286
|
+
|
|
287
|
+
- **Documentation**: [https://docs.solvoid.io](https://docs.solvoid.io)
|
|
288
|
+
- **Issues**: [GitHub Issues](https://github.com/privacy-zero/solvoid/issues)
|
|
289
|
+
- **Discord**: [SolVoid Community](https://discord.gg/solvoid)
|
|
290
|
+
- **Email**: support@solvoid.io
|
|
291
|
+
|
|
292
|
+
## Changelog
|
|
293
|
+
|
|
294
|
+
See [CHANGELOG.md](CHANGELOG.md) for detailed version history and updates.
|
|
295
|
+
|
|
296
|
+
## Security
|
|
297
|
+
|
|
298
|
+
For security concerns, please email security@solvoid.io or use our responsible disclosure process.
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
**SolVoid Privacy SDK** - Bringing zero-knowledge privacy to Solana blockchain applications.
|