Immutables via Salt
Aztec contracts can commit immutable values directly into the contract's address by encoding them into the deployment salt, removing the need for a separate initialization transaction.
Overview
Rather than storing immutables in private storage (which requires an initializer function and an extra transaction), the aztec-immutables-macro library encodes them into the contract's salt:
salt = poseidon2_hash([actual_salt, constant_0, constant_1, ...])
Since the salt is part of the address derivation, the immutable values become cryptographically bound to the contract's address itself.
Key benefits
- No initialization transaction — immutables are committed at deployment time, not in a separate setup call
- Runtime verification — at execution time, capsule data is loaded and verified against the stored salt, ensuring data integrity
- Persistent storage — immutables are persisted to the PXE's CapsuleStore after deployment, so capsules don't need to be attached to every transaction
- Compatible with standard storage — works alongside
#[storage]and initializers when needed
Performance
Initialization cost is completely eliminated (no constructor transaction). The per-transaction overhead is approximately 1,098 gates (+0.2%) in the account entrypoint.
Getting started
For installation instructions, usage examples, and a reference implementation of an initializerless Schnorr account contract, see the aztec-immutables-macro README.