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
| Ledger | Compact toolchain | Language version | Compact runtime |
|---|---|---|---|
| 8 | 0.31.1 | 0.23.0 | 0.16.0 |
| 9 | 0.34.0 | 0.26.0 | 0.19.0 |
| 9 | 0.35.0 | 0.27.0 | 0.20.0 |
| 9 | 0.36.0 and 0.36.1 | 0.28.0 | 0.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.
| Feature | Ledger | First toolchain | Needs --feature-zkir-v3 on 0.34.0 and 0.35.0 |
|---|---|---|---|
Cross-contract calls: contract type declarations, contract implements, and calls through a contract reference | 9 | 0.34.0 | No |
Events: emit and the standard event types, such as ShieldedSpend | 9 | 0.34.0 | No |
serialize and deserialize | 9 | 0.34.0 | No |
keccak256 | 9 | 0.34.0 | Only in an impure circuit, one that reads or writes ledger state or emits an event |
jubjubSchnorrVerify and JubjubSchnorrSignature | 9 | 0.34.0 | No |
JubjubScalar | 9 | 0.34.0 | No |
ecNeg | 9 | 0.34.0 | No |
Uint<0> as a type | 9 | 0.34.0 | No |
secp256k1: Secp256k1Base, Secp256k1Scalar, Secp256k1Point, secp256k1EcdsaVerify, Secp256k1EcdsaSignature, and secp256k1EthereumAddress | 9 | 0.34.0 | Yes |
kernel.caller() and PublicAddress | 9 | 0.35.0 | No |
sha512 | 9 | 0.35.0 | Yes |
secp256r1: Secp256r1Base, Secp256r1Scalar, Secp256r1Point, secp256r1EcdsaVerify, and Secp256r1EcdsaSignature | 9 | 0.35.0 | Yes |
Curve25519: Curve25519Base, Curve25519Scalar, Curve25519Point, ed25519Verify, and Ed25519Signature | 9 | 0.35.0 | Yes |
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 identifierfor a standard library name from the table, such askeccak256orJubjubSchnorrSignature. - Toolchains 0.34.0 and 0.35.0 report
unbound identifierfor the secp256k1, secp256r1, Curve25519, andsha512names when you compile without--feature-zkir-v3. - Toolchains 0.34.0 and 0.35.0 report
keccak256 is not supported in ZKIR v2when an impure circuit callskeccak256without 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.