SKALE NFT image files and metadata stored on-chain

Not On Chain? Not Your NFT.


NFTs hold enormous potential for DeFi, complementing their popular use case of facilitating the creation and trading of digital collectibles. In their current iteration, however, NFTs have significant drawbacks, as critical metadata has to be stored off-chain. This raises problems of ownership: If an image or other information cannot be accessed when it is needed, does it really belong to you? More importantly, if NFTs are integrated with DeFi protocols but data availability cannot be guaranteed, can those tokens be trusted?

All data for Ruby's NFTs is stored on-chain and natively integrated with the AMM, thanks to SKALE's decentralized file storage system. That means users can be confident they fully own their SKALE NFTs and can always access the functionality they provide in a way that is possible nowhere else in the DeFi space.

How Do NFTs Work?

A non-fungible token (NFT) is a special kind of token, with a limited supply (often just one), and no decimals. In other words, NFTs are scarce and indivisible. Just like the ERC20 token standard used to represent fungible assets (like RUBY, USDP, Dai, and so on), an NFT's ownership is recorded on the blockchain and the token can be transferred and traded. Unlike ERC20 tokens, though, an NFT explicitly points to something beyond itself, generally in the form of a digital file such as an image, a piece of music, or an in-game item.

That file, assuming it's more than a few bytes, cannot be held on the Ethereum blockchain itself. Storing even a small image file on Ethereum L1 would cost tens of thousands of dollars in gas. So NFT creators have to come up with other ways of linking a token with its associated digital content.

Take the example of Beeple's Everydays: The First 5000 Days, which is, at the time of writing, the highest-selling NFT ever, following a $69 million auction by Christie's.

Beeple's artwork took the form of a large (320 MB) JPEG. He hashed this with the SHA256 function to create a unique digital fingerprint of the file. The image hash was added to a file containing metadata for the project, including a title and description, which was itself hashed.

As a SKALE NFT, Beeple's image could have been stored on-chain
Beeple's Everydays requires 320 MB of storage.

Finally, the hash of the metadata file was recorded on the blockchain when the NFT was minted.

What this means in practice is that anyone who wants to verify that a copy of Everydays is really Beeple's work simply has to hash it, which can be done easily using any online SHA256 utility, and compare the result to the hash stored in the metadata file. The integrity of the metadata file itself can be checked by comparing its hash with the hash recorded in the NFT creation transaction, which is immutably stored on the blockchain. (Other NFT creators take the simpler approach of including the hash of an image directly in the code.)

However, in order to verify that an image is Beeple's Everydays, you need to have access to a copy of that image, as well as, in this instance, the metadata file. In Beeple's case, the image file is very large and loads slowly, which means the many news websites that reported the sale have used lower-resolution versions. Because those versions are not the original file, they necessarily have different hashes.

The full-sized version of Everydays, and the metadata file, are stored on IPFS, a distributed data storage network. A link to the image on IPFS is included in the metadata file. Unfortunately, there are drawbacks to storing data on IPFS, which come down to a combination of availability, centralization, and cost. (In short, to guarantee data is readily accessible, you either need to pay to incentivize "persistence", host a node yourself and "pin" data to it, or trust a third-party pinning service.)

Even though IPFS is an imperfect solution, it's still better than the approach most NFT creators adopt. Image files are often held in centralized cloud storage, or even not explicitly referenced at all by the contract. Larva Labs, early pioneers of the NFT space, just embedded a hash of the image for all 10,000 CryptoPunks in the contract without a link, and displayed the image on their website.

SKALE NFTs do not require IPFS.
Many NFTs simply include a link to a hosted file, or IPFS at best.

In an ideal world, the image would be stored on the blockchain, along with metadata and the NFT contract itself. With Ethereum mainnet, that's impossible. But with SKALE, it becomes standard.

SKALE NFTs: Keeping It On-Chain

One of the reasons why we're building Ruby on SKALE is because it's much more than just a simple sidechain solution for Ethereum. SKALE offers rich features far beyond high-speed transactions, including on-chain storage.

This means we're able to hold all data relevant to an NFT on Ruby's SKALE chain: Token contract, metadata, image file, and anything else we might need. In the video below, SKALE CTO and co-founder Stan Kladko explains the implications and benefits of a 100% on-chain approach.

In Ruby's case, data availability is absolutely vital, not just for user confidence but for the smooth functioning of the AMM. Ruby's gems are beautiful pieces of generative artwork that are each created from a unique set of randomly-generated parameters, including color palette, number of sides, surface texture, edge wear, and other factors.

SKALE NFTs can store all gemstone metadata on-chain
Each gem is generated from a series of different parameters.

A gem can therefore be stored as a string of variables on the blockchain, and its appearance calculated from any angle in real time when it is required. But Ruby's NFTs are more than just artistic objects. Owning certain NFTs will alter the user experience, for example by boosting LP rewards or reducing trading fees. In the future, more complex functionality will be implemented, with metadata playing a more important role.

We know that the data required will always be accessible whenever it's needed, because SKALE's decentralized storage solution is fully integrated with the Ruby S-chain, and a data-availability protocol ensures that at least two-thirds of the chain's virtualized subnodes hold that data.

No other NFT solution can offer this level of availability without settling for an unacceptable degree of centralization. From the user's perspective, this is a variation of the "Not your keys, not your coins" principle: The more NFT data is stored off-chain, the less that NFT belongs to its owner in a meaningful way.

100% On-Chain NFTs

All of the data required by SKALE NFTs can be stored on-chain, using SKALE's decentralized storage system. This means Ruby's gemstones can be fully integrated with the AMM and data can be accessed whenever it's needed. Users have complete ownership of their gems and the functionality they provide is always available.

Find out more about SKALE, or learn more about Ruby by visiting Ruby.Exchange, following the project on Twitter and Telegram, or subscribing to the Ruby blog.