Tutorial: how to change the color of your canvas’ pixels

Sixty-Four Squared
6 min readMar 12, 2022

--

You now own the most powerful pixel art NFT in existence, congratulations! However, to utilize your NFT to its full extent you will need to familiarize yourself with some RMRK interactions. In this tutorial we will be focusing mostly on the SETPRIORITY interaction, but first let’s learn about the pixel coordinate system.

Coordinates

X increases from left to right; Y increases from top to bottom

The image clearly shows the coordinate convention, but let’s explore how these coordinates are utilized in your canvas NFT. First off, the symbol (i.e. the “ticker”) of any pixel NFT on any canvas will be its designated coordinates. For example, the pixel NFT equipped to the coordinates x = 9 and y = 51 will have the symbol “X09Y51” no matter what canvas it belongs to. The reason for this is to ensure a canvas owner does not equip a pixel NFT into the wrong coordinate slot since a pixel NFT will only render properly if it is equipped to its designated slot.

The coordinate convention is also used in identifying the resources on your pixel NFTs. To achieve color customization, each and every pixel NFT has been assigned a resource for every color it can render. Since there are 10 possible colors for any pixel, all pixels will have 10 resources. The ID for any resource on any pixel is derived by concatenating three 6-character-long lowercase strings with underscores between each string:

<canvas #>_<pixel coordinates>_<color hex>

For example, if you need the resource ID for the color yellow on the pixel NFT located at x = 17 and y = 44 on canvas 13, it would be:

000013_x17y44_ebde2b

Note that you cannot select any hexadecimal color code. You can only select the ones available as resources. By default, each pixel NFT has the following color options:

#0c0c0c, #262157, #7f3f33, #007738, #58595a, #de280f, #6392f2, #ebde2b, #ffe4d2, #fafafa

The reason you need to know how to derive a resource’s ID is so that you can configure any pixel on your canvas at your whim. This is where we will need to explore the SETPRIORITY interaction on the RMRK 2.0.0 standard.

SETPRIORITY: changing the color of a pixel

In order to change a pixel to your desired color, you will need to submit a SETPRIOITY remark on the Kusama blockchain. If you are not already familiar on how to submit extrinsic directly on chain, please start here and reach out to the community for any technical issues that you encounter. In short, the process is quite simple:

  1. Go to the Polkadot JS App and ensure you are connected to the Kusama Network (upper left corner)
  2. Navigate to the “Developer” tab and click “Extrinsics”
  3. In the “using the selected account” dropdown menu, select the wallet that holds your canvas NFT
  4. In the “submit the following extrinsic” dropdown menu, select “system”
  5. In the dropdown menu to the right of “submit the following extrinsic,” select “remark(remark)”
  6. Type in whatever remark you’d like to submit and sign the transaction.

If you follow these steps you should be able to interact with RMRK 2.0.0 by submitting remarks that adhere to the formatting standard. But first, ensure you have successfully navigated to the right place by typing “test” (without quotes) into the empty field below the dropdown menus. If you do this correctly you should get the following “encoded call data”

0x00011074657374

Now that you know you’re in the right place, it is time to format the SETPRIORITY remark to change one of your canvas’ pixel’s color. First, you will need to find the NFT ID of the pixel you wish to change. Once you find the ID of the pixel NFT you want to change, you will need to derive the resource ID of the color you want that pixel to become and format it inside of quotation marks inside of square brackets. For example, if you own canvas #1 and want to change the pixel with the ID 118000000-52c4c833-PIXEL-X01Y27-00001665 (located at x = 1 and y =27) to black (#0c0c0c), the resource ID would be formatted into:

[“000001_x01y27_0c0c0c”]

Once you have formatted the resource correctly, you will need to URL-encode it which can be done with this online tool. You should now have the following string:

%5B%22000001_x01y27_0c0c0c%22%5D

Note that URL-encoding only changes a few characters, namely:

[ becomes %5B

“ becomes %22

] becomes %5D

Now it is time to put the whole remark together:

RMRK::SETPRIORITY::2.0.0::118000000–52c4c833-PIXEL-X01Y27–00001665::%5B%22000001_x01y27_0c0c0c%22%5D

By submitting this remark you will be making the color black a top priority resource for the pixel NFT located at x = 1 and y = 27, thus the consolidator will render that pixel as black when it is equipped to the canvas.

For your convenience, here is a master spreadsheet that will give you the exact remark necessary to change whatever pixel you desire on whatever canvas you own.

Bonus color using the background

Your canvas also comes equipped with a non-transferable background NFT that is encoded with 64 unique color resources.

#000000, #0d0d5c, #0d5c0d, #5c0d0d, #0d0dab, #0d5c5c, #0dab0d, #5c0d5c, #5c5c0d, #ab0d0d, #0d0dfa, #0d5cab, #0dab5c, #0dfa0d, #5c0dab, #5c5c5c, #5cab0d, #ab0d5c, #ab5c0d, #fa0d0d, #0d5cfa, #0dabab, #0dfa5c, #5c0dfa, #5c5cab, #5cab5c, #5cfa0d, #ab0dab, #ab5c5c, #abab0d, #fa0d5c, #fa5c0d, #0dabfa, #0dfaab, #5c5cfa, #5cabab, #5cfa5c, #ab0dfa, #ab5cab, #abab5c, #abfa0d, #fa0dab, #fa5c5c, #faab0d, #0dfafa, #5cabfa, #5cfaab, #ab5cfa, #ababab, #abfa5c, #fa0dfa, #fa5cab, #faab5c, #fafa0d, #5cfafa, #ababfa, #abfaab, #fa5cfa, #faabab, #fafa5c, #abfafa, #faabfa, #fafaab, #ffffff

Since the background is rendered behind pixels, it will not display if all pixels are equipped to the canvas. However, if you would like your canvas to render the background color at any given coordinate, you will need to issue a SETPRIORITY for your desired color on the background NFT and unequip the pixel NFT located where you want the background color to render. The ID convention for color resources on a background NFT is only slightly different than pixel NFT resource IDs. If you own canvas #31 and need the resource ID for the background color pink (#fa0dab), then it would be:

000031_bg_fa0dab

To remove a pixel NFT from its slot (thus rendering the background color at that location), you need to submit an EQUIP remark with a blank end. If you would like to remove the pixel NFT on canvas 1 with the ID 118000000-52c4c833-PIXEL-X01Y27-00001665 (located at x = 1 and y = 27), you would submit the following remark:

RMRK::EQUIP::2.0.0::118000000-52c4c833-PIXEL-X01Y27-00001665::

The SETPRIORITY remark to change the background color on canvas 1 to pink would be:

RMRK::SETPRIORITY::11800000–52c4c833-BACK-GROUND-00000001::%5B%22000031_bg_fa0dab%22%5D

Submitting these two remarks would result in the color pink to render at the coordinates x = 1 and y = 27.

Some helpful facts

  • You can find the serial number of any pixel by this calculation: (canvas # minus 1)*4096 + (y coordinate minus 1)*64 + x coordinate. For example, the pixel NFT on canvas #70 located at x = 51 and y = 10 will have the the serial number 00283251
  • The prefix of a pixel NFT’s ID is the block number it was minted on. Since minting takes place in batches across many blocks, not every pixel will share the same prefix
  • The base ID for every canvas is 11800000-base-64x64
  • The serial number of any background NFT will match its associated canvas (i.e. a canvas NFT with serial number 00000100 will have a background NFT with serial number 00000100
  • You can submit a batch of remarks using the “utility batch(calls)” extrinsic. If you are tech savvy, you can use this tool to submit batches of remarks. WARNING: LIMIT YOUR BATCHES TO 200 REMARKS EVERY 2 MINUTES. LARGE AND FREQUENT BATCHES CAUSE COMPUTATIONAL BOTTLENECKS FOR THE RMRK CONSOLIDATOR.
  • Selling or sending a canvas means selling or sending all of its pixel NFTs and its background NFT.

--

--

Sixty-Four Squared

The “end-all-be-all” of pixel art NFTs. Powered with RMRK 2.0.0 technology on the Kusama Network.