Midnight Plans Smart Contract Calls Within a Single Transaction

The upcoming upgrade would let developers connect reusable contract functions. The network’s roadmap lists private composability for the first quarter of 2027.

By SongMarketCap

Updated:

Midnight News - Midnight Plans Smart Contract Calls Within a Single Transaction

Midnight has announced an upcoming upgrade that will allow smart contracts to call one another within the same transaction. The planned feature, called contract-to-contract execution, will give developers another way to combine functions across applications built on the privacy-focused network.

Midnight expects the change to help builders extend existing contract functionality and reuse components when creating more sophisticated contracts. Its announcement did not give an activation date.

How Midnight Contracts Will Work Together

A smart contract contains code that defines operations an application can perform. With the planned feature, one contract will be able to call a function in another and use the result as part of a transaction.

The ability to combine separate components is known as composability. A developer could design an application in which one contract checks a condition and another uses the result to carry out an operation. This illustrates a possible application design, not a product announced by Midnight.

Midnight’s Compact documentation includes a simpler example: a function doubles a supplied number and passes the result to a function in another contract. The example demonstrates how one contract can call an operation defined by another and provide the information it needs.

The network also checks that the calls declared by a contract correspond to calls included in the transaction. The calling contract identifies the expected target, entry point and a cryptographic commitment tied to the call’s inputs and outputs. For the transaction to meet the relevant validity condition, each declared call must match exactly one call in the same transaction segment.

Ledger 9 and Compact Development Tools

Cross-contract calls require Ledger 9 and a compatible version of the Compact toolchain, the set of tools used to compile Midnight contracts. The documentation states that toolchains targeting Ledger 8 reject these calls during compilation.

As of the documentation’s latest update, Midnight’s Preview, Preprod and Mainnet networks run Ledger 8. Contracts using the new calls therefore cannot yet be deployed to those public networks. Compact toolchain 0.35.0 targets Ledger 9 and includes changes to the runtime interface for cross-contract calls.

The current Compact reference also describes restrictions on how contracts can call one another. A circular sequence, such as contract A calling contract B and B calling A again, fails at runtime. The documentation identifies this as a current ledger limitation.

Midnight has released Ledger 9.1.0.0 for its next network hard fork. A software release and the tools that target it are separate from activation of the corresponding capabilities on a network.

[NEWSBREAK]

Privacy and the Roadmap for Composability

Midnight uses zero-knowledge proofs to support applications that verify conditions without exposing all underlying information. Its contracts can include public state recorded on the ledger as well as private state kept on a user’s device.

The contract design determines what information is made visible. Midnight’s Compact reference notes that a cross-contract call reveals the address of the called contract and requires developers to account for disclosure when passing arguments between contracts. A connected application can therefore include both public information and private data handled outside the public ledger.

Midnight’s roadmap lists Private Composability for the first quarter of 2027. The project describes the goal as enabling contracts to call one another while retaining privacy for their respective data, allowing developers to combine private applications into larger products.