Reference-based storage of NFTs

Just an idea that came to my mind. I’m not planning to work on it, so do steal.

Typically, an NFT is a digest of the content it’s meant to represent. For example, one can host an image on IPFS, mint an NFT on the blockchain and associate it with the image’s IPFS content ID (see the IPFS docs for details). This is not an ideal solution because it causes the NFT to have a dependency outside of the blockchain.

NFTs tend to contain digests rather than the content itself because hosting the content on the blockchain would cost too much gas. The obvious solution that comes to mind is compression. JPEG typically achieves 10:1 compression with little perceptible loss, though note that this applies to natural images and NFT images look like they are created in MS Paint. There are also deep learning-based compression methods that outperform JPEGs according to certain perceptual metrics.

bpp: bits per pixel. Smaller values imply a higher compression ratio.

Blockchains suck because they are expensive to use. However, one of the main reasons for this is that usage creates residual data, which we may be able to use to our advantage. Reference-based compression is a method of representing data by referring to existing data. For example, the Bitcoin genesis block coinbase includes the message “The Times 03/Jan/2009 Chancellor on brink of second bailout for banks”. If someone else wanted to repeat the same message, instead of storing it again, they can simply point to this message, effectively achieving infinite compression.

Obviously, whatever you will want to store on the chain will almost never be there in the identical form. However, a good reference-based compression method will mix and match existing data to generate the new data that you want to store, and also fill in the blanks with new data if necessary. Especially if you consider what today’s NFTs and their forks look like, it’s easy to tell that this approach has a lot of potential.

These can be compressed very, very, very efficiently if it was done across the dataset.

Although I’m giving visual examples for easier understanding and NFTs are a low hanging fruit, this can also be considered from a more general data compression point of view. Specifically, a blockchain has a constantly growing dataset of references to base the compression on, and it’s not obvious that the success of this approach will be limited to compression of visual data. In other words, a transaction that does a Uniswap trade could be used as reference to compress a piece of music if you threw a lot of processing power at it.

Finally, one needs a metric to optimize if they are doing lossy compression. Recall that the deep learning-based method claims superiority over JPEG in perceptual metrics, and what humans think is what matters in a lot of use-cases. We already have solutions that depend on financially incentivized human consensus to solve subjective problems, and deciding if image A or image B is the better representation of the original is an easy task.

To sum up the solution, say we already have an NFT whose digest is stored on the blockchain (so any regular NFT we have today), but we want the contents to be stored there too. Some miner type-people create compressed representations of the NFT content by using a lot of processing power and hard disk access, and nominate them (probably through a commitment scheme). Subjective oracles vote on what “the best” representation is and the submitter of the winner gets a reward. This is then repeated with the other items from the same NFT collection, but it can be expected that the compression ratio will keep increasing (i.e., storage will cost less gas) because previous representations will be used as reference.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store