Skip to content
The issuing tutorial builds a gated token from the issuer’s side. This one takes the custodian side, where a custody system holds the asset for a client and has to handle what the issuer does with its controls. It continues with the mint from gate the holders, so $MINT and $LIST should already be exported, on the same network.
Custodian-side and issuer-side stepsThe custodian-side steps read the custody account with spl-token, which is part of the Solana CLI install. To read it from code as well, use the derive-ata and read-account scripts in the Kit, Web3.js v3, or Rust project from the issuing tutorial. The spl-token commands use $RPC_URL when it is set and devnet otherwise. The issuer-side steps run the issuing tutorial’s scripts and are marked where they appear: in a real integration another party runs them.
1

Create the custody address

A custodian holds the asset at an address it controls. Here a key file stands in for whatever your key-management backend produces; see choosing a backend for what that is in production. The custodian signs nothing in this tutorial, so it needs no SOL.
Terminal
2

Derive the token account address before it exists

The asset does not sit at your wallet address. It sits in an associated token account derived from that wallet and the mint. Two addresses are involved:
  • The wallet is what the issuer allowlists. That is the onboarding decision.
  • The associated token account holds the balance, is what the issuer freezes, and is what your reconciliation reads.
The associated token address is deterministic, so you can compute it before the account exists and set up monitoring and reconciliation ahead of the first transfer. Save the script as derive-ata.ts (in Rust, src/bin/derive-ata.rs) and run it with $CUSTODIAN.
spl-token
Deriving the custody token account before it exists
Output
Export the Associated token address it prints as CUSTODY_ATA; the reads below use it:
Terminal
If your platform rotates wallets per client or per deposit, each wallet needs allowlisting before it can receive (see custody integration).
3

Get the address onto the allowlist

Issuer side. You supply the wallet address, not the token account, and the issuer records the onboarding decision with allowlist-add:
4

Receive the asset

Issuer side again: a mint of 500 to the custody address. The token account is created and thawed in the same transaction, because the wallet is on the list.
5

Confirm what you hold

Back on the custodian side. Read the token account directly with spl-token:
spl-token
Reading the custody account after the issuer mints 500
Output
To read it from code, use the read-account script from operate the token, run with $CUSTODY_ATA:
Kit
Reading the custody account after the issuer mints 500
Output
Read two fields. Balance is the position. spl-token applies the mint’s six decimals and shows Balance: 500; the scripts print the raw amount in base units, 500000000. State is the field a custody system must handle: Initialized means the account is thawed and usable, and Frozen means it is not. If a custody system does not show this field, a failed withdrawal cannot be explained from the account state.The spl-token display output also warns that the mint has a permanent delegate, which can move the balance out of the account at any time. A custodian needs that disclosed by the issuer, and a category for such movements in its reconciliation.
6

Observe a freeze

The issuer can freeze an account you hold without your involvement, so detection has to come from monitoring the account rather than from a failed withdrawal. Issuer side:
Now read the account again:
spl-token
Reading the custody account after the issuer freezes it
Output
From code, run read-account with $CUSTODY_ATA again:
Kit
Reading the custody account after the issuer freezes it
Output
State is now Frozen. The balance is unchanged: the assets are still there but cannot move. Report a frozen position as unavailable, not as zero.Ask the issuer to restore it before you continue:
7

Reconcile at a stated commitment level

Reconciliation against a book of record needs a defined point in time, not “now.” spl-token has no --commitment flag: it reads at the commitment set in the Solana CLI config, confirmed by default. For a finalized read, keep a separate config file and pass it with -C.The config file replaces your settings rather than adding to them, so it has to name the cluster as well as the commitment. Without json_rpc_url, the read goes to mainnet, where $CUSTODY_ATA does not exist. The command below writes $RPC_URL into it when it is set, and devnet otherwise.
spl-token
Then read the account with that config:
spl-token
Reading the custody account at finalized commitment
Output
The scripts take the commitment level as their second argument, so from code run read-account with $CUSTODY_ATA finalized:
Kit
Reading the custody account at finalized commitment
Output
Use a separate config file, not solana config set --commitment finalized, for a reconciliation job, so other commands keep their own commitment.solana account returns the raw account: its lamports, owner program, and data bytes, base64-encoded, with the balance inside the data:
solana
For a list of positions across a client’s holdings:
spl-token
Use finalized for anything that feeds a book of record; see settlement and finality for why the other levels are not appropriate there.

​Production integration requirements

Everything above is a read or a single transaction. A production integration also needs continuous detection: subscribe to the accounts you hold and to the mint, where a pause is recorded, so a freeze, a pause, or a permanent-delegate transfer raises an alert before a client instruction fails on it. Custody integration lists what a custodian’s systems have to support.

​Next steps