{"id":15291942,"url":"https://github.com/texora/evm2near","last_synced_at":"2025-04-13T10:22:13.217Z","repository":{"id":256502066,"uuid":"846331657","full_name":"texora/evm2near","owner":"texora","description":"evm2near compiles Solidity contracts into NEAR WebAssembly contracts.","archived":false,"fork":false,"pushed_at":"2024-08-23T01:40:30.000Z","size":113,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-31T19:36:59.471Z","etag":null,"topics":["evm","makefile","near","rust","solidity"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/texora.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":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-23T01:39:09.000Z","updated_at":"2024-10-23T13:06:11.000Z","dependencies_parsed_at":"2024-09-17T22:27:48.787Z","dependency_job_id":null,"html_url":"https://github.com/texora/evm2near","commit_stats":null,"previous_names":["zyphorix/evm2near","texora/evm2near"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/texora%2Fevm2near","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/texora%2Fevm2near/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/texora%2Fevm2near/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/texora%2Fevm2near/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/texora","download_url":"https://codeload.github.com/texora/evm2near/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223581935,"owners_count":17168655,"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":["evm","makefile","near","rust","solidity"],"created_at":"2024-09-30T16:15:16.263Z","updated_at":"2024-11-07T20:06:08.266Z","avatar_url":"https://github.com/texora.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EVM → NEAR\n\n`evm2near` is a project for compiling EVM bytecode into wasm bytecode, with the particular goal of having that wasm artifact be executable on the [NEAR blockchain](https://near.org/).\nFor ease of testing locally, `evm2near` also currently supports [wasi](https://wasi.dev/) as a target platform.\nThe wasi output can be run locally using a wasm runtime, for example [wasmtime](https://wasmtime.dev/).\nThis can be useful for debugging contracts without deploying to NEAR.\n\nEven though `evm2near` is a general EVM bytecode to wasm bytecode transpiler, the CLI interface accepts a Solidity source file as input for convenience.\nThe source file is compiled to EVM bytecode using [solc](https://github.com/ethereum/solidity).\nUsing Solidity and `solc`, means `evm2near` also has access to the contract ABI.\nThis allows the output wasm artifact to contain functions that match the ones given in the contract.\nFor example, `test/calc.sol` contains a contract with a function `multiply(int a, int b)`, and the compiled wasm artifact will also contain a function called `multiply` which takes a JSON string as input.\nThe JSON input is expected to be an object with fields matching the function argument names (`a` and `b` in the example).\nThese functions generated based on the ABI are in addition to a general function called `execute`, which accepts binary input following the usual Solidity ABI (i.e. the first four bytes are the \"selector\" derived from the function signature, the remaining bytes are the input arguments encoded using Solidity's ABI format).\n\n## Usage\n\n### Compiling to wasi (for running locally)\n\n```\nevm2near INPUT_SOLIDITY_CONTRACT -o OUTPUT_WASM_FILE -b wasi\n```\n\nExample:\n\n```console\nevm2near test/calc.sol -o test.wasm -b wasi\n```\n\nRunning the output in wasmtime:\n\n```console\nwasmtime --allow-unknown-exports test.wasm --invoke multiply -- '{\"a\":6, \"b\": 7}'\n```\n\n### Compiling to NEAR\n\n```\nevm2near INPUT_SOLIDITY_CONTRACT -o OUTPUT_WASM_FILE -b near\n```\n\nExample:\n\n```console\nevm2near test/calc.sol -o test.wasm -b near\n```\n\nRunning the output using [near-cli](https://github.com/near/near-cli):\n\n```console\nnear --networkId testnet dev-deploy test.wasm\nnear --networkId testnet --accountId $NEAR_ACCOUNT_ID call $DEV_CONTACT_ID multiply '{\"a\": 7, \"b\": 6}'\n```\n\nNote: you will need to set the value of `$DEV_CONTACT_ID` from the output of the prior `dev-deploy` command (you will see something like `Account id: dev-1663014663747-27418521013742` included in the output, then you would set `DEV_CONTACT_ID=dev-1663014663747-27418521013742`).\n\nNote: you will need to use your own NEAR account for `$NEAR_ACCOUNT_ID`.\nIf you do not have one, you can create it using the [NEAR wallet](https://wallet.testnet.near.org/create), then access it via the CLI using the `near login` command.\n\n### Help\n\n```console\nevm2near --help\n```\n\n## Development\n\n### Prerequisites\n\n- Rust toolchain (nightly 2022-09-07)\n- Solidity compiler `solc` (0.8.16+)\n- `wasm-strip` from WABT\n\n#### Prerequisites on macOS\n\n```console\nbrew install rustup solidity wabt\n```\n\n#### Prerequisites on Ubuntu\n\n```console\ncurl -sSf https://sh.rustup.rs | sh\n\napt-add-repository ppa:ethereum/ethereum\napt update\napt install solc\n\napt install wabt\n```\n\n### Development Builds\n\n```console\nrustup target add wasm32-wasi\nrustup target add wasm32-unknown-unknown\nmake\n./evm2near --help\n```\n\n## Release\n\n### Prerequisites\n\n- Rust toolchain (nightly 2022-09-07)\n- MinGW-w64 (10.0.0+)\n- `wasm-strip` from WABT\n\n#### Prerequisites on macOS\n\n```console\nbrew install rustup mingw-w64 wabt\n```\n\n#### Prerequisites on Ubuntu\n\n```console\ncurl -sSf https://sh.rustup.rs | sh\n\napt install mingw-w64 wabt\n```\n\n### Release Builds\n\n```console\nrustup target add wasm32-wasi\nrustup target add wasm32-unknown-unknown\nrustup target add aarch64-apple-darwin\nrustup target add x86_64-apple-darwin\nrustup target add aarch64-pc-windows-msvc\nrustup target add x86_64-pc-windows-gnu\nrustup target add aarch64-unknown-linux-musl\nrustup target add x86_64-unknown-linux-musl\nmake clean release\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftexora%2Fevm2near","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftexora%2Fevm2near","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftexora%2Fevm2near/lists"}