Skip to main content
This guide is for teams building custom data pipelines (aggregators, market makers). If you just need account lookups, use get_account_interface instead.
Use the data-streaming agent skill to add Laserstream support to your project:
Add the marketplace and install:
For orchestration, install the general skill:

Architecture

Light token accounts share the same base layout as SPL Token (165 bytes), so you can use your existing parser. The streaming setup requires two gRPC subscriptions, both targeting the Light Token Program:The account subscription delivers all state changes while accounts are hot. The transaction subscription is needed to detect accounts going cold (compress_and_close changes the owner to System Program, which the account subscription no longer matches).

Parsing

For accounts with extensions, truncate to 165 bytes before parsing.

Streaming

Cargo.toml
1

Connect

2

Subscribe

Detecting transitions

Hot-to-cold

For each transaction update, find accounts whose lamport balance dropped to zero. The cache.remove call ensures only accounts you’re already tracking are processed:Two data structures:
  • cache: HashMap<[u8; 32], T> — hot account state (for quoting/routing)
  • cold_cache: HashMap<[u8; 32], AccountInterface> — cold accounts with ColdContext (for building load instructions)
cache.remove filters out unrelated closures in the same transaction. No discriminator check is needed — compress_and_close always drains lamports to zero.To build transactions that decompress cold accounts, see Router Integration.

Cold-to-hot

When a token account is decompressed, the account subscription delivers the re-created account. Match its pubkey against cold_cache:

Point queries

getAccountInfo returns null for cold accounts. get_account_interface() races hot and cold lookups and returns raw account bytes that work with your standard SPL parser:

Data layout

165 bytes base, identical to SPL Token Account.account_type = 2 at byte 165 indicates extensions follow (borsh-encoded Option<Vec<ExtensionStruct>>).

Streaming Mint Accounts