Skip to main content
The createTokenPool() function registers an existing SPL mint with the compressed token program and creates a token pool PDA. createTokenPool() requires only fee_payer and has no mint authority constraint.
The token pool account itself requires rent, but individual compressed token accounts are rent-free.
Before we create a token pool, we need an existing SPL mint account.
Best Practice: Each mint supports a maximum of 4 token pools total. During compression/decompression operations, token pools get write-locked. Use addTokenPools() to create additional pools that increase per-block write-lock capacity.

Full Code Example

Prerequisites

Make sure you have dependencies and developer environment set up!
DependenciesMake sure you have dependencies and developer environment set up!Prerequisites & Setup

Dependencies

Alternatives:
Developer EnvironmentBy default, this guide uses Localnet.
Alternative: Using DevnetFollow these steps to create an RPC Connection. Replace <your_api_key> with your API key before running.
Get your API key here, if you don’t have one yet.

Create Token Pool

Run this script to create token pools for an SPL mint!
create-token-pools.ts

Troubleshooting

You’re trying to access a token pool that doesn’t exist.

Advanced Configuration

Create pools for multiple mints:
Create token pools for Token-2022 mints:

Next Steps

Learn how to merge multiple compressed token accounts into one to simplify state management.