Written by
Mert Mumtaz
Published on
September 29, 2024
Copy link

Exploring NFT Compression on Solana


One of the recent advancements in the world of crypto has been the advent of digital assets — commonly referred to as non-fungible tokens or NFTs for short. NFTs allow for censorship-resistant ownership of digital assets (such as art work, game items, tickets, etc) as well as enabling vibrant peer-to-peer economies that deal with these assets. In fact, it could be argued that NFTs are the second major application to have found Product Market Fit (PMF) within crypto (after the concept of digital money).  However, NFTs aren’t without challenges. A major challenge on Solana specifically has been the cost of storing these assets on chain. While Solana benefits from very low transaction fees, storage fees are another story. For digital assets to be truly ubiquitous in the digital world, the cost of storing these assets must be as widely affordable as possible. This is where NFT compression on Solana comes in.

NFT compression enables the next-generation of crypto-powered applications by allowing developers & creators to mint large amounts of NFTs for significantly lower costs. Imagine an MMORPG where game items are tradable NFTs and the game’s economy is seamlessly integrated with the rest of the global economy. Naturally, these games would contain millions, even billions of items which would cost a fortune to mint on a blockchain like Ethereum. NFT compression makes this possible on Solana – right now.

To see how powerful this is, let’s take an example:Polygon (a scaling solution for Ethereum) currently charges about 0.05 USD for minting an NFT. This means that it would cost around 50 million dollars to mint about a billion NFTs on Polygon.

On Solana (with compression), it will cost around 0.0000005 SOL per NFT, so about 11,000 USD for a billion NFTs as of writing this.That is ~50 million dollars or about three orders of magnitude cheaper. This is the power of compression.

But how does compression work? Let’s find out.

TL;DRNFT compression lets developers & creators store the bulk of NFT data on the ledger(which is much cheaper than on-chain storage) while storing the digital fingerprint of that data on the Solana blockchain in the form of a Merkle Tree. If the indexer data is tampered with in any way, the digital fingerprint of this data won’t match the fingerprint on-chain — thereby guaranteeing data integrity.



Solana NFTs Background (Optional)

Before diving into compression, let’s first review how NFTs work on Solana. For those already experienced with Solana NFTs, feel free to skip to the next section.

Tokens on Solana utilize two types of accounts: mint accounts and token accounts. The mint account contains global information about a token, such as supply. The token account associates the token with another user account. For example, if User A receives 1500 USDC then User A’s USDC token account (which is derived from their main user account) will store those tokens. This process applies to all tokens. If I want to send 100 USDT to User A, the Transfer Program will first derive User A’s USDT token account if it doesn’t exist, or will look it up it does. It’s sort of like having a many different pouches in your main wallet in the physical world for each different currency. You store Euros on one pouch, Dollars on another, and so on — but the main wallet belongs to you, the user.



NFTs in Solana are tokens with single supply (e.g. only one exists). Metaplex has also introduced something called the Token Metadata Program which attaches a metadata account to the NFT. The metadata account includes information such as name, symbol, collection, and of course the NFT image itself. This is a pretty deep topic in itself and so we won’t go any further into it.

Compression Background

The aim of compression is to reduce the amount of data stored on-chain. This is achieved by storing the data (for example, the image metadata) in Merkle trees on the Solana ledger and storing the roots on-chain. Indexers maintain the current state of the Merkle tree by processing all transactions involving the tree. Users can quickly retrieve their data from the indexer. The on-chain root ensures that program interactions are valid and secure, and users can cross-reference the indexer data with the on-chain root to ensure the data is up-to-date and valid.

Ok – slow down, what’s a Merkle tree?

A Merkle tree is a data structure that allows you to verify the integrity of large amounts of data quickly and efficiently. It does this by breaking the data down into smaller pieces, called "leaves," and then combining those leaves into increasingly larger "nodes."

Each node in the tree represents a hash of its child nodes. The parent node then combines the hashes of its child nodes to create its own unique hash. This process is repeated until all of the leaves are combined into a single hash at the top of the tree, called the "root hash." The root hash can be used to verify that all of the data in the tree is complete and unchanged, without having to check all of the individual leaves.



Solana compression is powered by the account compression program. The program allows developers to create a Merkle tree account which will store the root hash. Then, developers can add new leaves or replace existing ones. Any leaf replacement requires a “proof path”, which is the smallest subset of the tree that contains the leaf and all nodes required to compute the root hash. The compression program checks the proof against the root hash to verify that the data is valid. This is necessary since the actual contents of tree are not stored on-chain.

In summary, the compression program allows developers to create Merkle trees and add/update items within the tree. The history of the tree is available on the Solana ledger since each action is performed via Solana transactions. The entire tree can be constructed by replaying the tree’s history if an indexer or RPC provider goes down or the developer wants to switch providers. Finally, the root of the tree is stored on-chain for data verification and security. Putting this all together, the system eliminates the need to store state on-chain, reducing cost and effectively “compressing” the data.

Note: a common concern that developers have about compression is: “well what happens if the RPC provider I’m relying on is compromised or shuts down? Am I out of luck?” The answer is no! Since all transactions are still stored on the chain itself, anyone can replay these transactions to derive the current state of the chain. You can think of RPC providers as a “cache” for convenient access to the current state.

NFT Compression

NFT compression is powered by a program called Bubblegum. Bubblegum uses the compression program to store each NFT in a Merkle tree, eliminately the need for the mint, token, and metadata accounts. This is what makes compressed NFTs so cheap!

Minting a compressed NFT is as simple as appending a new item to the Merkle tree, where each appended item will include information such as the NFT name, collection, owner, and more. On top of minting, Bubblegum also provides the following methods:

  • Transfer
  • Burn
  • Delegate, CancelDelegate
  • Burn
  • Redeem, CancelRedeem
  • Decompress
  • VerifyCreator, SetAndVerifyCreator
  • VerifyCollection, SetAndVerifyCollection

We’ve also added some documentation to help you get started with these methods, here.

Reading Compressed NFTs

The easiest way to read compressed NFTs is through the Digital Asset Standard (DAS) API, an open-source specification and system that provides a unified interface for querying tokens. The system is powered by an indexer that processes all Bubblegum transactions and stores the Merkle trees. Additionally, the API allows users to query for NFTs via creator, collection, and owner. Yes, you read that right. The DAS API doesn’t just apply to compressed NFTs, but regular Solana NFTs as well! This means that you can get on-chain mintlists or see all of the NFTs that a user or program holds in a single API call at blazing speeds.

Again, we’ve written documentation on this API and have even provided you with sample code to get started, here.

Compression Use Cases

As of writing this article, compression has only been out for a few weeks and there are amazing use cases being worked on already. Some examples:

  • Dialect is utilizing NFT compression for their in-chat sticker packs
  • Helium is utilizing NFT compression to represent their Helium Hotspots
  • Crossmint is utilizing NFT compression to airdrop hundreds of thousands of people and have a minting API for you to play with
  • Drip Haus is utilizing NFT compression for conducting mass airdrops
  • Render is considering moving over to Solana to take advantage of NFT compression to tokenize entire scene graphs for GPU rendering

Start Building the Future of Digital Assets

Excited to work with compressed NFTs? You can start building with Helius today! Helius supports NFT compression and provides the DAS API in both Devnet and Mainnet. You can generate an API key here for free, without inputting email or credit-card information — just connect your Solana wallet. Not sure how to mint a compressed NFT yet? Check out our open-source Compression Examples repository. We can’t wait to see what you build!