Smart Contract for Hiring

What’s a better way to hire a smart contract developer than to write a smart contract to do it? That’s what my team thought when we decided to add hiring to the lengthy list of problems that smart contracts promised to solve.

So we remodeled Ethernaut into a coding challenge platform with its leaderboard.

“You got a problem? Let me blockchain that for you” - Every Blockchain Experts Ever

Standing on shoulders of giants

GovTech's Solidity Coding Challenge
GovTech's Solidity Coding Challenge

Knowing this is a side-project to our work at OpenCerts, we didn’t really want to reinvent the wheel as much as possible and make use of resources that are already available. My eyes fell on forking Ethernaut as the base for the coding challenge platform.

As an Ethereum developer, I enjoyed solving all the challenges on the Ethernaut platform and enjoyed interacting with the game through the browser’s console and Metamask.

To employ it as a technical recruiting tool, we needed to extend it to track progress and contact information of participants.

Upgrading Ethernaut base

As we would like the candidate to be able to read and write the latest solidity code (v0.5.x) and interact with the platform using the latest APIs, we needed to upgrade the web3 version. Turns out, that led us down a rabbit hole and resulted in a massive rewrite of the original code for both front-end and deployment scripts.

At the same time, we noticed that there weren’t any linting on either the solidity or Javascript code, so we added eslint and solium.

Now we are done with the boring parts, let’s begin with the fun stuff - adding the leaderboard.

ERC-20 to the Rescue

Leaderboard using Etherscan
Leaderboard using Etherscan

As mentioned, we want to reuse as many existing resources as possible for the coding challenge platform. Etherscan turns out to be the best tool for us to track the score and ranking of individual players. The ERC-20 token page shows us exactly what we wanted as a leaderboard.

To implement the leaderboard, it is as easy as creating a new token for our challenge and letting Etherscan handle the rest.

For the token, we made use of the ERC20Mintable contract from OpenZepplin project and disabled token transfer to prevent players from having more points than there are for each level.

We then implemented the ScoreTracker contract to distribute the tokens to a player who has completed individual levels, taking care not to dispense token multiple times for the same level.

After adding the ScoreTracker to the original Ethernaut contract we have the entire challenge engine ready! It’s just missing some levels.

Who are we hiring?

“Who are we hiring?”. That’s the main question we asked when designing the levels.

We know we didn’t want to restrict our talent pool to just developers who live and breathe solidity. We wanted to extend our reach to developers who are strong in their craft but may not have sufficient experience with dealing with solidity code.

That means not starting with a crazy challenge that requires you to write in bytecodes.

With that in mind, my colleague designed a Pokémon trainer level that requires players to write a contract that can distinguish and capture Pokémon. The level will test the ability of the player to write a simple smart contract that can interact with other smart contract and store state. As simple as that!

However, the level didn’t see the light of day as we were cautioned against using trademarked materials. So, Pokémon trainer level turned into StampCollector level. Yawn...

Pikachu is Disappointed
Image from https://tenor.com/search/pikachu-gifs
Pikachu is Disappointed

After the first level, we wanted to work on something simpler for developers new to solidity. My colleague suggested a FizzBuzz level since it's what developers are familiar with and simple enough. We soon realised we were wrong. String is a hard nut to crack in Solidity as it turns out...

FizzBuzz became the toughest challenge we have and we had to find other candidates to be the entry-level challenges.

Take a Shot

If you are a smart contract developer looking for a challenge, take a shot at the challenge and tell me what do you think. If you are looking to join me in my team, drop me a note on my contact page! If you are also looking for Blockchain developers, feel free to fork our SolidityCodingChallenge repository!