Network capabilities
What the receiving-account pattern needs, against what Midnight provides today.
The pattern is specified independently of any one network. This page records where the two currently differ, so that the gap is a document rather than an assumption someone discovers halfway through an implementation. Each entry states what the pattern wants, what exists, what this implementation does in the meantime, and how we would know the answer had changed.
Read it alongside the invariants: an invariant is a promise the protocol keeps, and an entry here is a constraint the network imposes on how it can be kept.
How to read an entry
Verification level is stated for every claim, because three different things get called "verified" and only one of them is execution:
| Level | Means |
|---|---|
| Compiled | The Compact compiler accepted or rejected a program. Establishes what the language permits, not what the chain does. |
| Source-read | Read from the implementation's source, cited to file and line. Establishes intent and construction, not runtime behaviour. |
| Executed | Observed by running against a network. The only level that establishes behaviour. |
Availability is per network. Devnet, testnet, and mainnet are separate answers, and an integrator runs on whichever one their deployment targets. An entry that says a capability exists on devnet says nothing about the others.
Every entry below was established against Compact CLI 0.5.2, compiler 0.34.0, language 0.26.0, on 2026-09-02.
Summary
| Capability | The pattern needs it for | Available? |
|---|---|---|
| Dynamic contract instantiation | An on-chain factory for accounts | No |
| Cross-contract calls | Composition across accounts | Yes, in the language; devnet reported |
| Witnesses in a cross-contract callee | Composition circuits that derive identity | No, and this is a language rule |
| Privacy of cross-contract arguments | Composing without publishing who composed | Unsettled — treat as public |
| Contract types as circuit parameters | Passing an account to a circuit | Yes |
| Enforcement of the callee witness rule | Failing early rather than late | No |
| SDK support for cross-contract calls | Building such a transaction at all | Beta only |
Coin ciphertexts on sendShielded | Pushing value to a third party | No |
Dynamic contract instantiation
The pattern needs a way to create an account per holder, so that an account is an address a third party can interact with.
Midnight provides no such mechanism. A contract's constructor cannot be invoked to
instantiate another contract: "Although each contract defines a constructor, such
constructors may not be invoked to instantiate a contract dynamically."
(midnightntwrk/midnight-architecture, proposal 0010, Further Constraints.) Contract
deployment is a transaction-level operation.
Meanwhile an account is created by a client submitting a deployment transaction, and registered afterwards so that a counterparty can confirm an address is a genuine account of this protocol rather than a lookalike. The registration is a second step that can fail independently of the first, which any implementation must handle rather than assume away.
We would know it changed if proposal 0010's constraint were lifted, or if a deploy operation appeared in the contract-callable surface.
Verification level: source-read.
Cross-contract calls
The pattern needs one account to fold another's committed aggregate, which requires reaching state that belongs to a different contract.
Midnight provides cross-contract calls in the language. A contract may call another's exported circuits through a contract-typed value, and may never read its ledger directly.
Establishing this by compiling — the following is accepted:
pragma language_version >= 0.26;
import CompactStandardLibrary;
contract Sink {
circuit foldOne(id: Bytes<32>, amount: Uint<64>): [];
}
witness secretKey(): Bytes<32>;
export ledger total: Counter;
export circuit foldInto(s: Sink, amount: Uint<64>): [] {
const me = persistentHash<Vector<2, Bytes<32>>>(
[pad(32, "nokto:id:v1"), secretKey()]);
disclose(s).foldOne(disclose(me), disclose(amount));
total.increment(1);
}
Note the caveat: a docs.midnight.network concepts page still states that cross-contract
interaction "is still under development and is not available for use at this time". That
page is stale — the language accepts the program above, and the client SDK ships call-tree
assembly. Where documentation and the compiler disagree, the compiler is the authority.
Meanwhile availability is tracked separately from usability: see SDK support below, which is the binding constraint today.
We would know it changed by recompiling the program above against a new toolchain.
Verification level: compiled. Not executed against any network by this project.
Witnesses in a cross-contract callee
The pattern needs its composition circuits to establish who is composing, which they do by deriving an identity from a secret key held as private state.
Midnight provides no way to do that in a circuit reached by a cross-contract call. A callee's "only access to private data is through the values given as its arguments" (Compact reference, Cross-contract calls).
This is the constraint that shapes the design, and it is worth being precise about why: it is a rule of the language, not a feature awaiting rollout. It does not resolve by waiting. A circuit that calls a witness can still be called directly by a holder; what it cannot be is the callee of another contract.
Meanwhile the caller keeps witness access, derives what it needs, and passes the derived value as an argument — which raises the disclosure question in the next entry.
We would know it changed if the reference dropped the restriction and a callee calling a witness compiled.
Verification level: source-read, against the language reference.
Privacy of cross-contract arguments
The pattern needs to compose two accounts without publishing which accounts composed. This is the entry that matters most, and it is the one that is not settled.
Midnight provides two answers that do not agree.
The compiler treats a cross-contract call argument as a disclosure site. Removing
disclose() from the derived identity in the program above is rejected, with the taint
traced through the hash:
potential witness-value disclosure must be declared but is not:
witness value potentially disclosed:
the return value of witness secretKey
nature of the disclosure:
contract call argument 1 might disclose a hash of the witness value
via this path through the program:
the argument to persistentHash
the binding of me
Midnight's own security guidance says such a value becomes visible: a value crosses a
public boundary through "a ledger write, a return from an exported circuit, or a
contract-to-contract call", and its on-chain visibility table answers yes for that
row (docs.midnight.network/guides/security-best-practices).
The ledger's construction suggests otherwise. A call carries a communication commitment that commits to the call's inputs and outputs under randomness sampled per call:
pub fn communication_commitment(input: AlignedValue, output: AlignedValue, rand: Fr) -> Fr {
transient_commit(
&ValueReprAlignedValue(AlignedValue::concat([&input, &output])),
rand,
)
}
(midnightntwrk/midnight-ledger, ledger/src/construct.rs.) A commitment under
per-call randomness is hiding; a plain hash of a low-entropy argument would not be.
The generated circuit sets do_communications_commitment, so the mechanism is engaged
for exactly these calls.
Meanwhile, treat a cross-contract call argument as public. The two sources disagree, the compiler and the security guide both point the conservative way, and the error of assuming privacy one does not have is far more expensive than the reverse. A design that is correct under the pessimistic reading stays correct under the optimistic one.
We would know it changed by executing a composition against a devnet and reading what the resulting transaction exposes — the experiment that settles this, and which has not been run.
Verification level: compiled and source-read. Not executed. Open.
Contract types as circuit parameters
The pattern needs to name which account is being composed with.
Midnight provides contract-typed circuit parameters. The compiler accepts
circuit foldInto(s: Sink, amount: Uint<64>), and a contract-typed ledger field
initialised in the constructor also compiles.
This contradicts proposal 0010, which states that "Circuit parameter types, circuit return types, and witness return types may not incorporate contract types." The proposal and the shipped language have diverged, and the shipped language governs.
We would know it changed by recompiling.
Verification level: compiled.
Enforcement of the callee witness rule
The pattern needs a violation of the callee witness rule to fail at compile time, where it is cheap, rather than later.
Midnight provides weaker enforcement than its documentation describes. The reference
says the compiler "eliminates from consideration any circuits that call witnesses" when
deciding whether a contract satisfies a contract type, and that a failed contract implements declaration is rejected with a compile-time error. A contract declaring
contract implements whose satisfying circuit uses a witness value compiles without
complaint.
Meanwhile do not rely on the declaration to catch the mistake. Whatever enforcement exists arrives later than the declaration, so treat the rule as one to follow rather than one that will be caught.
We would know it changed when that program stops compiling.
Verification level: compiled. Worth reporting upstream; behaviour and documentation disagree, and the documented behaviour is the more useful of the two.
SDK support for cross-contract calls
The pattern needs a client able to assemble, prove, and submit a transaction whose call tree spans several contracts.
Midnight provides that in @midnight-ntwrk/midnight-js v5, through a registry that
resolves proving artifacts across a set of compiled contracts. The published latest tag
is 4.1.1; v5 exists only as a beta.
This is the binding constraint today. The language permits the call and the network is
reported to execute it, but a client cannot build the transaction without adopting a beta
across the whole dependency set. This project pins 4.1.1.
We would know it changed when v5 publishes to latest.
Verification level: source-read, from the published registry metadata.
Coin ciphertexts on sendShielded
The pattern needs an issuer to be able to deliver value to a holder.
Midnight provides no coin ciphertext on sendShielded. A contract can name any
recipient, but only the transaction caller learns the coin's nonce, so anyone else would
have to obtain it out of band — which a protocol cannot depend on.
Meanwhile value is held by the contract and withdrawn by the holder as the caller. Custody is a consequence of this constraint rather than a preference, and it is what makes entitlement enforceable at all.
We would know it changed if a shielded send began emitting a ciphertext a recipient could scan for.
Verification level: source-read, and executed at simulator level in the contract suite.