Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Close a mailbox

See Mailboxes for what a mailbox is and the rent it holds. This page covers the sithbit mailbox close command’s three modes: request, --finalize, and --cancel.

Closing a mailbox is not instant. It runs through a two-step, 7-day close timelock: a request starts the clock and leaves the mailbox open and receiving mail, a finalize actually closes it once the clock has elapsed, and a cancel aborts the request meanwhile. The mailbox’s rent comes back only at finalize — the request refunds nothing.

sithbit mailbox close \
  [--finalize] \
  [--cancel] \
  [--keypair <path>] \
  [--skip-preflight]

Arguments

  • --finalize (optional) — closes the mailbox once the timelock has elapsed since the request, refunding the transient pending-close account’s rent to the owner and the mailbox’s rent to its recorded funder — the owner itself on a normal mailbox, or the sponsoring domain authority on a sponsored mailbox (the CLI reads the funder from the mailbox automatically). Run before the timelock has elapsed, it is rejected on-chain. Mutually exclusive with --cancel.
  • --cancel (optional) — aborts an in-flight close request, refunding the transient account’s rent and leaving the mailbox exactly as it was. Mutually exclusive with --finalize.
  • --keypair <path> (optional) — the mailbox owner’s keypair. Defaults to the keypair in your Solana CLI config when omitted.
  • --skip-preflight (optional) — submits the transaction without a local simulation pass first.

With neither --finalize nor --cancel given, the command opens a new timelock: it stamps the request with the current chain time and creates a small transient PDA that tracks it. The mailbox stays open — mail keeps arriving, and settlement keeps working — until the request is finalized; the presence of that account is what marks the mailbox as closing.

The timelock duration

The wait between a close request and the earliest it can be finalized is a fixed 7 days. There is no flag to shorten it. It is a separate setting from the domain deactivation timelock, even though the two currently hold the same value.

Why a mailbox close waits at all: an instant rent refund made discarding a burned sending identity free, so a spammer could cycle mailboxes at no cost. The delay parks that capital for a week per identity and gives operators a window to notice. It costs an honest owner time on a rare action, not money — the rent still comes back in full. See Economics.

The one-step close is disabled

The original single-instruction CloseMailbox (discriminant 16) is refused on-chain with error 94, InstantCloseDisabled. The discriminant still decodes, so indexers replaying history resolve old transactions, but no current client can emit it and the CLI has no spelling for it. Use the request/finalize pair instead.

mailbox key close is unaffected

Closing the delegated encryption key account stays instant and still refunds its rent on the spot. That is deliberate, not an oversight: mailbox key close is the revocation path for a compromised delegated key, and a seven-day window there would leave MX servers sealing new mail to a key the owner already knows is compromised — the timelock would protect the attacker.

Examples

Request a close, starting the 7-day clock:

sithbit mailbox close --keypair <path to wallet keypair>

Change your mind and keep the mailbox:

sithbit mailbox close --cancel --keypair <path to wallet keypair>

Finalize once at least 7 days have passed, reclaiming both rents:

sithbit mailbox close --finalize --keypair <path to wallet keypair>

Errors

  • MailboxCloseAlreadyPending (error 91) — a close is already in flight for this mailbox. Cancel it before requesting another.
  • NoPendingMailboxClose (error 92)--finalize or --cancel was run with nothing pending.
  • MailboxCloseTimelockNotElapsed (error 93)--finalize was run before the 7 days elapsed.
  • InstantCloseDisabled (error 94) — the retired one-step CloseMailbox instruction was submitted.
  • --finalize and --cancel cannot be combined.

Note: a closed mailbox’s still-open message accounts persist and settle individually via mail delete, and recreating the mailbox restarts its message-id counter at zero. See Closing accounts for the full picture across every account class.