I am the chad v1

It was 1:02am and was about to head to bed when a weird little idea popped into my head - what if I made an on-chain King of The Hill but for solidity devs?

It’s hard af to go to bed when your mind is buzzing, so with no other choice, I got my ass out of bed, tweeted this, and started coding like a mad man. Mind you, I was still sleepy as shit so I wanted to get this finished ASAP so I could calm my mind and head to bed.

2.5 hours later and I had a working version of the game that was very lightly tested and ready for deployment. If you haven’t already, read about the whole game here.

Exploits

I knew there were a ton of holes in the game (where you could bypass the actual problem) which is why I specifically mentioned “anything goes”. However, I assumed we’d get at least a few submissions of ‘honest’ players before the shadowy super coders came out - but alas, I should never do anything under a flawed assumption especially if it involves some of the best ETH devs.

The main exploit lies within the pseudo randomness (mentioned multiple times in the repo and contract) - you essentially can just calculate the seed with the correct values and hardcode the proper solution without going through the actual problem.

I’m ngl, I was just too lazy and sleepy to properly do RNG (or prevent external call fuckery) so I just made it part of the game to exploit. Another point was, I wanted to keep it all on-chain and a single txn (no off-chain inputs or commit/reveal schemes) because fully on-chain is cool, and I was also lazy to do anything else xD

I wanted to be very explicit so everyone was on the same page.
I wanted to be very explicit so everyone was on the same page.

After you figure out that core piece of info, it was essentially a game to get your gas cost down as much as possible and remove as many op codes as you could.

You could’ve also used flashbots where you wait for the correct block that returns your hardcoded array to get an even lower score (since you strip away op codes to the smallest size possible and just wait).

You could also just keep finding leading zeroes in your address or calldata to shave even more bytes.

Why did I choose 3sum and the current constraints for the core problem?

The biggest reason was because everyone participating had to be on even playing grounds.

If you’re familiar with the traditional 3sum problem, the input can be an input array of arbitrary length k and solution is to return all permutations of 3 numbers that sum to the target number.

Using this original problem wouldn’t be fair to all players as some players may get larger arrays than others, some may have more permutations to find than others, etc. This causes unfairness as players that get an unlucky long array most likely expend more gas solving the problem - rather than pure skill, there’s a luck element.

So, the quick solution was to have all inputs be the same length, where all values in the array were of the same bit size, and everyone only needed to return 1 permutation.

What’s next?

Well, I initially thought this was cool idea and built out this initial v1 as a POC. Now that it seems to have gained interest and people are enjoying playing it, I think I may pump out a v2 pretty fast (not as fast as v1 though of course). I’m thinking a more visual experience with an icy frontend, a fully on-chain SVG NFT as the trophy, and a more public leader board.

If you wanna help, please DM me!

Ideally we use a more interesting problem than 3sum. The most ideal problem is one that is:

  • Easily set up

  • Hard/interesting to compute

  • Easily verifiable solutions

Any other suggestions on how to calculate score, security, etc. would be awesome!

Some quick stats

Was hoping to get some ‘honest’ players starting off the game but @rileyholterhus started off hot by using the PRNG exploit.

The Optimizor NFT was swapped hands 10 times. These were people I was able to identify (please let me know if one player was you).

I hope everyone does a write up! I would love to read all your strategies and exploits! Also, would love to know HOW you guys learned to do this so well - any resources welcome xD

Subscribe to Beans
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.