Skip to content

Releases: midnightntwrk/compact

Compact toolchain 0.31.0 (Compact language 0.23.0)

29 Apr 18:11
79e0e86

Choose a tag to compare

Compact toolchain 0.31.0

  • Date: 2026-04-28
  • Language version: 0.23.0
  • Compact runtime version: 0.16.0
  • Environment: All public Midnight environments at the time of release. For the full compatibility matrix, see the release notes overview

High-level summary

Version 0.31.0 of the Compact toolchain has workarounds for erroneous proof failures which were awkward for developers to avoid. You can update to this version with compact update (as long as it is the most recent version) or compact update 0.31.

Audience

These release notes are intended for Compact smart contract developers and for DApp developers who use the Compact runtime.

What changed

This release has workarounds for an issue where proofs would erroneously fail because of conditional branches that were not taken. It also has a number of usability improvements and some other bug fixes.

  • Operations in untaken branches are changed so that they cannot fail during proof construction
  • The language reference is now up to date with the current language version
  • for loop iteration bounds can now be generic parameters
  • The contract-info.json file now contains a description of the public ledger state

Improvements

There are several correctness and usability improvements.

Operations in untaken branches cannot fail during proof construction

Off chain and before transaction submission, a Compact circuit is "run" twice. The first time, the compiled JavaScript code is executed to collect public and private state updates. The second time, the ZKIR representation of the circuit is used along with the public and private state updates already computed in order to construct a zero-knowledge proof.

During JavaScript execution, conditional branches in the Compact code are either taken or not taken, depending on the value of the condition. During proof construction, both branches of the conditional are considered as part of the relation being proven. This could lead to erroneous proof construction failures due to the not-taken branches.

The ZKIR representation of operations in conditional branches has been changed to work around this problem, so that they cannot fail when the branch is not taken. The following operations have had workaround implemented to prevent erroneous proof failures:

  • downcasts from Uint types to smaller Uint types,
  • downcasts of Field to Uint types,
  • conversions of byte vectors to and from Field and Uint types,
  • conversions of vectors to byte vectors, and
  • uses of relational comparisons (<, <=, >, >=) with inputs that might be unknown.

The downside of these workarounds is that they can increase the size of the generated circuit. If this increase in circuit size is problematic, developers should consider moving these operations outside of conditionally executed Compact code.

These workarounds are temporary ones, a genuine fix requires a change to the ZKIR format which will be coming in a later release.

Up to date language reference

The Compact language reference found in the Midnight Network documentation has been fully revised and is now up to date with the current version of the Compact language. Use this reference for definitive answers to questions about the language.

Generic for loop iteration bounds

Compact supports iteration over a range of natural numbers, using the syntax for (const i of start..end), where i is a variable name and start (inclusive) and end (exclusive) are expressions giving the iteration bounds. The compiler must be able to determine the values of the iteration bounds at compile time. Previously, the bounds were not allowed to be generic parameters. Now this is allowed.

Ledger field layout in contract-info.json

The compiler produces a JSON file giving information about the compiled contract, such as component versions and circuits and witnesses and their signatures. This file now has a description of the contract's public ledger state.

Each ledger field has an entry containing the field name (name), the ledger path index (index) needed to find the field value, whether the field is exported (exported), the ledger-state type (storage), and the Compact type arguments to the ledger-state type (type).

This information should be suitable for language agnostic tooling (i.e., not necessarily JavaScript) to interpret a contract's public state layout.

Deprecations

None.

Breaking changes

The signature of the Compact runtime function convertBytesToUint has changed

This runtime function is used by generated code for type casts from byte vectors to unsigned integers. It is changed so that it gives better error messages in case of conversion failure. As part of this change, there is a breaking change to the API.

What changed: The maxval parameter type is changed from number to bigint to avoid silently losing precision when comparing against large result values (the result type was already bigint).

What breaks: Code in a dApp that explicitly called this function for runtime conversion will now have a runtime type error.

Required actions: Pass a JavaScript bigint value for the maxval parameter.

Fixed defect list

The following additional defects are fixed by updating to Compact toolchain 0.31.

compact-v0.5.1

25 Mar 16:05
79e0e86

Choose a tag to compare

Install compact 0.5.1

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/midnightntwrk/compact/releases/download/compact-v0.5.1/compact-installer.sh | sh

Download compact 0.5.1

File Platform Checksum
compact-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
compact-x86_64-apple-darwin.tar.xz Intel macOS checksum
compact-aarch64-unknown-linux-musl.tar.xz ARM64 MUSL Linux checksum
compact-x86_64-unknown-linux-musl.tar.xz x64 MUSL Linux checksum

Compact devtools 0.5.0

  • Date: 2026-03-17
  • Version: 0.5.0
  • Environment: Compact devtools is independent of the blockchain environment

High-level summary

Version 0.5.0 of the devtools has a pair of usability improvements. Subcommands can now be abbreviated, and the update subcommand will accept partial version numbers.

Audience

These release notes are intended for Compact smart contract developers and for DApp developers who use the Compact runtime.

What changed

There are a pair of usability improvements:

  • Subcommands can be abbreviated
  • The update subcommand can accept partial version numbers

New features

Subcommand abbreviations

The compact CLI tool now accepts abbrevaions for the subcommands. For example, compact up for "update", compact c for "compile", and compact fmt for "format".

Most subcommands have "official" aliases, like fmt for "format" and fx for "fixup". You can see these listed in the help text avaialable via compact help or compact --help.

In addition, most subcommands will also accept any prefix of the subcommand. For example compact c, compact co, compact com, etc. all work for "compile".

We have had to make some choices when a prefix is ambiguous. For example, compact c is used for "compile", not "clean".

These features were contributed by GitHub user rvcas.

Partial version numbers

The update subcommand now accepts partial version numbers. For example, compact update 0.30 with a missing patch version number will update to the latest toolchain version 0.30.x with patch number x. You do not need to know how many patch versions there have been to update to the latest.

Likewise, compact update 0 will update to the latest minor and patch version 0.x.y. This is less useful before version 1.0, when minor version updates possibly include breaking changes. But after Compact 1.0 is released, you could use compact up 1 to be on the latest patched version of Compact 1, no matter whether it was 1.4.x, 1.5.x, and so forth.

Parts of this feature were contributed by GitHub user adamreynolds-io.

Improvements

There are no other improvements than the two features mentioned above.

Deprecations

None.

Breaking changes.

None.

Known issues

This issue will be fixed in a bug fix release.

Compact toolchain 0.30.0 (Compact language 0.22.0)

17 Mar 19:49
66257b8

Choose a tag to compare

Compact toolchain 0.30.0

  • Date: 2026-03-17
  • Language version: 0.22.0
  • Compact runtime version: 0.15.0
  • Environment: Preview Testnet at time of release. For the full compatibility matrix, see the release notes overview

High-level summary

In version 0.30, the Compact toolchain now targets Midnight ledger version 8. Previous toolchain versions (e.g., 0.28 and 0.29) targeted ledger version 7. If you are compiling contracts for a ledger 8 blockchain, you should use Compact toolchain 0.30 or later. Earlier versions might work but these are untested and unsupported, and have known bugs. If you are compiling contracts for a ledger 7 blockchain, you must use Compact toolchain 0.29 or an earlier compatible one.

There is an accompanying Compact devtools release, version 0.5.0. You do not have to update the Compact devtools in order to use Compact toolchain version 0.30.0. However, the devtools update comes with some new features. If you have the devtools already installed, you can update them with the command compact self update. If you do not have the devtools already installed, you can install them with the curl command at https://github.com/midnightntwrk/compact/releases/tag/compact-v0.5.0.

Audience

These release notes are intended for Compact smart contract developers and for DApp developers who use the Compact runtime.

What changed

This release targets the new version of the Midnight ledger, version 8.0. The primary advantage is that this version of the blockchain has fixes for a number of bugs that were affecting users. In addition:

  • The compiler supports --ledger-version and --runtime-version flags
  • The compiler and fixup tool now support --compact-path and --trace-search flags
  • The standard library NativePoint type is renamed to JubjubPoint
  • It is a compiler error to use persistentHash and persistentCommit on JavaScript opaque values
  • There is a new search order for include files and modules imported from files
  • The language reference is now largely up to date with the current version of the language
  • The release notes are included in the release itself

New features

The compiler now supports --ledger-version and --runtime-version flags. The compiler and fixup tool now support --compact-path and --trace-search flags. The release notes are now included in the release itself.

Ledger and runtime version flags

Description: The compiler binary can now report the Midnight ledger version it targets, via a new --ledger-version flag. It can also now report the Compact runtime version that it will import in generated JavaScript code, via a new --runtime-version flag.

Compact smart contracts are currently compiled for a specific version of the Midnight ledger. The ledger version determines, for example, the format of the public state and the format of prover and verifier keys. Smart contracts will not in general work with a different ledger major version number than the one that they were compiled for.

The compiler can report the ledger version it targets with a new --ledger-version flag, for instance:

$ compact compile --ledger-version
ledger-8.0.0

The ledger version will correspond to a tag (or possibly a Git commit hash or branch name) from the Midnight ledger GitHub repository.

Compiler-generated JavaScript code imports a specific version of the Compact runtime to provide core language features. Until it reaches version 1.0, the Compact runtime may have breaking changes in new minor version numbers, so it is important to configure DApps to use the correct Compact runtime version. The generated JavaScript code will verify that it is using the expected version.

The compiler can report the Compact runtime version that will be imported with a new --runtime-version flag, for instance:

$ compact compile --runtime-version
0.15.0

The Compact runtime package is available from npm.

Other Compact toolchain tools, such as the format and fixup tools, do not depend on the ledger or runtime version so they will not understand these flags.

Search path flags

Description: The compiler and fixup tool now support a --compact-path flag whose value is a search path. If this flag is set, its value is used as the search path and the COMPACT_PATH environment variable is ignored. Both tools support a new --trace-search flag that will show on standard error the search order for included and imported files.

Release notes distributed with the release

Description: the release notes are distributed in the release .zip file as a Markdown document. They were previously available from the Midnight developer documentation, in the Compact release repository, and in the Minokawa project's Compact repository. Now they are also included in the .zip file artifacts that form the release.

The Compact devtools will unzip the artifacts into a subdirectory of its artifact directory. The devtools artifact directory is .compact in your home directory by default, but it can be changed by the COMPACT_DIRECTORY environment variable or the --directory command line flag to the compact devtool command.

So for example, for Apple silicon macOS, and if the default artifact directory is used, the release notes for this release will be found in ~/.compact/versions/0.30.0/aarch64-darwin/toolchain-0.30.0.md.

Improvements

The language reference document has been extensively revised so it now describes the current version of the language. The generated TypeScript code now distinguishes circuits that have prover and verifier keys from other impure circuits.

Improvement: Up to date language reference

The language reference found at https://docs.midnight.network/compact/reference/lang-ref is now largely up to date with the current version of the language.

This is a substantial rewrite and improvement of the document.

Improvement: ProvableCircuits

Description: The generated TypeScript code now includes a ProvableCircuits<PS> type and a provableCircuits field on the Contract class. ProvableCircuits contains only the circuits that have prover and verifier keys.

Previously there were only ImpureCircuits and PureCircuits in the TypeScript code. Impure ones were those that used the public ledger state or called witness functions, and pure ones were the rest. Midnight.js was using the ImpureCircuits type to get a list of the circuits that needed a proof. However, an impure circuit that is only impure because it calls witness functions (that is, it does not use the public ledger state) does not need a proof and trying to create one would fail.

The generated TypeScript code now makes a finer distinction. ProvableCircuits are the ones that need a proof. They are always impure, so they are also included in the ImpureCircuits type. Therefore, this is a non-breaking change.

This change enables a bug fix in Midnight.js.

Deprecations

None.

Breaking changes

The Compact standard library type NativePoint has been renamed to JubjubPoint. It is now a compiler error to use persistentHash or persistentCommit on opaque JavaScript values. The search order for include and external module files has been changed.

NativePoint is renamed to JubjubPoint

What changed: The standard library type NativePoint has been renamed to JubjubPoint and there are corresponding name changes for standard library circuits for creating and accessing curve points.

What breaks: Code that uses the old name will no longer compile.

The native ZK-efficient elliptic curve used in the Midnight network is Jubjub. The name NativePoint is changed to JubjubPoint to more clearly reflect the reality.

The standard library circuits nativePointX, nativePointY, and constructNativePoint have correspondingly been renamed to jubjubPointX, jubjubPointY, and constructJubjubPoint.

The Compact runtime's types NativePoint and CompactTypeNativePoint have been changed to JubjubPoint and CompactTypeJubjubPoint. The runtime also has new functions jubjubPointX, jubjubPointY, and constructJubjubPoint that correspond to the Compact circuits of the same name. Previously versions of these were implemented only in the Compact standard library and not reflected in the Compact runtime.

Required actions: Rename code that uses these identifiers. The compact fixup tool can apply the renamings to Compact code. Update a DApp's TypeScript or JavaScript implementation manually if necessary.

It is a compiler error to use persistentHash or persistentCommit on opaque JavaScript values

What changed: It is now a compiler error to use the standard library circuits persistentHash or persistentCommit directly or indirectly (e.g., via a standard library circuit that uses persistentHash in its implementation) on Compact values that contain opaque JavaScript values (Opaque<'string'> or Opaque<'Uint8Array'>). This also affects the standard library operation merkleTreePathRoot and ledger ADT MerkleTree and HistoricMerkleTree insertion operations.

What breaks: Some code that previously compiled will now be a compiler error.

Values containing Opaque<'string'> or Opaque<'Uint8Array'> cannot be correctly hashed in a ZK proof using persistentHash or persistentCommit. This would fail, in the form of a Rust crash, when the compiler tried to generate prover and verifier keys.

It is now a compiler error instead of a Rust crash.

This is a b...

Read more

compact-v0.5.0

17 Mar 18:04
66257b8

Choose a tag to compare

Install compact 0.5.0

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/midnightntwrk/compact/releases/download/compact-v0.5.0/compact-installer.sh | sh

Download compact 0.5.0

File Platform Checksum
compact-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
compact-x86_64-apple-darwin.tar.xz Intel macOS checksum
compact-x86_64-unknown-linux-musl.tar.xz x64 MUSL Linux checksum

Compact toolchain 0.29.0 (Compact language 0.21.0)

11 Feb 16:27
b4f3293

Choose a tag to compare

Compact toolchain 0.29.0 (Compact language 0.21.0)

  • Version: Compact toolchain 0.29.0, Compact language 0.21.0
  • Date: 2026-02-10
  • Environment: Preview, Preprod

High-level summary

The Compact toolchain 0.29.0 is being released today. This version compiles Compact language 0.21.0. There is a new standard library circuit, breaking changes to some standard library names, and several bug fixes.

Audience

These release notes are intended for Compact contract developers and for DApp developers who use the Compact runtime.

What changed

This version includes changes to the Compact standard library and Compact runtime, and several bug fixes.

  • There is a new standard library circuit constructNativePoint.
  • The standard library circuits NativePointX and NativePointY are renamed to nativePointX and nativePointY.
  • The syntax for external circuits (used in the standard library) has been removed.
  • The contract-info.json file now includes version strings and a flag indicating whether a circuit requires a ZK proof.
  • There are improved error messages for circuits with invalid return statements.
  • There is a bug fix for the compiler's performance when compiling certain loops.
  • There is a bug fix for minting or sending tokens where the recipient is the contract itself.
  • There is a bug fix for the fixup tool, which did not correctly find relative input files.

New features

There is a new standard library circuit.

New standard library circuit to construct NativePoints

Description: There is a new standard library circuit constructNativePoint that takes the point's x- and y-coordinates and returns the Compact NativePoint value.

The "native point" type is the ZK-friendly elliptic curve point used on the Midnight Network. This curve is currently the Jubjub curve, but that might change in future network updates. The previous Compact toolchain release introduced a NativePoint type to the standard library, with a hidden representation as a new type alias for a non-exported type.

However, this type was not fully abstract. Compact struct creation syntax was used to construct it. In this release, there is now a standard library circuit, which should be used to construct NativePoints.

In a future release, we will change the representation so that struct creation (and field access) will no longer work.

Improvements

This release included improvements to the way that the compiler works.

Improvement: The compiler now writes more details into the contract-info.json file

Description: the compiler produces an output file compiler/contract-info.json which contains information about the contract. This information is intended to be used by the compiler itself (for separate compilation), for the contract library (Midnight.js), and potentially for tools like IDEs.

This release adds version strings for the compiler, language, and runtime that the contract was compiled for.

It also adds a flag to the descriptor of each circuit telling whether the circuit needs a ZK proof or not. This allows other tools (like Midnight.js) to avoid constructing proofs when they are not necessary, and when submitting such proofs can lead to an error on the blockchain.

Improvement: There are better error messages for circuits that have invalid return statements.

The error message has been improved for circuits that had a non-[] return type, and which either had a path through the circuit that did not end with a return statement or ended with a bare return statement without a subexpression.

Previously, this error message appeared as a type error. It has been improved to directly indicate the actual source of the error.

Improvement: There is now an ARM Linux release.

There were previously pre-built binaries for ARM and x86-64 macOS and for x86-64 Linux. There is now also an ARM Linux binary.

Deprecations

None.

Breaking changes

Below is a list of breaking changes and required actions for developers.

Some standard library circuits are renamed

What changed: The standard library circuits NativePointX and NativePointY are renamed to nativePointX and nativePointY.
What breaks: Contracts that use the old names will no longer compile.

Required actions:

  • Run the 0.29 toolchain's Compact fixup tool on your contracts, via compact fixup.

You can also manually update your contracts to use the new names.

External circuit syntax is removed

What changed: The "external circuit" syntax used in the standard library has been removed from the language.
What breaks: It's hightly unlikely that you were using this, but if so it will no longer work.

The parser supported external circuit declarations, which were ones that did not have a body (there was no Compact source code implementation). Instead, the implementation was supplied by the compiler itself. It's highly unlikely that you were using this feature, because it would require modifications to the compiler and a custom build to use it.

This release removes the syntax from the language, it is now a compiler error to declare a circuit without a body.

Links and references

Fixed defect list

The following GitHub issues were fixed in the toolchain 0.29.0 release:

Compactc v0.28.0

28 Jan 17:28
b4f3293

Choose a tag to compare

Compactc v0.28.0

compact-v0.4.0

21 Jan 15:34
752fbde

Choose a tag to compare

Install compact 0.4.0

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/midnightntwrk/compact/releases/download/compact-v0.4.0/compact-installer.sh | sh

Download compact 0.4.0

File Platform Checksum
compact-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
compact-x86_64-apple-darwin.tar.xz Intel macOS checksum
compact-x86_64-unknown-linux-musl.tar.xz x64 MUSL Linux checksum

compact-v0.3.0

05 Dec 17:50
3d8c659

Choose a tag to compare

Install compact 0.3.0

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/midnightntwrk/compact/releases/download/compact-v0.3.0/compact-installer.sh | sh

Download compact 0.3.0

File Platform Checksum
compact-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
compact-x86_64-apple-darwin.tar.xz Intel macOS checksum
compact-x86_64-unknown-linux-musl.tar.xz x64 MUSL Linux checksum

Compactc v0.26.0

07 Oct 19:46
e89a73a

Choose a tag to compare

Compactc v0.26.0

Please see release notes for a detailed explanation of what has changed.

compact-v0.2.0

15 Aug 16:13
3e0ae93

Choose a tag to compare

Install compact 0.2.0

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/midnightntwrk/compact/releases/download/compact-v0.2.0/compact-installer.sh | sh

Download compact 0.2.0

File Platform Checksum
compact-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
compact-x86_64-apple-darwin.tar.xz Intel macOS checksum
compact-x86_64-unknown-linux-musl.tar.xz x64 MUSL Linux checksum