news

On-chain Cryptopunks

The Cryptopunk images and their attributes now live on-chain!

Bringing the Cryptopunk Images and Attributes On-Chain

When we created the Cryptopunks in 2017, we linked the composite images of all the punks to the smart contract by storing a cryptographic hash of the image in the Cryptopunks contract. This way, it was clear that the contract pertained to that image, and that image only.

However, as the Cryptopunk images are fairly small at 24x24 pixels each, it has always been theoretically possible to store them on the Ethereum blockchain directly. Furthermore, the Cryptopunk attributes (hair styles, glasses, beards, hats, etc.) could also be put on-chain alongside the images. Storing them on-chain in this way would further cement the long-term survival of the Cryptopunks images and attributes, and ensure that they can be fully accessed by anyone with only an Ethereum client.

Today we are excited to announce that we've done just that, and the Cryptopunks are now fully on-chain! You can visit this contract on Etherscan and query directly for the Cryptopunk images as either a raw set of pixels or an SVG. You can also query for a Cryptopunk's attributes. These queries are called "view functions", which means they require no gas fees or transactions to complete.

Demo

You can query the contract below. This calls the punkSVG and punkAttributes functions for the requested punk.

Thanks

We owe a great debt of thanks to community members snowfro and 0xdeafbeef for motivating this project. They really pushed for this to come to fruition, and 0xdeafbeef created a proof-of-concept contract that proved it was possible. The solution we arrived at was quite gas-efficient to deploy, considering that it represents 10,000 images and attribute lists. That said, it still cost over 73M gas. We think that is well worth it to now have the Cryptopunks and their attributes part of the permanent record on the Ethereum blockchain.