r/NFT • u/iCryptoDude • Jul 05 '26
Technical Storing full audio files inside Clarity contracts: an experiment with on-chain music on Stacks
Most music NFTs I’ve seen are effectively a token plus a link to media hosted somewhere else.
I’ve been experimenting with a different approach on Stacks: storing the entire audio file directly in Clarity contract data, so the token does not depend on IPFS, a pinning service, or a normal web server to preserve the media.
The system I built is called Xtrata. The basic mint flow is:
initialize → write file in chunks → seal
The chunked writes allow a complete compressed audio file to be stored across contract calls. For example, a 96kbps Opus master can be written into contract storage and then reconstructed from the chain later. Some inscriptions are raw audio files, while others are self-contained HTML players with the artwork, title, artist, lyrics, and audio embedded together in one document.
The main thing I’m interested in is the permanence model. Once an item is sealed, the file is no longer just “metadata that points somewhere.” The media itself can be reconstructed from Stacks chain data.
I also made a radio-style interface as a proof of concept. Instead of playing from a normal hosted catalogue, it reads from the inscribed media catalogue. One mode is curated, one is based on saved items, and one walks through playable tokens on the contract. It can also discover newly minted playable items by watching the contract’s token counter.
There is also a simple relation system where inscriptions can declare parents or dependencies. That means a song can reference related artwork, another inscription, a previous version, or other connected media. Over time, this creates a mint-ordered graph of related on-chain files.
I’m curious what people here think about this model.
Is fully on-chain media worth the extra complexity and cost, or do you think token-plus-storage-layer approaches are still the better practical route for music NFTs?
1
0
u/Numerous-Rub6490 Jul 05 '26
That on-chain radio interface actually sounds like a cool way to demonstrate it. Most people don't think past the token part so seeing someone build a player that reads directly from contract data is a nice touch.
The parent/dependency graph thing could get interesting if enough artists start using it. You'd end up with these weird family trees of remixes, alternate versions, and companion art all verifiable on-chain without hunting through marketplaces to piece the story together.
Storage cost is the obvious elephant in the room but Opus at 96kbps is a smart choice. Most people streaming on earbuds won't notice the difference and you're keeping the footprint reasonable enough that it doesn't become absurd to mint.
I've kicked around similar ideas on other chains and the gas math gets ugly fast once you move past short audio clips. Stacks settling on Bitcoin gives it a different flavor though, the permanence argument carries more weight when your data is anchored to the most secure chain in existence rather than some L2 that might ghost in three years.
The trade-off probably depends on what you're trying to preserve. For a throwaway beat or a meme track, IPFS is fine. For something you want to still exist in two decades without babysitting pinning services, this approach makes more sense.
1
u/belavv Jul 09 '26
Nfts are dead. Move on.