EVM Golf is a recreational game designed to show off your code-fu by solving challenges in the shortest code size or the least gas usage.
Follow steps below to participate in EVM Golf.
parameters should be set in environment variables while ways to set environment variables is different among different platforms. see more
-
initialize
git clone https://github.com/evm-golf/golf.git cd golf npm install --save-dev
-
develop your solution for a challenge and test your solution locally. challenges can be viewed in the
challenges
folderto test the solidity solution writen in
contracts/Solution.sol
:note
<challenge>
is the chosen challenge (i.e.addition
)CHALLENGE=<challenge> npx hardhat run scripts/test.js
to test the EVM code directly:
note
<code>
is the evm runtime bytecode (deployed bytecode) starts with0x
. see the difference between runtime code and creation bytecode hereEVMCODE=<code> CHALLENGE=<challenge> npx hardhat run scripts/test.js
-
submit your solution once you bypass the local test
this will submit your solution to the issue in solutions repository using your github account
when executing the commands below, you need to open the github login page in the browser and enter the printed code there. after the successful authorization your solution will be submitted automatically.
CHALLENGE=<challenge> npx hardhat run scripts/submit.js
or
EVMCODE=<code> CHALLENGE=<challenge> npx hardhat run scripts/submit.js
you can get your assess token with
public_repo
scope of your github accout and set it in environment variable then the login step will be skiped.export GITHUB_AUTH_TOKEN=<assess-token>
-
use the command below to check the online evaluation result of your submission where
<submitid>
is the result printed in previous step likeSUBMIT ID: 17
:SUBMIT=<submitid> npx hardhat run scripts/result.js
-
linux / osx / bsd
CHALLENGE=addition npx hardhat run scripts/test.js
or
export CHALLENGE=addition npx hardhat run scripts/test.js
-
windows cmd
set CHALLENGE=addition npx hardhat run scripts/test.js
-
windows powershell
$env:CHALLENGE='addition' npx hardhat run scripts/test.js