Subscribe to Midnight Realm
Subscribe to Midnight Realm
Share Dialog
Share Dialog


<100 subscribers
<100 subscribers
I created Accessory number 572, back in July of 2021, and as part of the design of the Accessory, put a puzzle to be solved.
Several years have passed now, and it was great fun for me to see people attempt it over the years. In the end, two MoonCats and their owners solved the puzzle, and they'll be the only two to ever wear that Accessory: Whiskers (MoonCat #39) and MoonCat #5997. Congratulations you two!
The door for further guesses is now closed, so let's take a trip through discovering the solution to this puzzle:
The description of the Accessory indicates:
Trying to work through a complicated process? Sometimes the best way to get it out is to draw it on the wall! But can you figure out this accessory's puzzle...?
Many people submitted guesses related to what was visible on the blackboard next to the MoonCat (a rocket, and a route indicating a slingshot maneuver around a planet). But that illustration is not the "drawing on the wall" the description refers to.
I followed up with a hint in January of 2022 to indicate the obvious/visible writing on the board wasn't it, but there was some other message written on the board.
The key realization to solve this puzzle is that the puzzle message is written on the other half of the blackboard, behind the MoonCat's head. This Accessory is a "background" accessory, which means it gets layered behind the MoonCat when rendered, but when Accessory designers create a background accessory, they can fill in the content behind the MoonCat (which is good for supporting other MoonCat poses, which expose different areas of the background).
So the trick to even see the puzzle message is to figure out how to get an image of the Accessory, without a MoonCat over the top of it. The typical ways an Accessory is shown is it's always with a MoonCat flattened as a PNG so there's no layers to hide or show. The Photobooth tool allows any user to turn on and off Accessory layers, but not turn off the MoonCat visibility itself. So to get at this data, you'd have to learn a bit more about how Accessories work.
As part of the creation of the MoonCatRescue Accessories functionality, the organizing team created some parsing scripts to interact with Accessories, and that got published as the libmooncat library. Within that library, the generateImage function has the ability to show any MoonCat with any accessory (even accessories they don't own), and it has an option called noCat, to enable rendering just the accessory, without the MoonCat. That's one way to get at the Accessory without a MoonCat, but it's decently technical to utilize.
Another option is the MoonCatRescue team created several helper contracts to make the on-chain data about MoonCats easier to parse by humans. One of those contracts is the MoonCatAccessoryImages that is deployed to 0x91CF36c92fEb5c11D3F5fe3e8b9e212f7472Ec14. It has several functions that allow generating SVGs of MoonCats with their owned Accessories, but that wouldn't have helped you at the beginning of this puzzle, since no MoonCat owned the puzzle accessory yet. But it also has the function accessoryPNG that does help in this situation.

That function asks for a MoonCat's rescue order as one of the input arguments, but it doesn't use that MoonCat's identifier to draw the MoonCat. Instead it uses that MoonCat's color to alter the colors of the Accessory (if the Accessory uses color-shifting colors, which this Accessory does).
Running that function in a tool like Etherscan results in a string being output that starts with "data:image/png;base64". That doesn't look like an image, so how do we see the output? That prefix indicates that this data is a Data URL, which encodes the PNG image data in a base-64-encoded manner. There's several online tools that can convert a Data URL into an image for you. And if you do that conversion, you end up with a PNG that looks like:

Well, would you look at that; there's something else on the board! Though you may note that this image appears flipped horizontally compared to the image sample. Why is that? If you dig into the raw data that gets stored for each Accessory on-chain, it is PNG-formatted data and it's always encoded for how it appears for a left-facing MoonCat. For Accessories that change their appearance for a right-facing MoonCat, the alternate view isn't stored on-chain. Instead, all the tools that do the assembling of the accessory layers with a MoonCat do the transformation themselves.
Knowing that I presented the puzzle on a right-facing MoonCat, let's zoom in on that drawing and flip it so it's how it would show for a right-facing MoonCat:

Knowing how the green color is acting as "the board" means the yellow and brown colors would be the "writing on it". And treating the horizontal bands of green color as "blank areas of the board' that makes it look like a few lines of text, in 3x12 pixel chunks. If those three regions are text, how do we discern the letters? With only three pixels of height, that's not a lot of room to make letter shapes. So, that's not how I encoded the letters.
Looking at each "line" of text, there's some vertical slices in each region that have only the green background color, similar to how spaces would appear between each word. And indeed, I did make each vertical slice of three pixels one character in the final message, with solid green slices as spaces between words. But then how to convert colors to letters?
The answer is, this message is encoded with a ternary numbering system. You're likely already familiar with decimal (base-ten) numbers, and if you've dealt with computers at all, you've likely heard of binary (base-two) and hexadecimal (base-sixteen). Ternary is base-three, so uses the digits 0, 1, and 2. Encoding the english alphabet into ternary would then be:
A = 1 (decimal): 001 in ternary
B = 2: 002
C = 3: 010
D = 4: 011
E = 5: 012
F = 6: 020
G = 7: 021
...
Y = 25: 221
Z = 26: 222
Notably, it only takes three digits of ternary to represent all 26 english alphabet characters. If binary were used, then 26 would be represented as "11010"; it would need five digits to represent all the letters, which would take up more space.
Using five "digits" to encode letters with two varying values ("zero" and "one" or some other "A" and "B" distinct values) is sometimes referred to as Bacon's cipher, and so the method used in this puzzle of using three colors to represent letters is a "ternary Bacon" cipher. I had given the hint that the TORCHED H34R7S artwork was an inspiration for this one, and that puzzle used sixteen different types of flames around the border to encode the hidden values. Mine was more simple with only three color variants.
For this puzzle, green is "zero", yellow is "one", and brown is "two". That leads to:

Reading each slice of three pixels vertically, left-to-right, top-to-bottom, we get:
201, 120, 000, 110, 120, 112, 021, 000, 001, 112, 011, 000, 202, 022, 001, 112, 102, 201, 000, 020, 120, 200, 000, 000, 001, 110, 110, 000, 202, 022, 012, 000, 202, 210, 112, 001
Converting those from ternary to binary, that becomes:
19, 15, 0, 12, 15, 14, 7, 0, 1, 14, 4, 0, 20, 8, 1, 14, 11, 19, 0, 6, 15, 18, 0, 0, 1, 12, 12, 0, 20, 8, 5, 0, 20, 21, 14, 1
Changing each of those numbers into the letter at that position in the alphabet (zero is a space) gives:
SO LONG AND THANKS FOR ALL THE TUNA
And that is the secret phrase that I was looking for people to message me! Don't worry, it's not an actual farewell from me (I'm still in this for the long haul!) but rather it's an homage to one of my favorite book series, The Hitchhiker's Guide to the Galaxy 🐬, slightly modified to be more MoonCat-related, always chasing that space tuna!
Huzzah! So now you know the secret. I had lots of fun creating this puzzle, and I hope you had fun working on it! You can no longer earn the puzzle accessory itself, but if you made it this far in the article and now understand what a "Ternary Bacon Cipher" is, drop me a comment indicating "I learned something!" and I'll make your favorite MoonCat eligible to claim the "I learned something!" accessory (the square academic cap that my MoonCat is wearing in the original puzzle image) 🎓 as a memento.
And if you're itching to try out your newly-formed Ternary Bacon skills, you might now enjoy giving this THREE little pigs puzzle a try (it was also an inspiration for my puzzle, though I didn't give that hint publicly as I thought it might have been too obvious).
I created Accessory number 572, back in July of 2021, and as part of the design of the Accessory, put a puzzle to be solved.
Several years have passed now, and it was great fun for me to see people attempt it over the years. In the end, two MoonCats and their owners solved the puzzle, and they'll be the only two to ever wear that Accessory: Whiskers (MoonCat #39) and MoonCat #5997. Congratulations you two!
The door for further guesses is now closed, so let's take a trip through discovering the solution to this puzzle:
The description of the Accessory indicates:
Trying to work through a complicated process? Sometimes the best way to get it out is to draw it on the wall! But can you figure out this accessory's puzzle...?
Many people submitted guesses related to what was visible on the blackboard next to the MoonCat (a rocket, and a route indicating a slingshot maneuver around a planet). But that illustration is not the "drawing on the wall" the description refers to.
I followed up with a hint in January of 2022 to indicate the obvious/visible writing on the board wasn't it, but there was some other message written on the board.
The key realization to solve this puzzle is that the puzzle message is written on the other half of the blackboard, behind the MoonCat's head. This Accessory is a "background" accessory, which means it gets layered behind the MoonCat when rendered, but when Accessory designers create a background accessory, they can fill in the content behind the MoonCat (which is good for supporting other MoonCat poses, which expose different areas of the background).
So the trick to even see the puzzle message is to figure out how to get an image of the Accessory, without a MoonCat over the top of it. The typical ways an Accessory is shown is it's always with a MoonCat flattened as a PNG so there's no layers to hide or show. The Photobooth tool allows any user to turn on and off Accessory layers, but not turn off the MoonCat visibility itself. So to get at this data, you'd have to learn a bit more about how Accessories work.
As part of the creation of the MoonCatRescue Accessories functionality, the organizing team created some parsing scripts to interact with Accessories, and that got published as the libmooncat library. Within that library, the generateImage function has the ability to show any MoonCat with any accessory (even accessories they don't own), and it has an option called noCat, to enable rendering just the accessory, without the MoonCat. That's one way to get at the Accessory without a MoonCat, but it's decently technical to utilize.
Another option is the MoonCatRescue team created several helper contracts to make the on-chain data about MoonCats easier to parse by humans. One of those contracts is the MoonCatAccessoryImages that is deployed to 0x91CF36c92fEb5c11D3F5fe3e8b9e212f7472Ec14. It has several functions that allow generating SVGs of MoonCats with their owned Accessories, but that wouldn't have helped you at the beginning of this puzzle, since no MoonCat owned the puzzle accessory yet. But it also has the function accessoryPNG that does help in this situation.

That function asks for a MoonCat's rescue order as one of the input arguments, but it doesn't use that MoonCat's identifier to draw the MoonCat. Instead it uses that MoonCat's color to alter the colors of the Accessory (if the Accessory uses color-shifting colors, which this Accessory does).
Running that function in a tool like Etherscan results in a string being output that starts with "data:image/png;base64". That doesn't look like an image, so how do we see the output? That prefix indicates that this data is a Data URL, which encodes the PNG image data in a base-64-encoded manner. There's several online tools that can convert a Data URL into an image for you. And if you do that conversion, you end up with a PNG that looks like:

Well, would you look at that; there's something else on the board! Though you may note that this image appears flipped horizontally compared to the image sample. Why is that? If you dig into the raw data that gets stored for each Accessory on-chain, it is PNG-formatted data and it's always encoded for how it appears for a left-facing MoonCat. For Accessories that change their appearance for a right-facing MoonCat, the alternate view isn't stored on-chain. Instead, all the tools that do the assembling of the accessory layers with a MoonCat do the transformation themselves.
Knowing that I presented the puzzle on a right-facing MoonCat, let's zoom in on that drawing and flip it so it's how it would show for a right-facing MoonCat:

Knowing how the green color is acting as "the board" means the yellow and brown colors would be the "writing on it". And treating the horizontal bands of green color as "blank areas of the board' that makes it look like a few lines of text, in 3x12 pixel chunks. If those three regions are text, how do we discern the letters? With only three pixels of height, that's not a lot of room to make letter shapes. So, that's not how I encoded the letters.
Looking at each "line" of text, there's some vertical slices in each region that have only the green background color, similar to how spaces would appear between each word. And indeed, I did make each vertical slice of three pixels one character in the final message, with solid green slices as spaces between words. But then how to convert colors to letters?
The answer is, this message is encoded with a ternary numbering system. You're likely already familiar with decimal (base-ten) numbers, and if you've dealt with computers at all, you've likely heard of binary (base-two) and hexadecimal (base-sixteen). Ternary is base-three, so uses the digits 0, 1, and 2. Encoding the english alphabet into ternary would then be:
A = 1 (decimal): 001 in ternary
B = 2: 002
C = 3: 010
D = 4: 011
E = 5: 012
F = 6: 020
G = 7: 021
...
Y = 25: 221
Z = 26: 222
Notably, it only takes three digits of ternary to represent all 26 english alphabet characters. If binary were used, then 26 would be represented as "11010"; it would need five digits to represent all the letters, which would take up more space.
Using five "digits" to encode letters with two varying values ("zero" and "one" or some other "A" and "B" distinct values) is sometimes referred to as Bacon's cipher, and so the method used in this puzzle of using three colors to represent letters is a "ternary Bacon" cipher. I had given the hint that the TORCHED H34R7S artwork was an inspiration for this one, and that puzzle used sixteen different types of flames around the border to encode the hidden values. Mine was more simple with only three color variants.
For this puzzle, green is "zero", yellow is "one", and brown is "two". That leads to:

Reading each slice of three pixels vertically, left-to-right, top-to-bottom, we get:
201, 120, 000, 110, 120, 112, 021, 000, 001, 112, 011, 000, 202, 022, 001, 112, 102, 201, 000, 020, 120, 200, 000, 000, 001, 110, 110, 000, 202, 022, 012, 000, 202, 210, 112, 001
Converting those from ternary to binary, that becomes:
19, 15, 0, 12, 15, 14, 7, 0, 1, 14, 4, 0, 20, 8, 1, 14, 11, 19, 0, 6, 15, 18, 0, 0, 1, 12, 12, 0, 20, 8, 5, 0, 20, 21, 14, 1
Changing each of those numbers into the letter at that position in the alphabet (zero is a space) gives:
SO LONG AND THANKS FOR ALL THE TUNA
And that is the secret phrase that I was looking for people to message me! Don't worry, it's not an actual farewell from me (I'm still in this for the long haul!) but rather it's an homage to one of my favorite book series, The Hitchhiker's Guide to the Galaxy 🐬, slightly modified to be more MoonCat-related, always chasing that space tuna!
Huzzah! So now you know the secret. I had lots of fun creating this puzzle, and I hope you had fun working on it! You can no longer earn the puzzle accessory itself, but if you made it this far in the article and now understand what a "Ternary Bacon Cipher" is, drop me a comment indicating "I learned something!" and I'll make your favorite MoonCat eligible to claim the "I learned something!" accessory (the square academic cap that my MoonCat is wearing in the original puzzle image) 🎓 as a memento.
And if you're itching to try out your newly-formed Ternary Bacon skills, you might now enjoy giving this THREE little pigs puzzle a try (it was also an inspiration for my puzzle, though I didn't give that hint publicly as I thought it might have been too obvious).
1 comment
100 000 110 012 001 200 112 012 011 000 201 120 111 012 202 022 100 112 021!