A non-custodial privacy engine for SIP-010 tokens on Stacks L2 implementing Zero-Knowledge transaction patterns with Bitcoin-compatible cryptography. Enables confidential asset transfers while maintaining audit capabilities through Merkle tree commitments.
-
Merkle Tree Structure
- 20-layer depth (1,048,576 leaf capacity)
- SHA-256 node hashing
- Zero-value initialization (0x00...32)
-
Core Mechanisms
- Deposit commitments with proof generation
- Nullifier-based withdrawal proofs
- Dynamic root updates
- Dust protection (1M-1T satoshi range)
-
Compliance Features
- Configurable token allowlists
- Transaction amount thresholds
- Principal-based ownership controls
- Transparent root history
-
Tree Parameters
MERKLE-TREE-HEIGHT: u20 ZERO-VALUE: 0x0000000000000000000000000000000000000000000000000000000000000000 MIN-DEPOSIT-AMOUNT: u1,000,000 MAX-DEPOSIT-AMOUNT: u1,000,000,000,000
-
State Model
deposits: Commitment → (leaf-index, timestamp)nullifiers: Nullifier → usage statusmerkle-tree: (level, index) → node hash
-
Cryptographic Primitives
- SHA-256 hash combinations
- Merkle proof verification (20-element proof)
- Nullifier uniqueness checks
- User transfers tokens to contract
- Generate cryptographic commitment
- Insert into next available leaf position
- Update Merkle tree nodes to root
- Record commitment metadata
(deposit commitment amount token)- Provide Merkle proof for commitment
- Verify nullifier non-existence
- Validate root consistency
- Execute token transfer
- Mark nullifier as used
(withdraw nullifier root proof recipient token amount)| Code | ID | Description |
|---|---|---|
| ERR-NOT-AUTHORIZED | u1001 | Unauthorized admin action |
| ERR-INVALID-AMOUNT | u1002 | Outside min/max deposit range |
| ERR-TREE-FULL | u1007 | Exceeds 2²⁰ leaf capacity |
| ERR-INVALID-PROOF | u1006 | Cryptographic proof mismatch |
set-allowed-token: Restrict to specific SIP-010 contractstransfer-ownership: Principal-based authority transfer- Economic parameters (hardcoded):
- Minimum deposit prevention
- Maximum deposit safety limit
-
Dust Mitigation
- Rejects deposits <1M units
- Prevents micro-transaction spam
-
Enterprise Features
- Token allowlisting
- Principal-based access controls
- Transparent root history
-
Bitcoin Compliance
- SHA-256 proofs
- UTXO-style nullifier model
- Deterministic state transitions
-
Cryptographic Safety
- All hashes use Bitcoin-native SHA256
- Zero-value initialization checks
- Proof length validation (20 elements)
-
State Integrity
- Separate deposit/nullifier maps
- Immutable tree height post-deployment
- Atomic root updates
-
Administrative Security
- Owner privilege separation
- No upgrade backdoors
- Explicit error states
-
Initializes with:
- Zero-value root
- Index counter at 0
- Empty allowlist
-
Requires:
- SIP-010 token pre-approval
- Merkle proof generator integration
- Nullifier management system