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 = value

  • r = randomness

  • a = 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:

  1. Generate randomness

  2. Create recipient address

  3. Generate nullifier key

  4. Calculate commitment

  5. Store note securely

  6. 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:

  1. Select note to spend

  2. Generate nullifier

  3. Create proof

  4. Update state

  5. Mark as spent

Spending Code:

Shielded Address

Address Format

Address Structure:

Address Generation

Generation Process:

  1. Generate keypair

  2. Derive encryption key

  3. Calculate checksum

  4. Encode address

  5. 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:

  1. Generate ephemeral keypair

  2. Derive shared secret

  3. Encrypt note data

  4. Package encrypted note

Encryption Code:

Decryption Process

Decryption Steps:

  1. Derive shared secret

  2. Decrypt ciphertext

  3. Verify integrity

  4. 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