0%
Overview page background
HomeOverviewsSolana
What are compressed NFTs?

What are compressed NFTs?

Published on 2023-01-265 min read

Compressed NFTs on Solana reduce the costs of minting and managing large numbers of NFTs by storing data in the ledger itself. Minting compressed NFTs is significantly more cost-effective than minting conventional NFTs, which creates a range of new use cases and ways to onboard more Solana active users.

This article will explain what compressed NFTs are, how they work, and how to compress your existing or new NFTs.

What are compressed NFTs?

Compressed NFTs are NFTs on Solana that store their data in a Merkle tree structure where the Merkle root is on-chain in an account and the Merkle leaves are stored in the Solana ledger (which is off-chain, but subject to consensus), rather than fully on-chain like conventional NFTs.

As with ordinary NFTs, compressed NFTs are issued and confirmed on-chain, however, Solana RPC providers are used to store and handle data off-chain to minimize storage costs.

Compressed NFTs use indexers to manage transaction data and facilitate data queries between RPCs and on-chain smart contracts. Existing smart contracts must be modified in order to interact with compressed NFTs. Alternatively, compressed NFTs may be decompressed to work with unmodified Solana programs.

Who created compressed NFTs?

Compressed NFTs are the combined creation of Solana Labs’s Merkle tree program (known as account-compression) and the Metaplex Foundation’s compressed NFTs program (known as Bubblegum).

Metaplex created the NFT standards for Solana, and the founding team was spun out of Solana Labs. Since its launch in 2021, Metaplex has facilitated the minting of more than 22 million NFTs and generated $3.36 billion in NFT sales. The Merkle tree program on Solana enables compressed NFTs created via Metaplex to be encoded into the Solana blockchain’s ledger.

What are common use cases for compressed NFTs?

Compressed NFTs enable businesses and individuals to mint NFTs on a massive scale without incurring the prohibitive associated costs compared to conventional NFTs. Industries that could make use of compressed NFTs include: gaming, music, events, metaverses, and enterprises.

1. Gaming

Compressed NFTs could potentially serve as in-game assets for millions of players. Because of the potential scale of web3 games, compressed NFTs can save web3 game development companies costs while issuing millions of in-game NFTs.

2. Music and Events

With millions of concert and events tickets sold every year, compressed NFTs can save ticketing companies money and act as digital collectibles for event goers all while providing the security and authenticity of web3 products.

3. Metaverse

With the growing popularity of metaverses and metaverse-like games, compressed NFTs enable metaverse development companies to digitize large numbers of in-game collectibles for millions of people globally.

4. Enterprise level systems

From tracking merchandise across supply chains to digitizing public records, compressed NFTs could allow large organizations to mint, store, and retrieve NFTs in massive volumes at a fraction of the cost of today's NFT implementations.

When should compressed NFTs be used?

Compressed NFTs should be used when minting NFTs at scale, as storing data off-chain significantly reduces the cost to rent account space which every Solana account is required to pay to manage data.

Compressed NFTs vs Uncompressed NFTs

Both compressed NFTs and uncompressed NFTs are issued and verified on chain, but the main difference is where the NFT metadata is stored. Compressed NFTs store metadata off-chain, and traditional Solana NFTs store data on-chain.

How are compressed NFTs different from NFTs?

Compressed NFTs are different from conventional NFTs in four key ways:

1. NFT Metadata Storage

Compressed NFTs store their data off-chain in a Merkle tree and are accessed via Solana RPC providers.

2. Cost

Because they store data off-chain, compressed NFTs are significantly more cost-effective.

3. Data Ownership

When you want to modify a compressed NFT, you must cryptographically prove your authority to change the off-chain data, which ensures off-chain data storage can be trusted.

4. Program Interactions

Existing programs (i.e. Solana smart contracts) must be modified to interact with compressed NFTs, unless the NFTs themselves are de-compressed.

How much money do compressed NFTs save?

To mint 1 million conventional NFTs, it would roughly 12,000 SOL, and minting the same number of compressed NFTs would cost just 5 SOL, or 99.9% cost savings.

In fact, the larger the collection of NFTs, the greater the reduction in minting costs with compression, as demonstrated in the image below:

Cost of minting compressed and uncompressed NFTs
Cost of minting compressed and uncompressed NFTs

Because the most significant outlay when minting conventional NFTs is paying for storage space on Solana, which compressed NFTs remove, the majority of the remaining costs are simple transaction fees.

What is the cost to mint a 10k Solana NFT collection?

To mint 10,000 compressed NFTs, which is the standard NFT collection size for new projects, is roughly 3.5 SOL. The table below provides a detailed look on the cost of minting compressed NFT collections from quantities ranging from 10k to 1 billion NFTs:

Cost of minting compressed NFT
Cost of minting compressed NFT

How do compressed NFTs work?

Here's a how NFTs get compressed:

  1. Metaplex’s Bubblegum program is used to verify the metadata associated with an NFT

  2. Bubblegum calls account-compression to append a new leaf to the Merkle tree

  3. Account-compression updates the Merkle tree on-chain to reflect the new state of the world

  4. Any changes to the Merkle tree, such as the addition of new NFTs, are written to the Solana blockchain

Off-chain indexers keep track of modifications to the Merkle tree and manage the information and authorizations necessary to support dapps and programs.

What are compressed NFT authorities? 

Authorities are attributes associated with an NFT account which specify what the account can do. Every NFT account has three other accounts under it:

  1. A mint account

  2. An associated token account

  3. A wallet account

Each of these subordinate accounts have different attributes associated with it.

1. Tree Authority

This authority is typically a program that is authorized to add new leaves to the tree via the account-compression program, and that program also handles encoding the cryptographic hashes.

2. Leaf Authority

This is an attribute given to a wallet account that owns a leaf. The wallet account can be used to replace, remove and decompress a leaf.

Where are compressed NFTs stored?

Compressed NFT metadata is stored in a Merkle tree off-chain with Solana RPC service providers, and this data is monitored by an indexer. This is more cost effective than storing the same data on-chain. In effect, the data is off-chain, while the much smaller proof of the data is on-chain in the form of the Merkle tree root.

How to Compress NFTs

Compressing NFTs is a fairly straightforward task, but the process varies slightly depending on whether you’re compressing new or existing NFTs.

Compressing New NFTs

Here are the four steps to compress new NFTs (NFTs that have not been minted yet):

  1. Metaplex’s Bubblegum software is used to create a Gummyroll Merkle tree

  2. The Bubblegum mintNFT instruction is called

  3. The mintNFT instruction is retrieved from the ledger by the off-chain indexer, and the leaf metadata is saved.

  4. The get_assets_for_owner instruction is called by the dapp through an RPC node to return the NFT

Compressing Existing NFTs

Here are the three steps to compress existing NFTs (NFTs that have already been minted):

  1. The transfer instruction on is called on Bubblegum program along with the NFT information

  2. The Bubblegum program makes a cross-program invocation to Gummyroll to add a new Merkle tree root

  3. An off-chain indexer retrieves the transfer instruction from the blockchain and updates the leaf's owner property.

Step three ensures that the ownership of the NFT represented by the leaf is transferred to the new owner.

To compress existing NFTs it is not necessary to create the Gummyroll tree from scratch, instead read Metaplex's compressed NFT documentation for more information.

How does NFT decompression work?

The decompression process removes an NFT from the off-chain Merkle tree dataset. Here is a simple breakdown:

Once the Token Metadata Program has verified the integrity of the leaf on the merkle tree that corresponds to the NFT, the program creates the following accounts:

  1. Mint Account

  2. Associated Token Account (ATA)

  3. Token Metadata Account

  4. Master Edition Account

The Token Metadata Program then updates the Merkle tree to remove the leaf.

Overview cards background graphic
Section background image

Build blockchain magic with Alchemy

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.