{"id":15647069,"url":"https://github.com/sambacha/openevm","last_synced_at":"2025-10-23T19:03:02.189Z","repository":{"id":43326844,"uuid":"419091337","full_name":"sambacha/openevm","owner":"sambacha","description":"Open Ethereum Virtual Machine - Knowledgebase, Documentation, etc","archived":false,"fork":false,"pushed_at":"2024-07-03T10:42:53.000Z","size":13066,"stargazers_count":50,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-15T06:53:38.148Z","etag":null,"topics":["ethereum","evm","evmc","evmone","llvm","virtual-machien"],"latest_commit_sha":null,"homepage":"https://sambacha.github.io/openevm/","language":"HTML","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/sambacha.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":"2021-10-19T21:07:50.000Z","updated_at":"2025-07-05T04:45:31.000Z","dependencies_parsed_at":"2024-05-13T02:28:53.495Z","dependency_job_id":"ef5572da-74aa-4652-afa9-bdfa53f4b6c6","html_url":"https://github.com/sambacha/openevm","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sambacha/openevm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fopenevm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fopenevm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fopenevm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fopenevm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sambacha","download_url":"https://codeload.github.com/sambacha/openevm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fopenevm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271470228,"owners_count":24765353,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ethereum","evm","evmc","evmone","llvm","virtual-machien"],"created_at":"2024-10-03T12:16:41.627Z","updated_at":"2025-10-23T19:02:57.120Z","avatar_url":"https://github.com/sambacha.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003e [!NOTE]    \n\u003e [See v1 Site](https://sambacha.github.io/openevm/ethereum.html)\n\n\u003e [!WARNING]\n\u003e [See v2 Site](https://refined-github-html-preview.kidonng.workers.dev/sambacha/openevm/raw/gh-pages/node_modules/.cache/gh-pages/https!github.com!sambacha!openevm/index.html)\n\n## EVM opcodes vs ewasm methods\n\nThese tables compares EVM opcodes with ewasm methods and wasm instructions. The EVM defines 134 opcodes (as of the Byzantium hard fork). Of these 134 opcodes, some represent generic machine instructions (ADD, MUL, ISZERO, XOR, etc.) and the rest are Ethereum-specific operations (SLOAD, SSTORE, GASPRICE, BLOCKHASH, etc.).\n\nWhen EVM bytecode is transpiled to ewasm bytecode, the Ethereum-specific opcodes translate to corresponding ewasm interface methods (Ethereum Environment Interface (EEI) methods). These interface methods are provided as [host functions](https://webassembly.github.io/threads/exec/runtime.html#syntax-hostfunc) to the wasm VM. All other EVM opcodes are not Ethereum-specific and do not access data from the Ethereum environment, so they reduce to pure wasm instructions.\n\nTo reference EVM opcodes, try the [yellow paper](https://ethereum.github.io/yellowpaper/paper.pdf), the [readable yellow paper](https://github.com/chronaeon/beigepaper/blob/master/beigepaper.pdf), or the [pyethereum implementation](https://github.com/ethereum/pyethereum/blob/develop/ethereum/opcodes.py).\n\nTo reference ewasm interface methods, see the [EEI spec](https://github.com/ewasm/design/blob/master/eth_interface.md).\n\n\n### EVM opcodes (Byzantium) with corresponding ewasm methods (Ethereum Environment Interface (EEI) Revision 4)\n\nEVM opcode            |     ewasm interface method\n----------------------|-----------------------------\n0x00: STOP            |      finish(0, 0)\n0x30: ADDRESS         |      getAddress\n0x31: BALANCE         |      getBalance\n0x32: ORIGIN          |      getTxOrigin\n0x33: CALLER          |      getCaller\n0x34: CALLVALUE       |      getCallValue\n0x35: CALLDATALOAD    |      callDataCopy(resultOffset, dataOffset, 32)\n0x36: CALLDATASIZE    |      getCallDataSize\n0x37: CALLDATACOPY    |      callDataCopy(resultOffset, dataOffset, size)\n0x38: CODESIZE        |      getCodeSize\n0x39: CODECOPY        |      codeCopy\n0x3a: GASPRICE        |      getTxGasPrice\n0x3b: EXTCODESIZE     |      getExternalCodeSize\n0x3c: EXTCODECOPY     |      externalCodeCopy\n0x3d: RETURNDATASIZE  |      getReturnDataSize\n0x3e: RETURNDATACOPY  |      returnDataCopy\n0x40: BLOCKHASH       |      getBlockHash\n0x41: COINBASE        |      getBlockCoinbase\n0x42: TIMESTAMP       |      getBlockTimestamp\n0x43: NUMBER          |      getBlockNumber\n0x44: DIFFICULTY      |      getBlockDifficulty\n0x45: GASLIMIT        |      getBlockGasLimit\n0x54: SLOAD           |      storageLoad\n0x55: SSTORE          |      storageStore\n0x58: PC              |      -\u003csup\u003e[†](#f1)\u003c/sup\u003e\n0x5a: GAS             |      getGasLeft\n0xa0: LOG0            |      log(0,..)\n...                   |\n0xa4: LOG4            |      log(4,..)\n0xf0: CREATE          |      create\n0xf1: CALL            |      call\n0xf2: CALLCODE        |      callCode\n0xf3: RETURN          |      finish\n0xf4: DELEGATECALL    |      callDelegate\n0xfa: STATICCALL      |      callStatic\n0xfd: REVERT          |      revert\n0xff: SELFDESTRUCT    |      selfDestruct\n\n\n†. \u003csmall id=\"f1\"\u003eIn EVM, the Program Counter (PC) opcode returns the currently executing bytecode position. When EVM is transpiled to ewasm with evm2wasm, this bytecode position is calculated by the transpiler and [inserted as a wasm constant](https://github.com/ewasm/evm2wasm/blob/80136977553c9b22e385f919fff808ef8a54be95/index.js#L247-L248). For ewasm code that is not transpiled from EVM, there is no interface method corresponding to the `PC` opcode.\u003c/small\u003e\n\n\n## EVM opcodes vs WebAssembly instructions\n\nWhereas EVM is an untyped VM with a 256-bit word size, WebAssembly is a typed VM with 32-bit and 64-bit word sizes. The two wasm base types are integers and floats, which when combined with the two word sizes, create four types: i32, i64, f32, f64.\n\nEthereum WebAssembly, or ewasm, is a subset of wasm. Only the integer types (i32 and i64) are supported, floating point types and floating point instructions are not supported. In total, 60 wasm instructions are supported in ewasm:\n* 10 control flow instructions\n* 11 basic instructions\n* 19 integer arithmetic instructions\n* 10 integer comparison instructions\n* 3 integer conversion instructions\n* 7 memory instructions (load, store, extend)\n\newasm excludes the wasm floating point instructions:\n* 14 floating point arithmetic instructions\n* 6 floating point comparison instructions\n* 7 floating point conversion instructions\n\nTo reference wasm instructions, see the [wasm spec](https://github.com/WebAssembly/design/blob/master/Semantics.md) or [reference manual](https://github.com/sunfishcode/wasm-reference-manual/blob/master/WebAssembly.md#instructions).\n\n\n### EVM opcodes that reduce to wasm instructions\n\nEVM opcode (256-bit)  |    wasm instruction i32/i64 (32-bit or 64-bit)\n----------------------|----------------------\n0x01: ADD             |       i32.add\n0x02: MUL             |       i32.mul\n0x03: SUB             |       i32.sub\n0x04: DIV             |       i32.div_u\n0x05: SDIV            |       i32.div_s\n0x06: MOD             |       i32.rem_u\n0x07: SMOD            |       i32.rem_s\n0x08: ADDMOD          |       -\u003csup\u003e[‡](#f2)\u003c/sup\u003e\n0x09: MULMOD          |       -\u003csup\u003e[‡](#f2)\u003c/sup\u003e\n0x0a: EXP             |       -\u003csup\u003e[‡](#f2)\u003c/sup\u003e\n0x0b: SIGNEXTEND      |       -\u003csup\u003e[‡](#f2)\u003c/sup\u003e\n0x10: LT              |       i32.lt_u\n0x11: GT              |       i32.gt_u\n0x12: SLT             |       i32.lt_s\n0x13: SGT             |       i32.gt_s\n0x14: EQ              |       i32.eq\n0x15: ISZERO          |       i32.eqz\n0x16: AND             |       i32.and\n0x17: OR              |       i32.or\n0x18: XOR             |       i32.xor\n0x19: NOT             |       i32.sub (i32.const 0xffffffff)\n0x1a: BYTE            |       i32.load8\n0x20: SHA3            |       -\u003csup\u003e[‡](#f2)\u003c/sup\u003e\n0x50: POP             |       drop\n0x51: MLOAD           |       i32.load\n0x52: MSTORE          |       i32.store\n0x53: MSTORE8         |       i32.store\n0x56: JUMP            |       br\n0x57: JUMPI           |       br_if, br_table\n0x59: MSIZE           |       current_memory\n0x5b: JUMPDEST        |       block, loop\n0xfe: INVALID         |       unreachable\n0x60: PUSH1           |       i32.const\n...                   |\n0x7f: PUSH32          |       i32.const\n0x80: DUP1            |       get_global, get_local\n...                   |\n0x8f: DUP16           |       get_global, get_local\n0x90: SWAP1           |       get_global, get_local\n...                   |\n0x9f: SWAP16          |       get_global, get_local\n\n\n‡. \u003csmall id=\"f2\"\u003eSome EVM opcodes, such as `ADDMOD` (modular addition), `EXP` (exponentiation), or `SHA3` (Keccak-256 hash), do not have simple reductions to single wasm instructions (or to only a few wasm instructions). The functionality of these opcodes is replicated by a relatively large wasm module (for instance, `SHA3` reduces to about [900 lines of wast code](https://github.com/ewasm/evm2wasm/blob/80136977553c9b22e385f919fff808ef8a54be95/wasm/keccak.wast)).\u003c/small\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsambacha%2Fopenevm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsambacha%2Fopenevm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsambacha%2Fopenevm/lists"}