Visual Puzzle NFTs

Dec 30, 2022

A visual puzzle is (hopefully?) a fun way to add some light gamification to an NFT collection. Easiest description is to just begin with an example. Imagine a real puzzle. Each piece in the puzzle has a set of visual attributes. The obvious visual attributes of a puzzle piece are its shape and its image. If separate pieces have complimentary shapes (say one has a notch, the other has a tab) and complimentary images (say one has the front of a cat, the other has the back), then we might guess they fit together.

— scroll to join —

For the next example, instead of a puzzle, imagine a simple lock and key. The key blade is cut to different heights that correspond to pin heights in a pin thumbler lock. When the key is inserted into the key way, the key cuts hold up all the pins to the same height so the barrel may be turned to open the lock. Importantly, the pin heights are the exact inverse of the key cut heights. Visually, the key is nicely linear...you can see, left-to-right, how the key cut heights match the pins.

— scroll to unlock —

If you had a lot of different keys and a lots of different locks...then you'd have quite a puzzle. But with careful inspection you could solve it and find which keys unlock which locks. A straightforward solution algorithm might be to sort keys and locks into buckets based on the first key cut / pin height, then the second, etc. Of course, the puzzle difficultly could be increased by having keys without locks and locks without keys, or having 4-pin keys and locks mixed with 3-pin keys and locks, and so on.

Cogs + Cogs Meshed

The real Cogs visual puzzle is made up of 12 NFTs. Each NFT is a colorful cogwheel with a different pattern of cog teeth and teeth heights. In some cases, the teeth on one cog are exactly complimentary to the teeth on another: they mesh! Which cogs mesh, and which do not, is the puzzle. The solutions, and the reward for being the first to find a solution, is also on-chain as the 4 Cogs Meshed NFTs.

— scroll to mesh —

The puzzle solution is fully on-chain as a custom ERC721 NFT contract (view the code on Etherscan). At launch, the solutions are hidden, and the NFT is just a "placeholder" SVG until the puzzle is solved and the meshed Cogs are revealed.

Solve using the Mesh DApp

coming soon...

Solve manually using Etherscan

You can use Etherscan (or any other blockchain explorer) to call the mesh() method directly. It's a bit manual, but you'll likely learn something in the process. Just follow these steps:

  1. Goto the contract on Etherscan
  2. Goto: Contract > Write Contract, and click the Connect to Web3 button.
  3. ...connect with Metamask (or another wallet)
  4. Call the mesh() method with:
    1. fee - pay the guess fee of 0.001 Eth
    2. cogId - your cog's tokenId (Cog 1 has tokenId of 1 and so on). You MUST own this Cog NFT and hold it in your hot wallet (from which you are paying the fee)
    3. guessId - target cog's tokenId that your cog will mesh with (you don't need to own this one)
  5. Click the Write button...if you are the first to guess correctly that your cog meshes with the target, then you will be rewarded the Cogs Meshed solution NFT for the meshed pair.

One final note: in the solution contract, the solutions themselves are obscured with only best effort security, including salts, encryption, dummy solutions, and more. With entirely public code, and entirely public data, and a simple contract API, it does not seem possible to cryptographically secure the puzzle solutions (aka nowhere to hide a private key). Happy for any contract feedback...please reach out if you have any ideas.

–Mech