Shielded Notes Model
Shielded Notes Model - Technical Specification
This document describes the shielded notes model, the fundamental data structure for private transactions in the Roru Protocol.
Note Structure
Core Note Format
Note Definition:
pub struct Note {
pub value: u64, // Transaction amount
pub recipient: ShieldedAddress, // Recipient address (encrypted)
pub randomness: Scalar, // Random value for commitment
pub nullifier_key: Scalar, // Key for nullifier generation
pub timestamp: u64, // Creation timestamp
pub asset_id: AssetId, // Asset identifier
}Note Components
Value:
Amount in smallest unit
Range: 0 to 2^64 - 1
Hidden in commitment
Verified in proof
Recipient:
Shielded address format
Encrypted representation
Cannot be linked to public address
Privacy-preserving
Randomness:
Random scalar value
Ensures commitment uniqueness
Prevents linkability
Cryptographically secure
Nullifier Key:
Used to generate nullifier
Unique per note
Required for spending
Stored securely
Commitment Generation
Pedersen Commitment
Commitment Formula:
Where:
v= valuer= randomnessa= recipient address (hashed)G, H, J= base points on curve
Implementation:
Commitment Properties
Hiding:
Commitment doesn't reveal value
Computationally infeasible to determine value
Randomness ensures hiding
Binding:
Cannot change value without changing commitment
Commitment binds to specific note
Cryptographically secure
Additivity:
Commitments can be added homomorphically
Useful for balance verification
Enables efficient proofs
Note Lifecycle
Creation
Creation Process:
Generate randomness
Create recipient address
Generate nullifier key
Calculate commitment
Store note securely
Add to state tree
Creation Code:
Storage
Storage Format:
Encrypted on device
Commitment in state tree
Full note only on recipient device
Sender doesn't store full note
Storage Security:
Encrypted with device key
Never stored in plaintext
Secure element storage (Roru One)
Backup encryption
Spending
Spending Process:
Select note to spend
Generate nullifier
Create proof
Update state
Mark as spent
Spending Code:
Shielded Address
Address Format
Address Structure:
Address Generation
Generation Process:
Generate keypair
Derive encryption key
Calculate checksum
Encode address
Format for display
Generation Code:
Nullifier Generation
Nullifier Format
Nullifier Structure:
Generation Algorithm
Nullifier Formula:
Implementation:
Nullifier Properties
Uniqueness:
Unique per note
Cannot collide
Deterministic
Verifiable
Unlinkability:
Cannot link to note
Cannot link to address
Privacy-preserving
No information leakage
Note Encryption
Encryption Scheme
Encryption Format:
Encryption Process
Encryption Steps:
Generate ephemeral keypair
Derive shared secret
Encrypt note data
Package encrypted note
Encryption Code:
Decryption Process
Decryption Steps:
Derive shared secret
Decrypt ciphertext
Verify integrity
Reconstruct note
Decryption Code:
Multi-Asset Support
Asset Identification
Asset Format:
Asset Handling
Asset Operations:
Different assets in same tree
Asset-specific commitments
Cross-asset transfers
Asset conversion
Note Selection
Selection Algorithms
Random Selection:
Random note selection
Privacy-preserving
Unlinkable
Optimization Selection:
Select notes to minimize change
Reduce number of inputs
Optimize transaction size
Selection Code:
Privacy Properties
Privacy Guarantees
Unlinkability:
Notes cannot be linked
Transactions cannot be linked
Addresses cannot be linked
Complete unlinkability
Confidentiality:
Values hidden
Recipients hidden
Senders hidden
Complete confidentiality
Anonymity:
Sender anonymity
Recipient anonymity
Transaction anonymity
Full anonymity set
Performance
Efficiency
Operations:
Commitment: O(1)
Encryption: O(1)
Decryption: O(1)
Nullifier: O(1)
Storage:
Note size: ~128 bytes
Commitment: 32 bytes
Encrypted note: ~200 bytes
Nullifier: 32 bytes
Conclusion
The shielded notes model provides:
Privacy: Complete transaction privacy
Security: Cryptographic guarantees
Efficiency: Fast operations
Flexibility: Multi-asset support
Scalability: Efficient storage
Understanding the notes model is essential for protocol development.
Last updated
