Decoder Crystal

From wizzypedia
Revision as of 22:35, 24 February 2023 by YGDUIL (talk | contribs) (Added ASCII art from contracts and How to Recreate Wizard section from encoding article.)
Jump to navigation Jump to search

The Decoder Crystal is an ERC-721 token on the Ethereum blockchain and is a critical aspect of the Forgotten Runes provenance.

10,000 Encoded On-Chain Wizards

The Decoder Crystal
The Decoder Crystal

To understand the Decoder Crystal, it is first crucial to understand the on-chain encoding of Forgotten Runes Wizard's Cult. Unlike many other NFTs, the Wizards actually live on the Ethereum blockchain. However, the specific images of these 10,000 Wizard permutations are not stored on-chain. Rather, the parts (ortraits) of the Wizards — the heads, bodies, props, runes , and familiars that make up each character — are contained in a single image grid on the blockchain.

IPFS

The InterPlanetary File System is a peer-to-peer network used for hosting and sharing data. IPFS is popular among NFT project developers for hosting project-related images. If an image is only stored on IPFS, the owner actually only owns a pointer to that image. This means that the image must have a host, or it will disappear.

One of the benefits of IPFS use for NFT project leaders is visibility and compatibility with off-chain organizations, such as OpenSea.

Forgotten Runes and IPFS

While all of the Wizards' data is stored on Ethereum, Magic Machine also include an IPFS URL in the tokenURI

This exists solely for convenience and off-chain interoperability, rather than out of necessity for the persistence of Wizards.

ASCII Art of the Traditional Forgotten Runes Purple Hat Wizard Included In the Wizards' Ethereum Smart Contract
ASCII Art of the Traditional Forgotten Runes Purple Hat Wizard Included In the Wizards' Ethereum Smart Contract

10,000 Decoded Wizards

Along with the on-chain, encoded image grid of the 341 total parts that result in the Forgotten Runes Wizards, there exists a pairing of wizard attributes necessary to decode it. This is the Decoder Crystal.

While it exists as its own token, the Decoder Crystal contains the code to call every Wizard in the collection from the Ethereum blockchain. This means that the characters of Forgotten Runes are not dependent on outside or centralized entities to exist. As long as there is Ethereum, there are Wizards.

ASCII Art of the Illuminatus In the Wizards Ethereum Contract
ASCII Art of the Illuminatus In the Wizards Ethereum Contract

Shortcomings of This Method

The main shortcoming for this method is that the traits are not accessible to other smart contracts. This could potentially create obstacles during integration with other on-chain projects (such as games).

The Lost Grimoire

Community member Meph1587 has created code to remedy this issue in The Lost Grimoire, which has been deployed on Rinkeby, though it is not yet on Ethereum Mainnet.

Transactions

The transactions used to store this data are available at the following hashes:

img: "0xbb6413bd70bae87b724c30ba9e46224fa63629709e7ccfe60a39cc14aa41013e",
traits: [
  "0x227552b04af7606108d306654c620a655393451742e299e8bfd28236683da2cf",
  "0x529b29d36d07c917cc24bf162d737adc0c8ddc07003f9d5ca59876cf8167bfda",
  "0x8ec128ed9b3f4f92853d8df0ff6a2159963e81f2a611145f60a8d96990439049",
  "0xe6f0b0e76ddbc581ba3a8155ff545b7d5c31a394ac0a54b44aa9ea21525d0d06",
  "0x78a6304221ff044d3adcdb037be10aa843707f2c8241e81b4b2c6fbcb51f8b79",
  "0x74b9d75a174e76981f823d594c2c2fbcaff61e66a76be7977e0cbeb52c28f01f",
  "0x3500861637fce52bef4be39ae935e632881df4a69a47abcca8bbfc9490278dc6",
  "0x96677df7c85535328b16d93acf8cd925b87886ca2198c3654ff8d8cc56236f69",
  "0xa2977bf5ef9864796fe713db9e08f98fbbce129f4280651b6b9782c4ffdf4bd2",
  "0xe9ecc9dd5f0518617afb8593157dde0bc58d5d1e4fdb5f10a3ff8f96a81897dc"
],
affinities: "0x1be4aa782c9dc164ecbf2cd155537e7250b344f405dff03b5c33fdd63261c80e"

This data itself is also stored within the Decoder Crystal.

How to Re-create Any Wizard

If you'd like to re-create your Wizard(s) entirely from on-chain data, you can run the following commands:

curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x0b8eb29d7a592023b5330fd9a93299bca2a9604aaa2494c87333fc56da50ec9e"],"id":67}' https://cloudflare-eth.com/ | jq -r '.result.input' | cut -c 139- | xxd --plain --reverse | head -n 297 > decoder.ts
npm init -y
npm install ethers@5.0.26 yargs@16.1.0 chalk@4.1.0 ora@5.3.0 ts-node@9.0.0 typescript@4.0.5 bson@4.4.0 sharp@0.28.3 parse-numeric-range@1.2.0 mkdirp@1.0.4 @types/yargs @types/node
./node_modules/.bin/ts-node ./decoder.ts --wizards "0-9,13,123"

It will look like this.