ποΈWhat is NFT compression on Solana?
The most cost-efficient way of minting large numbers of digital assets in crypto.
What is Compression?
Data is stored in accounts on Solana, which can be expensive. Compression offers a cost-efficient alternative by storing data directly on the Solana ledger.
NFT Compression
NFT Compression enables developers to mint large numbers of NFTs at a fraction of the cost by storing their properties on the Solana ledger instead of individual accounts. Traditionally, each NFT required its own account, which could become expensive for large collections. With compression, NFTs are stored in a Merkle tree, and the tree's validity is verified using its root hash, which is stored in a single account.
Modifications to a compressed NFT require proof to ensure that the NFT cannot be maliciously modified. The data returned by an indexer can also be verified by comparing the root hash with what is stored in the root account. For more details, see the Solana documentation and our blog explainer.
Helius simplifies NFT development by tracking compressed NFT states, providing faster look-ups, and returning data with cryptographic proof to ensure integrity.
How are compressed NFTs different?
Compressed NFTs are not native Solana tokens. They do not have a token account, mint account, or metadata.
One account exists per Merkle tree; each tree can hold millions of NFTs.
One collection can use multiple Merkle trees (recommended for larger collections).
A Merkle tree account can also hold multiple collections (not recommended).
A DAS API call is required to read any information about a compressed NFT (e.g., attributes, collection information, etc.). This would affect Solana dApps loading your assets, etc.
A compressed NFT can be converted to a regular NFT but not vice versa.
It is recommended to keep the tree size to 1 million or less for practical reasons. This is because the proof path will begin to exceed the Solana transaction account limit.
All cNFT modifications must occur through the Bubblegum program. You can refer to the methods here.
How does the indexer work?
Compressed NFT information is not stored in a traditional Solana account. Instead, all metadata is stored on a ledger, which requires indexing services to efficiently fetch the needed metadata. While it's possible to derive the current state by replaying relevant transactions, we handle this process for convenience.
The indexer monitors all Bubblegum transactions, parses them, and updates its internal state. For example, when a compressed NFT is minted, the indexer parses the transaction to extract key details such as the NFT's name, collection, and owner. If the indexer encounters a previously unseen tree or detects a missing update, it fetches the tree's transaction history and reconstructs the complete state. The indexer code can be found here.
Examples
You can get started with the following examples:
Further Reading
If you're more of a visual learner, here's a crash course on it:
Last updated