The Solidity Gas Golfing Contest was a competition for Solidity coders to produce the most gas-efficient code they can for a series of straightforward challenges. The 1st SGGC ran from 23 May to 30 June 2018.
Each challenge is divided into "Standard" and "Wild" categories. Entries in the "Wild" category may use any Solidity language feature, while entries in the "Standard" category are prohibited from using inline assembly.
The winner of each track received a 1 ether prize, sponsored by ChainSecurity and CryptoFin.
Templates and documentation for each of the challenges, and test vectors to check code against, are at this truffle project and this embark project. Note that the test vectors used by the SGGC server are different from those provided.
To qualify for the leaderboard, an entrant must have submitted valid solutions for all five challenges. Their score is the sum of the gas used for their best submission for each challenge.
Rank | Submitter | Gas used |
---|---|---|
1 | hyszeth.eth | 2868097 |
2 | wicketh.eth | 3455962 |
3 | 0x53b21be84eece2e615016c337edcda204758704b | 3576871 |
4 | ricmoo.firefly.eth | 3660462 |
5 | 0x8888884176551035fc2465df63841ab1432e7350 | 4718873 |
6 | 0x9e0ad99de20a444718bfc50ffdbf13df8ff8f3bf | 4748613 |
7 | 0xabcdef0db461f2f88752c454aad3763c46a4160f | 5115086 |
8 | 0xff3c2241cd767b735b26f3bd62c39b57ce02123d | 6274768 |
9 | michaelsproul.eth | 8280892 |
10 | sggc.yuetloo.eth | 9216268 |
11 | logvinov.eth | 20081714 |
Rank | Submitter | Gas used |
---|---|---|
1 | zac.creditmint.eth | 291367 |
2 | wicketh.eth | 298982 |
3 | ricmoo.firefly.eth | 1252701 |
4 | 0x53b21be84eece2e615016c337edcda204758704b | 1775407 |
5 | hyszeth.eth | 2868097 |
6 | 0x8888884176551035fc2465df63841ab1432e7350 | 3238849 |
7 | 0xabcdef0db461f2f88752c454aad3763c46a4160f | 3845087 |
8 | 0x9e0ad99de20a444718bfc50ffdbf13df8ff8f3bf | 4748613 |
9 | 0xff3c2241cd767b735b26f3bd62c39b57ce02123d | 6274768 |
10 | michaelsproul.eth | 8280892 |
11 | sggc.yuetloo.eth | 9216268 |
12 | logvinov.eth | 17782787 |
Sort a list of integers into ascending order.
Rank | Submitter | Gas used |
---|---|---|
1 | hyszeth.eth | 653499 |
2 | 0x9e0ad99de20a444... | 693585 |
3 | wicketh.eth | 707249 |
4 | cottenio.eth | 741234 |
5 | 0x53b21be84eece2e... | 744429 |
6 | 0x2b7de7118763bea... | 808285 |
7 | 0x00f9474f1f603de... | 852720 |
8 | ricmoo.firefly.eth | 854843 |
9 | 0x888888417655103... | 861797 |
10 | sggc.yuetloo.eth | 867837 |
Rank | Submitter | Gas used |
---|---|---|
1 | wicketh.eth | 100539 |
2 | zac.creditmint.eth | 118126 |
3 | ricmoo.firefly.eth | 525934 |
4 | 0xec3281124d4c2fc... | 528351 |
5 | 0x6b9205614d2523d... | 585876 |
6 | 0x1dba1131000664b... | 592766 |
7 | hyszeth.eth | 653499 |
8 | 0x9e0ad99de20a444... | 693585 |
9 | cottenio.eth | 741234 |
10 | 0x53b21be84eece2e... | 744429 |
Implement an interpreter for the BrainFuck esoteric language.
Rank | Submitter | Gas used |
---|---|---|
1 | hyszeth.eth | 947286 |
2 | wicketh.eth | 1323506 |
3 | ricmoo.firefly.eth | 1355175 |
4 | 0x53b21be84eece2e... | 1460995 |
5 | 0x888888417655103... | 1954870 |
6 | 0xabcdef0db461f2f... | 2194736 |
7 | 0x9e0ad99de20a444... | 2299099 |
8 | 0xd0b40847c318da4... | 2643083 |
9 | 0xff3c2241cd767b7... | 2742615 |
10 | kronosapiens.eth | 3715493 |
Rank | Submitter | Gas used |
---|---|---|
1 | wicketh.eth | 67064 |
2 | zac.creditmint.eth | 68798 |
3 | ricmoo.firefly.eth | 386093 |
4 | 0x53b21be84eece2e... | 577231 |
5 | 0xec3281124d4c2fc... | 787754 |
6 | hyszeth.eth | 947286 |
7 | 0x888888417655103... | 1850940 |
8 | 0xabcdef0db461f2f... | 2194736 |
9 | 0x9e0ad99de20a444... | 2299099 |
10 | 0xd0b40847c318da4... | 2643083 |
Decode hex-encoded binary data.
Rank | Submitter | Gas used |
---|---|---|
1 | hyszeth.eth | 881979 |
2 | wicketh.eth | 912835 |
3 | 0x53b21be84eece2e... | 971807 |
4 | ricmoo.firefly.eth | 983454 |
5 | 0x9e0ad99de20a444... | 1002861 |
6 | 0x64f80d64e241576... | 1066430 |
7 | 0x31efd75bc0b5fba... | 1109151 |
8 | michaelsproul.eth | 1127851 |
9 | 0x888888417655103... | 1208435 |
10 | 0xff2c5414a8f9d1c... | 1212152 |
Rank | Submitter | Gas used |
---|---|---|
1 | zac.creditmint.eth | 18634 |
2 | wicketh.eth | 20131 |
3 | ricmoo.firefly.eth | 30654 |
4 | 0x1dba1131000664b... | 36849 |
5 | 0x53b21be84eece2e... | 54107 |
6 | 0x5034d12fa987918... | 59128 |
7 | 0x06ae35566bc4c75... | 78539 |
8 | 0x01a32b7b34a870d... | 169039 |
9 | 0x888888417655103... | 192500 |
10 | 0xabcdef0db461f2f... | 192583 |
Return the index of the first match of a substring in a string.
Rank | Submitter | Gas used |
---|---|---|
1 | hyszeth.eth | 81240 |
2 | 0x53b21be84eece2e... | 90577 |
3 | wicketh.eth | 105956 |
4 | ricmoo.firefly.eth | 109638 |
5 | sggc.yuetloo.eth | 159135 |
6 | 0x9e0ad99de20a444... | 216789 |
7 | 0x888888417655103... | 288398 |
8 | 0xabcdef0db461f2f... | 304961 |
9 | makoto.gitcoin.eth | 327342 |
10 | michaelsproul.eth | 330926 |
Rank | Submitter | Gas used |
---|---|---|
1 | zac.creditmint.eth | 10670 |
2 | wicketh.eth | 25500 |
3 | ricmoo.firefly.eth | 55413 |
4 | 0x888888417655103... | 57906 |
5 | 0xabcdef0db461f2f... | 57906 |
6 | 0x1dba1131000664b... | 79862 |
7 | hyszeth.eth | 81240 |
8 | 0x53b21be84eece2e... | 90577 |
9 | logvinov.eth | 97804 |
10 | sggc.yuetloo.eth | 159135 |
Given a list, remove duplicate elements, while preserving the order of the elements.
Rank | Submitter | Gas used |
---|---|---|
1 | hyszeth.eth | 304093 |
2 | 0x53b21be84eece2e... | 309063 |
3 | 0xe82d5b10ad98d34... | 333079 |
4 | ricmoo.firefly.eth | 357352 |
5 | 0xd0b40847c318da4... | 390527 |
6 | 0x888888417655103... | 405373 |
7 | wicketh.eth | 406416 |
8 | 0xea674fdde714fd9... | 439389 |
9 | 0xabcdef0db461f2f... | 516483 |
10 | michaelsproul.eth | 527619 |
Rank | Submitter | Gas used |
---|---|---|
1 | zac.creditmint.eth | 75139 |
2 | wicketh.eth | 85748 |
3 | ricmoo.firefly.eth | 254607 |
4 | 0x888888417655103... | 275706 |
5 | 0x1dba1131000664b... | 278268 |
6 | hyszeth.eth | 304093 |
7 | 0x53b21be84eece2e... | 309063 |
8 | 0xe82d5b10ad98d34... | 333079 |
9 | 0xd0b40847c318da4... | 390527 |
10 | 0xea674fdde714fd9... | 439389 |
SGCC is pinned to use version 0.4.24. Optimisation is enabled and set to 200 iterations.
SGGC supports ENS reverse resolution. If an entrant supplies an address that has reverse resolution configured, we will display the entrant's ENS name instead of their address.
You can configure your own ENS reverse record on the 'Reverse Record' tab of the ENS Manager DApp.
ChainSecurity have offered 0.5 ETH each for the winner of the Standard and Wild tracks.
CryptoFin have matched this contribution, bringing the total prize to 1 ether for each track.
In addition, you can expect the adulation of your peers and colleagues. We may also create an NFT for the winners.
To be included on the leaderboard, you must have submitted at least one entry in each challenge. Your score will be the sum of the gas usage your best entry for each challenge.
The SGGC server has a secret set of test vectors, different from the public ones. They will test some edge cases that the public set do not - make sure your code handles every scenario you can think of!
The SGGC server has a secret set of test vectors, which will result in different gas consumption. It also measures gas usage slightly differently to truffle, counting only the execution cost, while Truffle also accounts for the gas cost for the call data.
If your submission is using a lot more gas than expected, check to see how your code might handle worst-case inputs. Can you craft an input that makes it perform poorly?
During the contest, only the scores of the leading players and entries are available. Once the contest is over, the source of all valid entries will be published on GitHub.