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

Compact features by ledger version

Each Compact toolchain targets one ledger version. A contract can use only the features that its toolchain includes. A feature from a newer toolchain fails to compile with an older one, often with unbound identifier. This page lists the Compact features that need a ledger 9 toolchain and the toolchain that first includes each one.

Mainnet, Preview, and Preprod run ledger 9 and use Compact toolchain 0.36.1, which includes every feature on this page. See the compatibility matrix. This page helps when you maintain a contract built for ledger 8 with toolchain 0.31.1. It also helps when a Compact reference page describes a feature that your toolchain doesn't have.

Toolchains for each ledger version​

LedgerCompact toolchainLanguage versionCompact runtime
80.31.10.23.00.16.0
90.34.00.26.00.19.0
90.35.00.27.00.20.0
90.36.0 and 0.36.10.28.00.21.0

Toolchain 0.32 was never released, and 0.33 had release candidates only, so 0.34.0 is the first ledger 9 toolchain release.

To see which toolchain you compile with, run compact compile --version. To see its language version, run compact compile --language-version.

Features that need ledger 9​

None of these features compile with toolchain 0.31.1. The last column applies only to toolchains 0.34.0 and 0.35.0. From toolchain 0.36.0, the compiler generates only ZKIR version 3, every feature here works without a flag, and passing --feature-zkir-v3 is an error.

FeatureLedgerFirst toolchainNeeds --feature-zkir-v3 on 0.34.0 and 0.35.0
Cross-contract calls: contract type declarations, contract implements, and calls through a contract reference90.34.0No
Events: emit and the standard event types, such as ShieldedSpend90.34.0No
serialize and deserialize90.34.0No
keccak25690.34.0Only in an impure circuit, one that reads or writes ledger state or emits an event
jubjubSchnorrVerify and JubjubSchnorrSignature90.34.0No
JubjubScalar90.34.0No
ecNeg90.34.0No
Uint<0> as a type90.34.0No
secp256k1: Secp256k1Base, Secp256k1Scalar, Secp256k1Point, secp256k1EcdsaVerify, Secp256k1EcdsaSignature, and secp256k1EthereumAddress90.34.0Yes
kernel.caller() and PublicAddress90.35.0No
sha51290.35.0Yes
secp256r1: Secp256r1Base, Secp256r1Scalar, Secp256r1Point, secp256r1EcdsaVerify, and Secp256r1EcdsaSignature90.35.0Yes
Curve25519: Curve25519Base, Curve25519Scalar, Curve25519Point, ed25519Verify, and Ed25519Signature90.35.0Yes

Read kernel.caller() only in a circuit that another contract calls. A top-level call from a user fails on chain when the unshielded inputs of the balanced transaction all belong to that user. See the Compact 0.35.0 release notes.

For how each feature works, see the Compact language reference and the standard library reference. For the full list of changes in each toolchain, see the Compact release notes.

Errors from a toolchain that lacks a feature​

  • Toolchain 0.31.1 reports unbound identifier for a standard library name from the table, such as keccak256 or JubjubSchnorrSignature.
  • Toolchains 0.34.0 and 0.35.0 report unbound identifier for the secp256k1, secp256r1, Curve25519, and sha512 names when you compile without --feature-zkir-v3.
  • Toolchains 0.34.0 and 0.35.0 report keccak256 is not supported in ZKIR v2 when an impure circuit calls keccak256 without the flag. An impure circuit reads or writes ledger state or emits an event.

To fix these errors, compile with the toolchain in the compatibility matrix. See Troubleshoot compiler errors.

Use these features in a contract built for ledger 8​

A contract compiled with toolchain 0.31.1 can't use any feature on this page. To add one, recompile the contract with toolchain 0.36.1. Recompiling changes the contract's verifier keys, so a deployed contract needs its new keys through its maintenance authority, or a new deployment. A maintenance update inserts verifier keys only and doesn't change the contract's ledger state. If adding the feature adds or changes ledger fields, deploy the contract again. See Recompiling a contract changes its verifier keys.