Bubblegum

NFTs that scale to new orders of magnitude.

Introduction

Overview

Bubblegum is the Metaplex Protocol program for creating and interacting with compressed NFTs (cNFTs) on Solana. Compressed NFTs make it possible to scale the creation of NFTs to new orders of magnitude by rethinking the way we store data onchain.

Getting Started

Find the language or library of your choice and get started with compressed NFTs.

API reference

Looking for something specific? Have a peak at our API References and find your answer.

Introduction

As NFTs have flourished on the Solana blockchain, there’s been an increasing need for NFTs to be as ubiquitous as any digital asset on the Internet: every single item in your game’s inventory, proof-of-engagement in your favorite consumer app, or even a profile for every human on the planet.

So far, though, these types of products have been held back by the cost of rent for NFTs on Solana, which is relatively cheap but scales linearly. Compression for NFTs drastically reduces the cost of onchain storage of NFTs to enable creators to be as expressive with the technology as they wish.

Launching a cNFT project on Solana using Merkle trees can be incredibly cost-effective, with costs starting as low as:

Number of cNFTsStorage CostTransaction CostTotal CostCost per cNFT
10,0000.22220.050.27220.000027222
100,0000.26560.50.76560.000007656
1,000,0000.312255.31220.000005312
10,000,0000.42365050.42360.000005042
100,000,0007.2205500507.22050.000005072
1,000,000,0007.22055,0005007.22050.000005007

These compressed NFTs can be transferred, delegated, and even decompressed into regular NFTs for interoperability with existing smart contracts.

Merkle Trees, leaves and proofs

Compressed NFTs only exist in the context of a Merkle Tree. We explain in a dedicated advanced guide what Merkle Trees are but, for the sake of this overview, you can think of a Merkle Tree as a collection of hashes that we call Leaves. Each Leaf is obtained by hashing the data of the compressed NFT.

For each Leaf in the Merkle Tree, one can provide a list of hashes — called a Proof — that enables anyone to verify that the given Leaf is part of that tree. Whenever a compressed NFT is updated or transferred, its associated Leaf will change and so will its Proof.

As such, Merkle Trees act as an onchain structure that allows anyone to verify a given compressed NFT exist. They do this without storing any NFT data which makes them so scalable.

Which brings us to an important question: where is the NFT data stored?

Metaplex DAS API

When we mint a new compressed NFT, its data is hashed and added as a new Leaf in a Merkle Tree. But there’s more. Additionally, the entire NFT data is stored in the transaction that created the compressed NFT. Similarly, when a compressed NFT is updated, its updated data is, once again, saved on the transaction as a changelog. So, whilst there aren’t any accounts keeping track of that data, one can look at all previous transactions in the ledger and find that information.

Crawling through millions of transactions every time just to fetch the data of one NFT is admittedly not the best user experience. Therefore, compressed NFTs rely on some RPCs to index that information in real time to abstract this away from the end-user. We call the resulting RPC API, which enables fetching compressed NFTs, the Metaplex DAS API.

Note that not all RPCs support the DAS API. As such, you may be interested in the “Metaplex DAS API RPCs” page to select an appropriate RPC when using compressed NFTs in your application.

We talk about this in more detail in our advanced “Storing and indexing NFT data” guide.

Features

Even though NFT data does not live inside accounts, it is still possible to execute a variety of operations on compressed NFTs. This is possible by requesting the current NFT data and ensuring its hashed Leaf is valid on the Merkle Tree. As such, the following operations can be performed on compressed NFTs:

Next steps

Now that we know how compressed NFTs work at a high level, we recommend checking out our Getting Started page which enumerates the various languages/frameworks that one can use to interact with compressed NFTs. Afterwards, the various feature pages can be used to learn more about the specific operations that can be performed on cNFTs. Finally, advanced guides are also available to deepen your knowledge of cNFTs and Merkle Trees.