Skip to main content
This guide covers working with records in snarkVM, including finding records, decrypting them, and using them in transactions.

Understanding Records

Records are encrypted data structures that represent private state on the Aleo blockchain. Each record:
  • Is encrypted to a specific address
  • Can only be decrypted with the corresponding view key
  • Becomes “spent” when used as input to a transaction
  • Contains an owner and program-specific data

Record Structure

A typical credits record:

Finding Records

Use the ledger to find records associated with a view key:

Record Filters

Filter records by spent status:

All Records

Unspent Records

Spent Records

Slow Filters

For more accurate filtering (slower but uses private key):
Use Unspent and Spent filters for performance. Use SlowUnspent and SlowSpent when you need guaranteed accuracy.

Finding Credits Records

Find unspent credits records specifically:

Decrypting Records

Decrypt ciphertext records:

Using Records in Transactions

Transfer with Private Record

Split Record

Extracting Records from Transactions

Get records from transaction outputs:

Record Ownership Verification

Check if you own a record:

Record Tags and Serial Numbers

Computing Record Tags

Computing Serial Numbers

Creating Custom Records

Create records in your own programs:
Use the custom record type:

Record Storage Patterns

Indexing Records

Caching Unspent Records

Error Handling

Handle record-related errors:

Best Practices

Select Records Efficiently

Choose the smallest sufficient record for transactions:

Batch Record Operations

Process multiple records efficiently:

Next Steps