- Use
get_account_interfaceinstead ofget_accountto storeAccountInterface. - Use the AMM’s
LightProgramInterfacetrait to load inactive markets when needed.
Step 1: Use get_account_interface
get_account_interface is a new RPC endpoint that returns a superset of
get_account. AccountInterface stores additional info in Option<ColdContext>
that you will need later.
Step 2: Use the LightProgramInterface trait
All rent-free programs expose aLightProgramInterface trait in their SDK.
Using this trait allows you to:
- Maintain a cache of
&[AccountInterface] - Load inactive “cold” accounts back into the onchain account space when building Swap transactions in a standardized way.
Step 3: Load cold accounts when building Swap instructions
When building Swap instructions, prepend acreate_load_instructions call.
This only adds latency if markets are cold.
Full Example
Dependencies
Code
Key Types
| Type | Source | Purpose |
|---|---|---|
Rpc trait | light-client | RPC client with get_account_interface methods |
AccountInterface | light-client | Unified hot/cold account type |
LightProgramInterface | light-client | Trait that program SDKs implement |
AccountSpec | light-client | Specifies account load requirements |
Reference Implementation
| Resource | Link |
|---|---|
| AMM Program | cp-swap-reference |
| LightProgramInterface Trait Impl | CpSwapSdk |
| Client Test | program.rs |
Hot vs Cold
| Hot | Cold | |
|---|---|---|
| On-chain | Yes | Ledger (compressed) |
| Quote | Works | Works |
| Swap | Direct | Load first / Bundle |
| Latency | Normal | +0-200ms* |
| Tx size | Normal | +100-2400 bytes* |
| CU | Normal | +15k-400k CU* |
When does a market go cold?
Accounts become “cold” after extended inactivity, causing their virtual rent balance to fall below a threshold. Once cold, they auto-compress onto the Solana ledger. They remain cold until the first client loads them back into the hot state in-flight viacreate_load_instructions.
In practice, touching cold markets is rare. The common path (“hot”) has no extra latency, tx size, or CU overhead.
Error Handling
FAQ
Do I need to change my swap instructions?
Do I need to change my swap instructions?
No. In all cases, swap instructions stay the same.
If the market is active (hot), the transaction is identical to today (UX, CU, latency, txn size,…).
If the market is inactive (cold), you additionally prepend
create_load_instructions.Can I quote cold markets?
Can I quote cold markets?
Yes.
get_account_interface is a
superset of get_account and returns the full account state via the same Account
type, regardless of whether the account is hot or cold. Quoting works all the same. Do rent-free markets increase latency?
Do rent-free markets increase latency?
Active markets (hot path): No additional latency.Inactive markets (cold): Yes, loading accounts back into Solana’s active state adds
1-200ms depending on whether a validity proof is needed. If loading multiple
cold accounts exceeds Solana’s 1232 byte limit, use Jito bundles to maintain
atomicity and reduce latency. Future updates will continue to reduce
transaction size and CU usage for loading cold accounts.
How long do accounts stay hot after loading?
How long do accounts stay hot after loading?
Accounts stay hot until they become inactive again. After extended inactivity (configurable by the program owner, e.g., 24h of no writes), their virtual rent balance falls below a threshold and miners compress them back to cold state. Each write extends the “hot” period.
Does loading cold accounts exceed Solana's txn size limit?
Does loading cold accounts exceed Solana's txn size limit?
In some cases, yes. You can detect this at runtime by inspecting the Instructions returned by
create_load_instructions.Note that the SDK deduplicates many of the account keys over the wire, so
instructions that may appear large in isolation will be incremental when
combined with other instructions, such as Swap and Deposit.If load instructions + swap instructions exceed Solana’s 1232 byte limit, send as a Jito bundle:Do RPC providers support these interface endpoints?
Do RPC providers support these interface endpoints?
Yes. The relevant RPC methods are supported by providers such as Helius and Triton and can also be self-hosted via the open-source Photon indexer, which is maintained by Helius Labs.
What if the indexer is down?
What if the indexer is down?
Hot markets work all the same as long as Solana is up. Cold accounts cannot be loaded into hot state until your indexer or RPC provider recovers.
Note that compression is cryptographically verifiable, so integrity and safety are not dependent on the indexer or any other external service beyond the onchain protocol.