{"id":38543125,"url":"https://github.com/evmts/typevm","last_synced_at":"2026-01-17T07:13:09.253Z","repository":{"id":321344283,"uuid":"1085429154","full_name":"evmts/typevm","owner":"evmts","description":null,"archived":false,"fork":false,"pushed_at":"2025-10-29T06:23:44.000Z","size":3272,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-29T06:29:12.823Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/evmts.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-29T03:02:36.000Z","updated_at":"2025-10-29T04:58:19.000Z","dependencies_parsed_at":"2025-10-29T06:29:19.141Z","dependency_job_id":"780e7ad7-01eb-440f-8deb-01343db6bc28","html_url":"https://github.com/evmts/typevm","commit_stats":null,"previous_names":["evmts/typevm"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/evmts/typevm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evmts%2Ftypevm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evmts%2Ftypevm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evmts%2Ftypevm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evmts%2Ftypevm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evmts","download_url":"https://codeload.github.com/evmts/typevm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evmts%2Ftypevm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28503214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-17T07:13:09.188Z","updated_at":"2026-01-17T07:13:09.246Z","avatar_url":"https://github.com/evmts.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TypeVM\n\nA TypeScript type-level EVM (Ethereum Virtual Machine) interpreter. Execute EVM bytecode entirely at compile time using TypeScript's type system!\n\n## Features\n\n- ✅ Type-level bytecode parsing and execution\n- ✅ Stack operations (PUSH, POP, DUP, SWAP)\n- ✅ Arithmetic and logic (ADD, MUL, DIV, MOD, SUB, EQ, ISZERO, LT, GT, SLT, SGT)\n- ✅ Bitwise operations (AND, OR, XOR, NOT, BYTE, SHL, SHR, SAR, SIGNEXTEND)\n- ✅ Cryptographic operations (SHA3/KECCAK256 via [cryptoscript](https://github.com/kyscott18/cryptoscript))\n- ✅ Control flow opcodes (STOP, RETURN, REVERT, INVALID, JUMPDEST)\n- ✅ Memory, Storage, and Context infrastructure\n- ✅ Compile-time error detection (stack underflow, invalid opcodes, etc.)\n- ✅ Step limit protection (256 steps max)\n- ✅ Gas metering with configurable limit\n\n## Example\n\n```typescript\nimport type { ExecuteEvm } from 'typescript-evm';\n\n// Execute: PUSH1 0x42, RETURN\n// This pushes 0x42 onto the stack and returns it\ntype Result1 = ExecuteEvm\u003c'0x6042F3'\u003e;\n// Result1 = {\n//   status: 'ok';\n//   stack: ['0x42'];\n//   returnData: '0x42';\n// }\n\n// Execute: PUSH1 0x01, PUSH1 0x01, EQ, RETURN\n// Pushes 1 twice, compares for equality, returns result\ntype Result2 = ExecuteEvm\u003c'0x600160011415F3'\u003e;\n// Result2 = {\n//   status: 'ok';\n//   stack: ['0x01'];\n//   returnData: '0x01';  // true (1 == 1)\n// }\n\n// Execute: PUSH1 0x01, PUSH1 0x02, SWAP1, POP, RETURN\n// Demonstrates stack manipulation\ntype Result3 = ExecuteEvm\u003c'0x600160029050F3'\u003e;\n// Result3 = {\n//   status: 'ok';\n//   returnData: '0x02';\n// }\n\n// Stack underflow error\ntype Result4 = ExecuteEvm\u003c'0x50F3'\u003e;  // POP on empty stack, then RETURN\n// Result4 = {\n//   status: 'error';\n//   reason: 'stack_underflow';\n//   stack: [];\n// }\n\n// ISZERO example\ntype Result5 = ExecuteEvm\u003c'0x600015F3'\u003e;  // PUSH1 0x00, ISZERO, RETURN\n// Result5 = {\n//   status: 'ok';\n//   returnData: '0x01';  // true (0 is zero)\n// }\n\n// SHA3/KECCAK256 example - hash of empty input\ntype Result6 = ExecuteEvm\u003c'0x6000600020F3'\u003e;  // PUSH1 0x00, PUSH1 0x00, SHA3, RETURN\n// Result6 = {\n//   status: 'ok';\n//   returnData: '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470';\n//   // This is keccak256(\"\") - the hash of empty input\n// }\n```\n\n## Opcode Checklist\n\nComprehensive list of EVM opcodes with implementation status for TypeVM. Checked items are implemented at the type level today.\n\n### Stop \u0026 Arithmetic (0x00–0x1F)\n- [x] `0x00` STOP\n- [x] `0x01` ADD\n- [x] `0x02` MUL\n- [x] `0x03` SUB\n- [x] `0x04` DIV\n- [ ] `0x05` SDIV\n- [x] `0x06` MOD\n- [ ] `0x07` SMOD\n- [ ] `0x08` ADDMOD\n- [ ] `0x09` MULMOD\n- [ ] `0x0A` EXP\n- [x] `0x0B` SIGNEXTEND\n- [x] `0x10` LT\n- [x] `0x11` GT\n- [x] `0x12` SLT\n- [x] `0x13` SGT\n- [x] `0x14` EQ\n- [x] `0x15` ISZERO\n- [x] `0x16` AND\n- [x] `0x17` OR\n- [x] `0x18` XOR\n- [x] `0x19` NOT\n- [x] `0x1A` BYTE\n- [x] `0x1B` SHL\n- [x] `0x1C` SHR\n- [x] `0x1D` SAR\n\n### SHA3 (0x20)\n- [x] `0x20` KECCAK256 (SHA3)\n\n### Environment and Code (0x30–0x3F)\n- [x] `0x30` ADDRESS (returns 0x00: no contract context stub)\n- [ ] `0x31` BALANCE\n- [x] `0x32` ORIGIN (returns 0: stub)\n- [x] `0x33` CALLER (returns 0: stub)\n- [x] `0x34` CALLVALUE (returns 0: stub)\n- [ ] `0x35` CALLDATALOAD\n- [ ] `0x36` CALLDATASIZE\n- [ ] `0x37` CALLDATACOPY\n- [x] `0x38` CODESIZE (returns 0: stub)\n- [ ] `0x39` CODECOPY\n- [x] `0x3A` GASPRICE (returns 0: stub)\n- [ ] `0x3B` EXTCODESIZE\n- [ ] `0x3C` EXTCODECOPY\n- [x] `0x3D` RETURNDATASIZE (returns 0: no external call context)\n- [x] `0x3E` RETURNDATACOPY (memory ignored)\n- [ ] `0x3F` EXTCODEHASH\n\n### Block Information (0x40–0x49)\n- [ ] `0x40` BLOCKHASH\n- [ ] `0x41` COINBASE\n- [x] `0x42` TIMESTAMP (returns 0: stub)\n- [x] `0x43` NUMBER (returns 0: stub)\n- [ ] `0x44` PREVRANDAO (formerly DIFFICULTY)\n- [ ] `0x45` GASLIMIT\n- [x] `0x46` CHAINID (returns 0: stub)\n- [x] `0x47` SELFBALANCE (returns 0: stub)\n- [x] `0x48` BASEFEE (returns 0: stub)\n- [x] `0x49` BLOBBASEFEE (returns 0: stub)\n\n### Memory, Storage, and Flow (0x50–0x5F)\n- [x] `0x50` POP\n- [ ] `0x51` MLOAD\n- [ ] `0x52` MSTORE\n- [ ] `0x53` MSTORE8\n- [ ] `0x54` SLOAD\n- [ ] `0x55` SSTORE\n- [ ] `0x56` JUMP\n- [ ] `0x57` JUMPI\n- [x] `0x58` PC (returns 0: PC stub for now)\n- [x] `0x59` MSIZE\n- [x] `0x5A` GAS (returns 0: no gas-left calculation)\n- [x] `0x5B` JUMPDEST\n- [ ] `0x5C` TLOAD\n- [ ] `0x5D` TSTORE\n- [ ] `0x5E` MCOPY\n- [x] `0x5F` PUSH0\n\n### Push Operations (0x60–0x7F)\n- [x] `0x60–0x7F` PUSH1–PUSH32\n\n### Duplication Operations (0x80–0x8F)\n- [x] `0x80–0x8F` DUP1–DUP16\n\n### Exchange Operations (0x90–0x9F)\n- [x] `0x90–0x9F` SWAP1–SWAP16\n\n### Logging (0xA0–0xA4)\n- [x] `0xA0` LOG0 (memory ignored)\n- [x] `0xA1` LOG1 (memory ignored)\n- [x] `0xA2` LOG2 (memory ignored)\n- [x] `0xA3` LOG3 (memory ignored)\n- [x] `0xA4` LOG4 (memory ignored)\n\n### System (0xF0–0xFF)\n- [ ] `0xF0` CREATE\n- [ ] `0xF1` CALL\n- [ ] `0xF2` CALLCODE\n- [x] `0xF3` RETURN\n- [ ] `0xF4` DELEGATECALL\n- [ ] `0xF5` CREATE2\n- [ ] `0xFA` STATICCALL\n- [x] `0xFD` REVERT\n- [x] `0xFE` INVALID\n- [ ] `0xFF` SELFDESTRUCT\n\nNotes:\n- Checklist reflects commonly recognized opcodes up through recent forks (e.g., PUSH0, TLOAD/TSTORE, MCOPY, BLOBBASEFEE). Some opcodes are context-dependent at runtime and are intentionally not implemented in this compile-time interpreter.\n- Unknown opcodes result in a type-level `unknown_opcode` error; unsupported stack effects produce `stack_underflow`.\n\n## Gas Metering\n\n- Every executed opcode consumes gas per a simple schedule for currently supported instructions:\n  - Arithmetic/Logic: 3 gas (ADD, MUL, SUB, DIV, MOD, EQ, ISZERO, LT, GT, SLT, SGT, AND, OR, XOR, NOT, SIGNEXTEND, BYTE, SHL, SHR, SAR)\n  - SHA3/KECCAK256: 30 gas\n  - Stack ops: POP (2 gas), PUSH0 (2 gas), PUSH1-32/DUP/SWAP (3 gas)\n  - Control flow: JUMPDEST (1 gas), STOP/RETURN/REVERT/INVALID (0 gas)\n  - Context stubs: 3 gas (ADDRESS, ORIGIN, CALLER, etc.)\n- Default gas limit is `1000`. Provide a custom limit via the second generic parameter: `ExecuteEvm\u003c'0x6001F3', 64\u003e`.\n- Results expose `gasUsed` and `gasLimit` fields for introspection.\n\n## Limitations\n\n- Maximum 256 execution steps (prevents infinite type recursion)\n- SHA3/KECCAK256 supports up to 256-bit inputs (cryptoscript library constraint)\n- Memory operations are basic (no dynamic expansion modeling)\n- No storage persistence or external calls\n- TypeScript's type recursion limits apply\n- Compile times increase with bytecode complexity\n\n## Installation\n\n```bash\nnpm install typescript-evm\n```\n\n## Type Checking\n\nRun type checks to verify the type tests:\n\n```bash\nnpm run typecheck\n```\n\n## Use Cases\n\n- The memes\n- Educational: Learn EVM opcodes and type-level programming\n- Research: Explore capabilities of TypeScript's type system\n- Art: Create compile-time smart contract verification tools\n- Experimentation: Test EVM bytecode behavior at type-level\n\n## License\n\nMIT\n\n## Contributing\n\nContributions welcome! This is an experimental project exploring the limits of TypeScript's type system.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevmts%2Ftypevm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevmts%2Ftypevm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevmts%2Ftypevm/lists"}