{"id":13620078,"url":"https://github.com/alephao/solidity-benchmarks","last_synced_at":"2025-08-28T22:24:07.204Z","repository":{"id":40561286,"uuid":"481319169","full_name":"alephao/solidity-benchmarks","owner":"alephao","description":"Benchmarks of popular contract implementations in solidity","archived":false,"fork":false,"pushed_at":"2024-07-28T21:46:37.000Z","size":465,"stargazers_count":104,"open_issues_count":2,"forks_count":11,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-01-20T23:11:24.283Z","etag":null,"topics":["benchmark","benchmarks","erc1155","erc20","erc721","solidity"],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alephao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-13T17:52:34.000Z","updated_at":"2024-12-06T20:07:20.000Z","dependencies_parsed_at":"2024-01-28T21:24:13.340Z","dependency_job_id":"acd141ca-0a40-44fb-97d0-6195e99af145","html_url":"https://github.com/alephao/solidity-benchmarks","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alephao%2Fsolidity-benchmarks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alephao%2Fsolidity-benchmarks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alephao%2Fsolidity-benchmarks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alephao%2Fsolidity-benchmarks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alephao","download_url":"https://codeload.github.com/alephao/solidity-benchmarks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235674134,"owners_count":19027523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","benchmarks","erc1155","erc20","erc721","solidity"],"created_at":"2024-08-01T21:00:51.965Z","updated_at":"2025-01-28T00:11:50.244Z","avatar_url":"https://github.com/alephao.png","language":"Solidity","readme":"# Solidity Benchmarks\n\nBenchmarks for popular implementations of contract standards.\n\n\u003e ⚠️ The gas usage shown in the benchmarks doesn't take into account the 21k gas added to every ethereum transaction\n\n- [ERC20 0.8.26](benchmarks/0.8.26/ERC20.md)\n- [ERC721 0.8.26](benchmarks/0.8.26/ERC721.md)\n- [ERC1155 0.8.26](benchmarks/0.8.26/ERC1155.md)\n\nYou can see benchmarks for different compiler versions on [`benchmarks/`](benchmarks)\n\nThe file [`data.json`](data.json) provides a json format of all the data used in the benchmarks. That file is generated by running the command `make json`.\n\n## Method used\n\nWe create a minimal implementation of each contract that uses the specific implementation as a base. Then for each of the methods we want to benchmark, we create a test contract that set the environment in the `setUp` function and each test only runs the specific function we're benchmarking, trying to reduce the noise as much as possible.\n\nThe gas usage shown here is not 100% accurate, but it's good enough to be able to compare the gas usage between the implementations.\n\nAll tests are generated using the template files in [`templates`](templates)\n\nAll tables in the readmes are generated using the scripts in [`scripts`](scripts)\n\n## Contributing\n\nThere are many ways to contribute to this project\n\n- Add a snapshot for the latest solc version\n- Add or suggest a contract implementation (the instructions for adding are below)\n- Update a contract implementation\n- Enhance the codegen scripts\n\n### Setup for local development\n\n- Install foundry http://getfoundry.sh\n- You'll need python 3 installed to run the scripts under the `scripts` folder\n- Install the python dependencies `pip install -r requirements.txt`\n- `git clone --recurse-submodules https://github.com/alephao/solidity-benchmarks.git`\n\n### How to add a contract\n\n1. Create a minimal implementation on `src/`, the contract name and file name should follow the convention `\u003cContract Type\u003e_\u003cVariation\u003e`.\n2. Implement the common interface that is in other files of the same contract type (for ERC721 for example, it's `mint` and `safeMint` functions)\n3. Add an entry to the `contracts.\u003ccontract type\u003e.variations` property on [test-cases.yml](test-cases.yml), following the examples there.\n4. Add an entry to [scripts/\u003ccontract type\u003e.py](scripts)'s `variants` var following the examples there. It should map the variant name you used in the contract like `ERC721_\u003cVariant\u003e` to the name you want to appear on the table. E.g.:\n5. In case you added an ERC721 that's also ERC2309 compliant, add a another contract in the same file following the convention `\u003cContract Type\u003e_\u003cVariation\u003e_ERC2309`, and add an entry to the `contracts.ERC721.ERC2309Variations` in the [test-cases.yml](test-cases.yml)\n\n```python\nvariations = {\n    \"OZ\": \"OpenZeppelin\",\n    \"OZEnumerable\": \"OpenZeppelin Enumerable\",\n    \"OZConsecutive\": \"OpenZeppelin Consecutive\",\n    \"Solady\": \"Solady\",\n    \"Solmate\": \"Solmate\",\n    \"A\": \"ERC721A\",\n    \"B\": \"ERC721B\",\n    \"K\": \"ERC721K\",\n}\n```\n\n\n5. Run the following commands:\n\n```console\nmake codegen\nmake snapshot\nmake readme\nmake json\n```\n\n\n6. Add the contract to the list at the top of the `\u003cContract Type\u003e.md`. (If you added a new ERC721, update the list on top of [`ERC721.md`](benchmarks/0.8.26/ERC721.md))\n\n### Quick links\n\n**ERC20**\n\n* [0.8.20](benchmarks/0.8.20/ERC20.md) or [0.8.20-ir](benchmarks/0.8.20-via-ir/ERC20.md)\n* [0.8.21](benchmarks/0.8.21/ERC20.md) or [0.8.21-ir](benchmarks/0.8.21-via-ir/ERC20.md)\n* [0.8.22](benchmarks/0.8.22/ERC20.md) or [0.8.22-ir](benchmarks/0.8.22-via-ir/ERC20.md)\n* [0.8.23](benchmarks/0.8.23/ERC20.md) or [0.8.23-ir](benchmarks/0.8.23-via-ir/ERC20.md)\n* [0.8.24](benchmarks/0.8.24/ERC20.md) or [0.8.24-ir](benchmarks/0.8.24-via-ir/ERC20.md)\n* [0.8.25](benchmarks/0.8.25/ERC20.md) or [0.8.25-ir](benchmarks/0.8.25-via-ir/ERC20.md)\n* [0.8.26](benchmarks/0.8.26/ERC20.md) or [0.8.26-ir](benchmarks/0.8.26-via-ir/ERC20.md)\n\n\n**ERC721**\n\n* [0.8.20](benchmarks/0.8.20/ERC721.md) or [0.8.20-ir](benchmarks/0.8.20-via-ir/ERC721.md)\n* [0.8.21](benchmarks/0.8.21/ERC721.md) or [0.8.21-ir](benchmarks/0.8.21-via-ir/ERC721.md)\n* [0.8.22](benchmarks/0.8.22/ERC721.md) or [0.8.22-ir](benchmarks/0.8.22-via-ir/ERC721.md)\n* [0.8.23](benchmarks/0.8.23/ERC721.md) or [0.8.23-ir](benchmarks/0.8.23-via-ir/ERC721.md)\n* [0.8.24](benchmarks/0.8.24/ERC721.md) or [0.8.24-ir](benchmarks/0.8.24-via-ir/ERC721.md)\n* [0.8.25](benchmarks/0.8.25/ERC721.md) or [0.8.25-ir](benchmarks/0.8.25-via-ir/ERC721.md)\n* [0.8.26](benchmarks/0.8.26/ERC721.md) or [0.8.26-ir](benchmarks/0.8.26-via-ir/ERC721.md)\n\n\n**ERC1155**\n\n* [0.8.20](benchmarks/0.8.20/ERC1155.md) or [0.8.20-ir](benchmarks/0.8.20-via-ir/ERC1155.md)\n* [0.8.21](benchmarks/0.8.21/ERC1155.md) or [0.8.21-ir](benchmarks/0.8.21-via-ir/ERC1155.md)\n* [0.8.22](benchmarks/0.8.22/ERC1155.md) or [0.8.22-ir](benchmarks/0.8.22-via-ir/ERC1155.md)\n* [0.8.23](benchmarks/0.8.23/ERC1155.md) or [0.8.23-ir](benchmarks/0.8.23-via-ir/ERC1155.md)\n* [0.8.24](benchmarks/0.8.24/ERC1155.md) or [0.8.24-ir](benchmarks/0.8.24-via-ir/ERC1155.md)\n* [0.8.25](benchmarks/0.8.25/ERC1155.md) or [0.8.25-ir](benchmarks/0.8.25-via-ir/ERC1155.md)\n* [0.8.26](benchmarks/0.8.26/ERC1155.md) or [0.8.26-ir](benchmarks/0.8.26-via-ir/ERC1155.md)\n\n","funding_links":[],"categories":["Resources"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falephao%2Fsolidity-benchmarks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falephao%2Fsolidity-benchmarks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falephao%2Fsolidity-benchmarks/lists"}