{"id":19485327,"url":"https://github.com/ava-labs/precompile-evm","last_synced_at":"2025-04-25T17:30:26.062Z","repository":{"id":179480884,"uuid":"605560683","full_name":"ava-labs/precompile-evm","owner":"ava-labs","description":"A new repository for Subnet-EVM Stateful Precompiles","archived":false,"fork":false,"pushed_at":"2025-04-10T14:17:09.000Z","size":1589,"stargazers_count":26,"open_issues_count":9,"forks_count":17,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-10T15:52:49.083Z","etag":null,"topics":["avalanche","evm","precompile","subnet","subnet-evm"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ava-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2023-02-23T12:21:23.000Z","updated_at":"2025-04-10T14:17:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"9d0d7c1b-2466-469c-952e-290baa693ecc","html_url":"https://github.com/ava-labs/precompile-evm","commit_stats":null,"previous_names":["ava-labs/precompile-evm"],"tags_count":18,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ava-labs%2Fprecompile-evm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ava-labs%2Fprecompile-evm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ava-labs%2Fprecompile-evm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ava-labs%2Fprecompile-evm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ava-labs","download_url":"https://codeload.github.com/ava-labs/precompile-evm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250861828,"owners_count":21499181,"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":["avalanche","evm","precompile","subnet","subnet-evm"],"created_at":"2024-11-10T20:27:14.138Z","updated_at":"2025-04-25T17:30:26.049Z","avatar_url":"https://github.com/ava-labs.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Precompile-EVM\n\nPrecompile-EVM is a repository for registering precompiles to Subnet-EVM without forking the Subnet-EVM codebase. Subnet-EVM supports registering external precompiles through the `precompile/modules` package. By importing Subnet-EVM as a library, you can register your own precompiles to Subnet-EVM and build it together with Subnet-EVM.\n\n## Environment Setup\n\nTo effectively build, run, and test Precompile-EVM, the following is a (non-exhaustive) list of dependencies that you will need:\n\n- Golang (1.21 || 1.22)\n- Node.js (^20.0)\n- [AvalancheGo](https://github.com/ava-labs/avalanchego)\n- [Avalanche-CLI](https://github.com/ava-labs/avalanche-cli)\n\nTo get started easily, we provide a Dev Container specification, that can be used using GitHub Codespace or locally using Docker and VS Code. DevContainers are a concept that utilizes containerization (via Docker containers) to create consistent and isolated development environment. We can access this environment through VS code, which allows for the development experience to feel as if you were developing locally..\n\n### Dev Container in Codespace\n\nCodespaces is a development environment service offered by GitHub that allows developers to write, run, test, and debug their code directly on a cloud machine provided by GitHub. The developer can edit the code through a VS Code running in the browser or locally.\n\nTo run a Codespace click on the **Code** and switch to the **Codespaces** tab. There, click **Create Codespace on branch [...]**.\n\n### Local Dev Container\n\nIn order to run the Dev Container locally:\n\n- Install VS Code, Docker and the [Dev Container Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)\n- Clone the Repository\n- Open the Container by issuing the Command \"Dev Containers: Reopen in Container\" in the VS Code command palette (on Mac-OS, run [Cmd + Shift + P]).\n\n## Learn about Precompile-EVM\n\nTo get a comprehensive introduction to Precompile-EVM, take the Avalanche Academy course on [Customizing the EVM](https://academy.avax.com/course/customizing-evm).\n\n## How to use\n\nThere is an example branch [hello-world-example](https://github.com/ava-labs/precompile-evm/tree/hello-world-example) in this repository. You can check the example branch to see how to register precompiles and test them.\n\n### 1. Generate Precompile Files\n\nFirst, you need to create your precompile contract interface in the `contracts` directory and build the ABI. Then you can generate your precompile as such:\n\n```bash\n./scripts/generate_precompile.sh --abi {abiPath} --out {outPath}\n```\n\nThis script installs the `precompilegen` tool from Subnet-EVM and runs it to generate your precompile.\n\n### 2. Register Precompile\n\nIn `plugin/main.go` Subnet-EVM is already imported and ready to be Run from the main package. All you need to do is explicitly register your precompiles to Subnet-EVM in `plugin/main.go` and build it together with Subnet-EVM. Precompiles generated by `precompilegen` tool have a self-registering mechanism in their `module.go/init()` function.\n\n### 3. Build\n\nYou can build your precompile and Subnet-EVM with `./scripts/build.sh`. This script builds Subnet-EVM, and your precompile together and generates a binary file. The binary file is compatible with AvalancheGo plugins.\n\n### 4. Run\n\nYou can run you Precompile-EVM by using the Avalanche CLI.\n\nFirst, create the configuration for your subnet.\n\n```bash\navalanche blockchain create myblockchain --custom --vm $AVALANCHEGO_PLUGIN_PATH/srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy --genesis ./.devcontainer/genesis-example.json\n```\n\nNext, launch the Subnet with your custom VM:\n\n```bash\navalanche blockchain deploy myblockchain\n```\n\n### Test\n\nYou can create contract tests in `contracts/test` with the Hardhat test framework. These can be run by adding ginkgko test cases in `tests/precompile/solidity/suites.go` and a suitable genesis file in `tests/precompile/genesis`. You can install AvalancheGo binaries with `./scripts/install_avalanchego_release.sh` then run the tests with `./scripts/run_ginkgo.sh`\n\n## Changing Versions\n\nIn order to upgrade the Subnet-EVM version, you need to change the version in `go.mod` and `scripts/versions.sh`. You can also change the AvalancheGo version through `scripts/versions.sh` as well. Then you can run `./scripts/build.sh` to build the plugin with the new version.\n\n## AvalancheGo Compatibility\n\n```text\n[v0.2.0] AvalancheGo@v1.11.0-v1.11.1 (Protocol Version: 33)\n[v0.2.1] AvalancheGo@v1.11.3-v1.11.9 (Protocol Version: 35)\n[v0.2.2] AvalancheGo@v1.11.3-v1.11.9 (Protocol Version: 35)\n[v0.2.3] AvalancheGo@v1.11.3-v1.11.9 (Protocol Version: 35)\n[v0.2.4] AvalancheGo@v1.11.11-v1.11.12 (Protocol Version: 37)\n[v0.2.5] AvalancheGo@v1.11.13-v1.12.1 (Protocol Version: 38)\n[v0.3.0] AvalancheGo@v1.12.2/1.13.0 (Protocol Version: 39)\n[v0.3.1] AvalancheGo@v1.12.2/1.13.0 (Protocol Version: 39)\n```\n\n## Release Process\n\nPlease refer to the [Releasing document](docs/releasing/README.md) for more information on how to release a new version of Precompile-EVM.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fava-labs%2Fprecompile-evm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fava-labs%2Fprecompile-evm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fava-labs%2Fprecompile-evm/lists"}