For the complete documentation index, see llms.txt.
Skip to main content

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.

The protocol ships a built-in account contract using the same pattern: see account deployment for how initializerless accounts work and creating accounts for using them from Aztec.js.