Onchain NFT Storage
On-chain NFT Image Storage with Full Censorship Resistance, Immutability, and Permanency
Most NFTs today are not stored on the blockchain, but instead use IPFS. This means that the image data is not actually stored on the blockchain itself, but on a decentralized file storage system. While IPFS is a valuable tool, it is not as secure or tamper-proof as the blockchain.
Our project is different. We store all of our NFT images directly on the blockchain. This means that our NFTs are fully censorship resistant, immutable, and permanent.
In addition to storing our images on the blockchain, we also use a deflationary ERC20 token to fuel our DeFi ecosystem. This allows for an entire tokenization of the created Pixelart, giving our users new and innovative ways to interact with their NFTs.
This documentation describes a method for storing images on the blockchain by coloring pixels using smart contract functions and storing the pixels as 2D mappings in Solidity. This method is based on the following principles:
All of the pixels in the image are represented by a single smart contract. The smart contract stores a 2D mapping of pixel coordinates to colors.
The blockchain is used to store the state of the smart contract. This means that the state of the canvas is immutable and publicly verifiable.
Anyone can read the state of the smart contract for free. This means that anyone can view the image at any time.
Changing the color of a pixel requires paying a transaction fee. This fee is used to cover the cost of processing the transaction and to reward the miners who validate the transaction.
Benefits
This method of storing images on the blockchain has a number of benefits:
Immutability: Once a pixel is colored, it cannot be changed. This means that the image is tamper-proof and cannot be altered by anyone.
Transparency: The state of the canvas is publicly verifiable. This means that anyone can verify the authenticity of the image and see who owns each pixel.
Decentralization: The image is stored on the blockchain, which is a decentralized network. This means that the image is not controlled by any single entity and is resistant to censorship.
Accessibility: Anyone can view the image at any time for free. This means that the image is accessible to everyone, regardless of their location or financial resources.
How it works
To store an image on the blockchain using this method, the image is first divided into a grid of pixels. The smart contract then stores a 2D mapping of pixel coordinates to colors.
To view the image, anyone can read the 2D mapping from the smart contract. To change the color of a pixel, anyone can call the colorPixel()
function on the smart contract. The colorPixel()
function takes two arguments: the pixel coordinates and the new color.
The colorPixel()
function requires the caller to pay a transaction fee. This fee is used to cover the cost of processing the transaction and to reward the miners who validate the transaction.
Example
Here is a simple example of how to store an image on the blockchain using this method:
Solidity
To store an image on the blockchain using this contract, you would first deploy the contract to the blockchain network. Once the contract is deployed, you can call the colorPixel()
function to color the pixels of the image.
To view the image, you can call the viewPixel()
function to read the colors of the pixels.
Security
The image is stored securely on the blockchain. The blockchain is a decentralized network, which means that it is not controlled by any single entity. This makes it very difficult to tamper with the image.
Conclusion
Storing images on the blockchain by coloring pixels using smart contract functions and storing the pixels as 2D mappings in Solidity is a new and innovative way to store images. This method has a number of benefits, including immutability, transparency, decentralization, and accessibility.
Last updated