Computation definitions and MXEs are on-chain accounts that hold rent. When you no longer need them, close them to reclaim that rent. This page covers the close lifecycle, authority rules, and common errors. For a shorter command list, see the deployment guide.Documentation Index
Fetch the complete documentation index at: https://docs.arcium.com/llms.txt
Use this file to discover all available pages before exploring further.
This page covers long-lived MXE and computation-definition accounts. To close per-computation accounts after finalization, use
claimComputationRent.Computation-definition lifecycle
A computation-definition account moves through the following states: A defaultCircuitSource::OnChain comp def starts as IncompleteOnChain (is_completed = false) and is not queueable until upload finalization marks it complete. CircuitSource::OffChain and CircuitSource::Local comp defs initialize directly as Active.
The two-step gate exists so computations queued before deactivation can drain safely. Calling deactivate-computation-definition blocks new queue_computation calls immediately; existing queued computations must finalize or expire before closing succeeds.
Deactivation TTL
TTL_SLOTS = 180 (~72s at 400 ms/slot). The TTL is identical to a Solana transaction’s signature lifetime; the constant is shared on purpose. You can close the computation definition any time after deactivation_slot + 180.
Authority
| Circuit source | Who can deactivate / close |
|---|---|
CircuitSource::OnChain | upload_auth (the keypair that uploaded the circuit buffers) |
CircuitSource::OffChain | mxe.authority |
CircuitSource::Local | mxe.authority |
close-mxe always requires mxe.authority. Rent from every close goes back to the signer keypair (-k).
Closing a computation definition
close-computation-definition is the only close command that needs --cluster-offset (-c) — the program enforces mxe.cluster == cluster_offset.
Incomplete on-chain comp defs skip the TTL
If aCircuitSource::OnChain upload was aborted before finishing, the comp def remains Incomplete and can be closed immediately, without deactivating first. This is the only way out of the two-step gate.
Raw circuit buffers (on-chain circuits only)
CircuitSource::OnChain comp defs also store circuit bytes in separate buffer accounts indexed by raw_circuit_index. Close each buffer separately with the MXE authority keypair:
Deactivated or still Incomplete. Unlike deactivating or closing the parent OnChain comp def, buffer close requires mxe.authority. Off-chain and Local comp defs store no buffers, so this step does not apply to them.
Reserved comp defs
Each MXE has reserved internal computation definitions (e.g.MxeKeygen, MxeKeyRecoveryInit). You cannot close these directly with close-computation-definition — attempting it errors with CannotCloseReservedComputationDefinition. They are closed atomically by close-mxe.
LUT entries persist across close
Closing a comp def does not close its address-lookup-table entry. Re-initializing a comp def at the same offset reuses the existing LUT slot, so close + reinit cycles do not pay rent for a new LUT.Closing an MXE
close-mxe enforces several preconditions before closing:
- MXE must not be in
Migrationstate — abort or resume the migration first. - Keygen must be finalized (
MxeKeygenNotFinalizedotherwise). - Every user-defined computation definition must be closed first. Only reserved MXE computation definitions may remain (
MxeKeygenand, if present,MxeKeyRecoveryInit). - Signer must be
mxe.authority.
close-mxe closes the MXE account, the reserved keygen comp def, the keygen computation account, the recovery cluster account, and (if present) the key-recovery-init comp def and computation — all in one transaction. Rent for every closed account returns to the signer.
Error reference
Anchor program errors are reported asError Code: <number> where the number is 6000 + <internal offset>. Internal offsets and meanings:
| Internal | Anchor surfaced | Name | Meaning |
|---|---|---|---|
| 0 | 6000 | InvalidAuthority | Signer is not the authority for this account |
| 9 | 6009 | MxeHasComputationDefinitions | close-mxe blocked: user comp defs remain |
| 10 | 6010 | MxeKeygenNotFinalized | close-mxe blocked: keygen not yet finalized |
| 306 | 6306 | ComputationDefinitionDeactivated | Cannot deactivate twice |
| 307 | 6307 | ComputationDefinitionNotDeactivated | Call deactivate-computation-definition first |
| 308 | 6308 | ComputationDefinitionHasActiveComputations | A pre-deactivation computation is still in flight |
| 309 | 6309 | ComputationDefinitionTtlNotPassed | Wait until deactivation_slot + 180 |
| 310 | 6310 | CannotCloseReservedComputationDefinition | Reserved offsets close atomically via close-mxe |
| 725 | 6725 | CannotCloseMxeDuringMigration | Abort or resume the cluster migration first |
Common mistakes
- “
ComputationDefinitionTtlNotPassed(6309)” — you’re inside the 180-slot window after deactivation. Wait ~72 s and retry. - “
ComputationDefinitionHasActiveComputations(6308)” — a computation queued beforedeactivation_slotis still in the execpool. Computations themselves expire after 180 slots; wait for it to finalize or expire and retry. - “
ComputationDefinitionNotDeactivated(6307)” — you skippeddeactivate-computation-definition. Active comp defs cannot be closed directly (the only exception isIncompleteOnChaincomp defs). - “
CannotCloseReservedComputationDefinition(6310)” — you targeted a reserved offset (MxeKeygen,MxeKeyRecoveryInit). Runclose-mxeinstead; reserved offsets close atomically as part of it. - “
MxeHasComputationDefinitions(6009)” —close-mxerequires every user-defined comp def to be closed first. Only reserved MXE computation definitions may remain (MxeKeygenand, if present,MxeKeyRecoveryInit). - “
CannotCloseMxeDuringMigration(6725)” — there’s amigrate-clusterin flight.--resumeor--abortit, then retry. - “
InvalidAuthority(6000)” — for comp defs,OnChainacceptsupload_authwhileOffChain/Localrequiremxe.authority.close-mxealways requiresmxe.authority. - “
InvalidAuthority(6000)” on buffer close —close-computation-definition-buffersalways requiresmxe.authority, even forOnChaincomp defs uploaded by a differentupload_auth. - “
close-computation-definition-buffersdid nothing” — your comp def isOffChainorLocal. There are no buffer accounts to close; skip the step. - “Forgot
--cluster-offsetonclose-computation-definition” — only that command needs-c; the program rejects mismatches againstmxe.cluster.
What’s next?
Deployment
Deploy, migrate, and close MXEs from the CLI.
Computation Definition Accounts
How comp defs are created and initialized.