{"_id":"@0xhyperchain/vm","_rev":"1-e2c21e63b294d13f512b942ccdd9d1a7","name":"@0xhyperchain/vm","dist-tags":{"latest":"5.7.30"},"versions":{"6.4.2":{"name":"@0xhyperchain/vm","version":"6.4.2","description":"An Ethereum VM implementation","keywords":["ethereum","VM"],"homepage":"https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/vm#readme","bugs":{"url":"https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+vm%22"},"repository":{"type":"git","url":"git+https://github.com/ethereumjs/ethereumjs-monorepo.git"},"license":"MPL-2.0","author":{"name":"mjbecze","email":"mjbecze@gmail.com"},"contributors":[{"name":"Alex Beregszaszi","email":"alex@rtfs.hu"}],"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"benchmarks":"node --max-old-space-size=4096 ./benchmarks/run.js benchmarks mainnetBlocks:10","build":"../../config/cli/ts-build.sh","build:benchmarks":"npm run build && tsc -p tsconfig.benchmarks.json","clean":"../../config/cli/clean-package.sh","coverage":"c8 --all --reporter=lcov --reporter=text npm run coverage:test","coverage:test":"npm run test:API","docs:build":"typedoc --options typedoc.js","examples":"ts-node ../../scripts/examples-runner.ts -- vm","formatTest":"node ./scripts/formatTest","lint":"../../config/cli/lint.sh","lint:diff":"../../config/cli/lint-diff.sh","lint:fix":"../../config/cli/lint-fix.sh","prepublishOnly":"../../config/cli/prepublish.sh && npm run test:buildIntegrity","profiling":"0x ./benchmarks/run.js profiling","tape":"tape -r ts-node/register --stack-size=1500","test":"echo \"[INFO] Generic test cmd not used. See package.json for more specific test run cmds.\"","test:API":"npm run tape -- './test/api/**/*.spec.ts'","test:API:browser":"karma start karma.conf.js","test:blockchain":"npm run tester -- --blockchain","test:blockchain:allForks":"echo 'Chainstart Homestead dao TangerineWhistle SpuriousDragon Byzantium Constantinople Petersburg Istanbul MuirGlacier Berlin London ByzantiumToConstantinopleFixAt5 EIP158ToByzantiumAt5 FrontierToHomesteadAt5 HomesteadToDaoAt5 HomesteadToEIP150At5 BerlinToLondonAt5' | xargs -n1 | xargs -I v1 npm run tester -- --blockchain --fork=v1 --verify-test-amount-alltests","test:blockchain:transitionForks":"echo 'ByzantiumToConstantinopleFixAt5 EIP158ToByzantiumAt5 FrontierToHomesteadAt5 HomesteadToDaoAt5 HomesteadToEIP150At5 BerlinToLondonAt5' | xargs -n1 | xargs -I v1 npm run tester -- --blockchain --fork=v1 --verify-test-amount-alltests","test:buildIntegrity":"npm run test:state -- --test='stackOverflow'","test:state":"npm run tester -- --state","test:state:allForks":"echo 'Chainstart Homestead dao TangerineWhistle SpuriousDragon Byzantium Constantinople Petersburg Istanbul MuirGlacier Berlin London ByzantiumToConstantinopleFixAt5 EIP158ToByzantiumAt5 FrontierToHomesteadAt5 HomesteadToDaoAt5 HomesteadToEIP150At5 BerlinToLondonAt5' | xargs -n1 | xargs -I v1 npm run test:state -- --fork=v1 --verify-test-amount-alltests","test:state:selectedForks":"echo 'Homestead TangerineWhistle SpuriousDragon Petersburg Berlin London' | xargs -n1 | xargs -I v1 npm run test:state -- --fork=v1 --verify-test-amount-alltests","test:state:slow":"npm run test:state -- --runSkipped=slow","tester":"ts-node ./test/tester --stack-size=1500","tsc":"../../config/cli/ts-compile.sh"},"dependencies":{"@ethereumjs/block":"^4.2.2","@ethereumjs/blockchain":"^6.2.2","@ethereumjs/common":"^3.1.2","@ethereumjs/evm":"^1.3.2","@ethereumjs/rlp":"^4.0.1","@ethereumjs/statemanager":"^1.0.5","@ethereumjs/trie":"^5.0.5","@ethereumjs/tx":"^4.1.2","@ethereumjs/util":"^8.0.6","debug":"^4.3.3","ethereum-cryptography":"^2.0.0","mcl-wasm":"^0.7.1","rustbn.js":"~0.2.0"},"devDependencies":{"@ethersproject/abi":"^5.0.12","@types/benchmark":"^1.0.33","@types/core-js":"^2.5.0","@types/lru-cache":"^5.1.0","@types/minimist":"^1.2.2","@types/node-dir":"^0.0.34","benchmark":"^2.1.4","level":"^8.0.0","memory-level":"^1.0.0","minimist":"^1.2.5","node-dir":"^0.1.17","nyc":"^15.1.0","prettier":"^2.0.5","solc":"^0.8.1","standard":"^10.0.0","tape":"^5.3.1","ts-node":"^10.2.1","typedoc":"^0.22.4","typescript":"^4.4.2"},"engines":{"node":">=14"},"gitHead":"49c2d93b94e70887d4fafff123eec19ef6a35fec","_id":"@0xhyperchain/vm@6.4.2","_nodeVersion":"16.14.2","_npmVersion":"8.5.0","dist":{"integrity":"sha512-lz7Oa++RmkCWrww4FDtyPRUx31PCMz5nXkEV3CkVDu8y7pEY/YP3ctY5qQk9TY8vHs85iz344mmf5QaAgqRlGg==","shasum":"a5af32ceff575993090677db44dbe6b7b9c81315","tarball":"https://registry.npmjs.org/@0xhyperchain/vm/-/vm-6.4.2.tgz","fileCount":55,"unpackedSize":319907,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC149kEL4zgLnndW+kS9vlyLYQNYfWvX8JjGFFCsmTA/AIhAKm0zGgwYknDGEk0RI7cC10zA4+sAt98X6Z196z6UaFw"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkSeWtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrJkw/9ExVDPDJFPUUM/jARreSyFR7D7ali2Q7+XJd2uM3YwzN6/wsn\r\nqFzGHNXWj8MkcwR75sfzN4gi2mkXD+b/3AdAuAE0ZB6TSCm6wGUC8hebvXtK\r\nC+Ri9rforX7dc/9yrlV7mG9Xpp4TxKI0BIFHL2nlTAX+EX5ekINKEyphM5xg\r\ndlVVRhRDNiWD0dXTMFhFFcLGm294B9i5lvYvnv++2Tp8HrdKsDRm3BurAGbp\r\n0Q1Rqf5uGTTbI13eZQ9Zm96j3kqnnr1AT2BYsMhWq+8RpBzzKcP2Hy1oUXRT\r\npuOAJ/lg4Sh8HWPcmopnz0fObFGPFZU4aMFc4N6br8gJv0yKM/APlVsqylRJ\r\nCPcLRs80CpOfj8z3oRqgvQOxo4AOCA2c+1gSTHRg6/gWVVhOOjogbF/dlBoq\r\nekzb2e5cf+zVoKJfL4o/BgCuQ3axCgLeqiHLE3FQpAowzsMh0NbNDRsuPyJK\r\nn6nhMdiAKe+U0S5kwWZTV/LBvqj2YsDQBLqkkOw7rIMn6rq1ZB5wG2fEeeZa\r\nYZCKvFdzp9e/CqDq7ZNxSvm4AJ/pIcpdMEJRyI8n0XL9dk0mV7m1ju0GE8q6\r\nqH75nPTZ8hjeJ5kGw8OTyvDWpF40FLkJBG2Z08eCssBUW0JM2hPbySvCSETy\r\nF3lR99RB+0uG+EkeCqdY8g0safcR7D/c7SA=\r\n=HLy6\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"0xhyperchain","email":"admin@hyperchain.org"},"directories":{},"maintainers":[{"name":"0xhyperchain","email":"admin@hyperchain.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vm_6.4.2_1682564525418_0.4300863122635281"},"_hasShrinkwrap":false},"5.7.30":{"name":"@0xhyperchain/vm","version":"5.7.30","description":"An Ethereum VM implementation","license":"MPL-2.0","author":{"name":"mjbecze","email":"mjbecze@gmail.com"},"keywords":["ethereum","VM"],"main":"dist/index.js","types":"dist/index.d.ts","browser":"dist.browser/index.js","scripts":{"build":"npm run build:node && npm run build:browser","build:node":"../../config/cli/ts-build.sh node","build:browser":"../../config/cli/ts-build.sh browser","build:benchmarks":"npm run build && tsc -p tsconfig.benchmarks.json","benchmarks":"node --max-old-space-size=4096 ./benchmarks/run.js benchmarks mainnetBlocks:10","profiling":"0x ./benchmarks/run.js profiling","clean":"../../config/cli/clean-package.sh","coverage":"nyc npm run coverage:test","coverage:test":"npm run test:API && npm run tester -- --state","docs:build":"typedoc --options typedoc.js","tape":"tape -r ts-node/register --stack-size=1500","tester":"ts-node ./tests/tester --stack-size=1500","test:state":"npm run tester -- --state","test:state:allForks":"echo 'Chainstart Homestead dao TangerineWhistle SpuriousDragon Byzantium Constantinople Petersburg Istanbul MuirGlacier Berlin London ByzantiumToConstantinopleFixAt5 EIP158ToByzantiumAt5 FrontierToHomesteadAt5 HomesteadToDaoAt5 HomesteadToEIP150At5' | xargs -n1 | xargs -I v1 npm run test:state -- --fork=v1 --verify-test-amount-alltests","test:state:selectedForks":"echo 'Homestead TangerineWhistle SpuriousDragon Petersburg Berlin London' | xargs -n1 | xargs -I v1 npm run test:state -- --fork=v1 --verify-test-amount-alltests","test:state:slow":"npm run test:state -- --runSkipped=slow","test:buildIntegrity":"npm run test:state -- --test='stackOverflow'","test:blockchain":"npm run tester -- --blockchain","test:blockchain:allForks":"echo 'Chainstart Homestead dao TangerineWhistle SpuriousDragon Byzantium Constantinople Petersburg Istanbul MuirGlacier Berlin London ByzantiumToConstantinopleFixAt5 EIP158ToByzantiumAt5 FrontierToHomesteadAt5 HomesteadToDaoAt5 HomesteadToEIP150At5' | xargs -n1 | xargs -I v1 npm run tester -- --blockchain --fork=v1 --verify-test-amount-alltests","test:API":"npm run tape -- './tests/api/**/*.spec.ts'","test:API:browser":"karma start karma.conf.js","test":"echo \"[INFO] Generic test cmd not used. See package.json for more specific test run cmds.\"","lint":"../../config/cli/lint.sh","lint:fix":"../../config/cli/lint-fix.sh","formatTest":"node ./scripts/formatTest","tsc":"../../config/cli/ts-compile.sh","examples":"ts-node ../../scripts/examples-runner.ts -- vm"},"dependencies":{"@ethereumjs/block":"^3.6.1","@ethereumjs/blockchain":"^5.5.1","@ethereumjs/common":"^2.6.2","@ethereumjs/tx":"^3.5.0","@polygon-hermez/zkevm-commonjs":"github:hermeznetwork/zkevm-commonjs#v0.5.0.1","async-eventemitter":"^0.2.4","core-js-pure":"^3.0.1","debug":"^4.3.3","ethereumjs-util":"^7.1.4","ethers":"^5.6.2","functional-red-black-tree":"^1.0.1","lodash":"^4.17.21","mcl-wasm":"^0.7.1","merkle-patricia-tree":"^4.2.3","rustbn.js":"~0.2.0"},"devDependencies":{"@ethersproject/abi":"^5.0.12","@types/benchmark":"^1.0.33","@types/core-js":"^2.5.0","@types/lru-cache":"^5.1.0","@types/minimist":"^1.2.2","@types/node":"^16.11.7","@types/node-dir":"^0.0.34","@types/tape":"^4.13.2","benchmark":"^2.1.4","eslint":"^6.8.0","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-tap":"^4.2.0","karma-typescript":"^5.5.3","level":"^6.0.0","level-mem":"^5.0.1","minimist":"^1.2.5","node-dir":"^0.1.17","nyc":"^15.1.0","prettier":"^2.0.5","solc":"^0.8.1","standard":"^10.0.0","tape":"^5.3.1","ts-node":"^10.2.1","typedoc":"^0.22.4","typescript":"^4.4.2"},"contributors":[{"name":"Alex Beregszaszi","email":"alex@rtfs.hu"}],"repository":{"type":"git","url":"git+https://github.com/ethereumjs/ethereumjs-monorepo.git"},"homepage":"https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/vm#readme","bugs":{"url":"https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+vm%22"},"gitHead":"774dcbfbeda65fdb78d9fda9f74410b8d337222e","_id":"@0xhyperchain/vm@5.7.30","_nodeVersion":"16.14.2","_npmVersion":"8.5.0","dist":{"integrity":"sha512-lCGQq/xxZqKg8fiLNQMFZXkWpvf7GguJ78yQVyixkC/LK7tbsmftQWcZkUuqnQxV/6eT4n9X/osfw8DYtnNlLg==","shasum":"f05cfcaacbbd508d5a2123eadb316de48d996f6d","tarball":"https://registry.npmjs.org/@0xhyperchain/vm/-/vm-5.7.30.tgz","fileCount":370,"unpackedSize":1762825,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDAFqD8qQEO9HG+pQOb23JmdV4wFNRZpwE9sdyYDMJMwAIhAMJ4+NH9lwezqqQak2mlhHvXYeBVS5cHit2DtJWyZzuM"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkSiXmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpVtw//aVwWT/onT3Wt9ySC8lCcHki/dODmGScDWO7dqpvijr+NqSLk\r\nILHmGVIuF3nraRR6K39a46Xk1ydlGOptzmsSXwhxLdlcxRS9Ntq79eEaTsBQ\r\n9ThWo3mAmMu+RRajltkZbOGMP3ZfojM2dUQ1IAqyvIQbBcV4Wk2aeOm+qeaV\r\nrdfVByZXPuSwhhPUNzFjLBZMB+c6U475IhPt75OJhN94U53OC9zOiEHJKHr0\r\nwDBiJw0Cxg/qvB7kIM1vL/Pk7c+1AbWoz0QcJdHzyaXtAfqNTfjTZYDZuLlI\r\nfOImfIZ1n76mXXgj2mmvVxfLvkwPzLGhO6ARVEgRwwzuy+f5JWYLJfxgbZGA\r\npBTX9n9aZncZ7QImXO/AhJEzq6p3l2q4CuYRf3FaWVzNii91bIGm8tncbDcp\r\nxrFePTdaKbjcwRcre9x+nEpaL56s33oZm/uSNBnhL9E5Raxmp3FYePybDmNh\r\nPxf8vghzIuKyJYcUas2jhtcxn0rf0fUdAB/jqD5GDMu/mN1kL2gSxR4fSQGt\r\nbAKWdeEqs9nbtSCcbRQYWkjWtTsA2cLjpBd020hV+7KPpwaKgyNx42RhOpcs\r\nFfzCIocHKUKsmtEzL376/55pW6XNuSUarkxNv83MvU6WAA8SoCXDZ5SdYZXM\r\nmaEwbYTMn2bmVtzDZE3tYevXj5WzkoHup/Y=\r\n=SS8Z\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"0xhyperchain","email":"admin@hyperchain.org"},"directories":{},"maintainers":[{"name":"0xhyperchain","email":"admin@hyperchain.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vm_5.7.30_1682580966567_0.7011664654684822"},"_hasShrinkwrap":false}},"time":{"created":"2023-04-27T03:02:05.350Z","6.4.2":"2023-04-27T03:02:05.616Z","modified":"2023-04-27T07:36:06.984Z","5.7.30":"2023-04-27T07:36:06.856Z"},"maintainers":[{"name":"0xhyperchain","email":"admin@hyperchain.org"}],"description":"An Ethereum VM implementation","homepage":"https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/vm#readme","keywords":["ethereum","VM"],"repository":{"type":"git","url":"git+https://github.com/ethereumjs/ethereumjs-monorepo.git"},"contributors":[{"name":"Alex Beregszaszi","email":"alex@rtfs.hu"}],"author":{"name":"mjbecze","email":"mjbecze@gmail.com"},"bugs":{"url":"https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+vm%22"},"license":"MPL-2.0","readme":"# @ethereumjs/vm\n\n[![NPM Package][vm-npm-badge]][vm-npm-link]\n[![GitHub Issues][vm-issues-badge]][vm-issues-link]\n[![Actions Status][vm-actions-badge]][vm-actions-link]\n[![Code Coverage][vm-coverage-badge]][vm-coverage-link]\n[![Discord][discord-badge]][discord-link]\n\n| TypeScript implementation of the Ethereum VM. |\n| --- |\n\nNote: this `README` reflects the state of the library from `v5.0.0` onwards. See `README` from the [standalone repository](https://github.com/ethereumjs/ethereumjs-vm) for an introduction on the last preceding release.\n\n# INSTALL\n\n`npm install @ethereumjs/vm`\n\n# USAGE\n\n```typescript\nimport { BN } from 'ethereumjs-util'\nimport Common, { Chain, Hardfork } from '@ethereumjs/common'\nimport VM from '@ethereumjs/vm'\n\nconst common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Berlin })\nconst vm = new VM({ common })\n\nconst STOP = '00'\nconst ADD = '01'\nconst PUSH1 = '60'\n\n// Note that numbers added are hex values, so '20' would be '32' as decimal e.g.\nconst code = [PUSH1, '03', PUSH1, '05', ADD, STOP]\n\nvm.on('step', function (data) {\n  console.log(`Opcode: ${data.opcode.name}\\tStack: ${data.stack}`)\n})\n\nvm.runCode({\n  code: Buffer.from(code.join(''), 'hex'),\n  gasLimit: new BN(0xffff),\n})\n  .then((results) => {\n    console.log(`Returned: ${results.returnValue.toString('hex')}`)\n    console.log(`gasUsed : ${results.gasUsed.toString()}`)\n  })\n  .catch(console.error)\n```\n\n## Example\n\nThis projects contain the following examples:\n\n1. [./examples/run-blockchain](./examples/run-blockchain): Loads tests data, including accounts and blocks, and runs all of them in the VM.\n1. [./examples/run-code-browser](./examples/run-code-browser): Show how to use this library in a browser.\n1. [./examples/run-solidity-contract](./examples/run-solidity-contract): Compiles a Solidity contract, and calls constant and non-constant functions.\n1. [./examples/run-transactions-complete](./examples/run-transactions-complete): Runs a contract-deployment transaction and then calls one of its functions.\n1. [./examples/decode-opcodes](./examples/decode-opcodes): Decodes a binary EVM program into its opcodes.\n\nAll of the examples have their own `README.md` explaining how to run them.\n\n# API\n\n## VM\n\nFor documentation on `VM` instantiation, exposed API and emitted `events` see generated [API docs](./docs/README.md).\n\n## StateManager\n\nDocumentation on the `StateManager` can be found [here](./docs/classes/_state_statemanager_.defaultstatemanager.md). If you want to provide your own `StateManager` you can implement the dedicated [interface](./docs/interfaces/_state_interface_.statemanager.md) to ensure that your implementation conforms with the current API.\n\nNote: along the `EIP-2929` (Gas cost increases for state access opcodes) implementation released in `v5.2.0` a new `EIP2929StateManager` interface has been introduced inheriting from the base `StateManager` interface. The methods introduced there will be merged into the base state manager on the next breaking release.\n\n# BROWSER\n\nTo build the VM for standalone use in the browser, see: [Running the VM in a browser](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/vm/examples/run-code-browser).\n\n# SETUP\n\n## Chain Support\n\nStarting with `v5.1.0` the VM supports running both `Ethash/PoW` and `Clique/PoA` blocks and transactions. Clique support has been added along the work on PR [#1032](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1032) and follow-up PRs and (block) validation checks and the switch of the execution context now happens correctly.\n\n### Ethash/PoW Chains\n\n`@ethereumjs/blockchain` validates the PoW algorithm with `@ethereumjs/ethash` and validates blocks' difficulty to match their canonical difficulty.\n\n### Clique/PoA Chains\n\nFor the VM to work correctly in a `Clique/PoA` context you need to use the library with the following library versions or higher:\n\n- @ethereumjs/block -> `v3.1.0`\n- @ethereumjs/blockchain -> `v5.1.0`\n- @ethereumjs/common\" -> `v2.1.0`\n\nThe following is a simple example for a block run on `Goerli`:\n\n```typescript\nimport VM from '@ethereumjs/vm'\nimport Common, { Chain } from '@ethereumjs/common'\n\nconst common = new Common({ chain: Chain.Goerli })\nconst hardforkByBlockNumber = true\nconst vm = new VM({ common, hardforkByBlockNumber })\n\nconst serialized = Buffer.from('f901f7a06bfee7294bf4457...', 'hex')\nconst block = Block.fromRLPSerializedBlock(serialized, { hardforkByBlockNumber })\nconst result = await vm.runBlock(block)\n```\n\n## Hardfork Support\n\nStarting with the `v5` release series all hardforks from `Frontier` (`chainstart`) up to the latest active mainnet hardfork are supported.\n\nThe VM currently supports the following hardfork rules:\n\n- `chainstart` (a.k.a. Frontier) (`v5.0.0`+)\n- `homestead` (`v5.0.0`+)\n- `tangerineWhistle` (`v5.0.0`+)\n- `spuriousDragon` (`v5.0.0`+)\n- `byzantium`\n- `constantinople`\n- `petersburg`\n- `istanbul` (`v4.1.1`+)\n- `muirGlacier` (only `mainnet` and `ropsten`) (`v4.1.3`+)\n- `berlin` (`v5.2.0`+)\n- `london` (`v5.4.0`+)\n- `arrowGlacier` (only `mainnet`) (`v5.6.0`+)\n\nDefault: `istanbul` (taken from `Common.DEFAULT_HARDFORK`)\n\nA specific hardfork VM ruleset can be activated by passing in the hardfork\nalong the `Common` instance:\n\n```typescript\nimport Common, { Chain, Hardfork } from '@ethereumjs/common'\nimport VM from '@ethereumjs/vm'\n\nconst common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Berlin })\nconst vm = new VM({ common })\n```\n\n## EIP Support\n\nIt is possible to individually activate EIP support in the VM by instantiate the `Common` instance passed\nwith the respective EIPs, e.g.:\n\n```typescript\nimport Common, { Chain } from '@ethereumjs/common'\nimport VM from '@ethereumjs/vm'\n\nconst common = new Common({ chain: Chain.Mainnet, eips: [2537] })\nconst vm = new VM({ common })\n```\n\nCurrently supported EIPs:\n\n- [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) - Fee Market (`london` EIP)\n- [EIP-2315](https://eips.ethereum.org/EIPS/eip-2315): Simple subroutines\n- [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537): BLS precompiles\n- [EIP-2565](https://eips.ethereum.org/EIPS/eip-2565): ModExp gas cost (`berlin` EIP)\n- [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718): Typed transactions (`berlin` EIP)\n- [EIP-2929](https://eips.ethereum.org/EIPS/eip-2929): Gas cost increases for state access opcodes (`berlin` EIP)\n- [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930): Optional Access Lists Typed Transactions (`berlin` EIP)\n- [EIP-3198](https://eips.ethereum.org/EIPS/eip-3198) - BASEFEE opcode (`london` EIP)\n- [EIP-3529](https://eips.ethereum.org/EIPS/eip-3529) - Reduction in refunds (`london` EIP)\n- [EIP-3541](https://eips.ethereum.org/EIPS/eip-3541) - Reject new contracts starting with the 0xEF byte (`london` EIP)\n\n## Tracing Events\n\nOur `TypeScript` VM is implemented as an [AsyncEventEmitter](https://github.com/ahultgren/async-eventemitter) and events are submitted along major execution steps which you can listen to.\n\nYou can subscribe to the following events:\n\n- `beforeBlock`: Emits a `Block` right before running it.\n- `afterBlock`: Emits `AfterBlockEvent` right after running a block.\n- `beforeTx`: Emits a `Transaction` right before running it.\n- `afterTx`: Emits a `AfterTxEvent` right after running a transaction.\n- `beforeMessage`: Emits a `Message` right after running it.\n- `afterMessage`: Emits an `EVMResult` right after running a message.\n- `step`: Emits an `InterpreterStep` right before running an EVM step.\n- `newContract`: Emits a `NewContractEvent` right before creating a contract. This event contains the deployment code, not the deployed code, as the creation message may not return such a code.\n\nAn example for the `step` event can be found in the initial usage example in this `README`.\n\n### Asynchronous event handlers\n\nYou can perform asynchronous operations from within an event handler\nand prevent the VM to keep running until they finish.\n\nIn order to do that, your event handler has to accept two arguments.\nThe first one will be the event object, and the second one a function.\nThe VM won't continue until you call this function.\n\nIf an exception is passed to that function, or thrown from within the\nhandler or a function called by it, the exception will bubble into the\nVM and interrupt it, possibly corrupting its state. It's strongly\nrecommended not to do that.\n\n### Synchronous event handlers\n\nIf you want to perform synchronous operations, you don't need\nto receive a function as the handler's second argument, nor call it.\n\nNote that if your event handler receives multiple arguments, the second\none will be the continuation function, and it must be called.\n\nIf an exception is thrown from withing the handler or a function called\nby it, the exception will bubble into the VM and interrupt it, possibly\ncorrupting its state. It's strongly recommended not to throw from withing\nevent handlers.\n\n# Understanding the VM\n\nIf you want to understand your VM runs we have added a hierarchically structured list of debug loggers for your convenience which can be activated in arbitrary combinations. We also use these loggers internally for development and testing. These loggers use the [debug](https://github.com/visionmedia/debug) library and can be activated on the CL with `DEBUG=[Logger Selection] node [Your Script to Run].js` and produce output like the following:\n\n![EthereumJS VM Debug Logger](./debug.png?raw=true)\n\nThe following loggers are currently available:\n\n| Logger | Description |\n| - | - |\n| `vm:block` | Block operations (run txs, generating receipts, block rewards,...) |\n| `vm:tx` | Transaction operations (account updates, checkpointing,...) |\n| `vm:tx:gas` | Transaction gas logger |\n| `vm:evm` | EVM control flow, CALL or CREATE message execution |\n| `vm:evm:gas` | EVM gas logger |\n| `vm:eei:gas` | EEI gas logger |\n| `vm:state`| StateManager logger |\n| `vm:ops` | Opcode traces |\n| `vm:ops:[Lower-case opcode name]` | Traces on a specific opcode |\n\nHere are some examples for useful logger combinations.\n\nRun one specific logger:\n\n```shell\nDEBUG=vm:tx ts-node test.ts\n```\n\nRun all loggers currently available:\n\n```shell\nDEBUG=vm:*,vm:*:* ts-node test.ts\n```\n\nRun only the gas loggers:\n\n```shell\nDEBUG=vm:*:gas ts-node test.ts\n```\n\nExcluding the state logger:\n\n```shell\nDEBUG=vm:*,vm:*:*,-vm:state ts-node test.ts\n```\n\nRun some specific loggers including a logger specifically logging the `SSTORE` executions from the VM (this is from the screenshot above):\n\n```shell\nDEBUG=vm:tx,vm:evm,vm:ops:sstore,vm:*:gas ts-node test.ts\n```\n\n# Internal Structure\n\nThe VM processes state changes at many levels.\n\n- **runBlockchain**\n  - for every block, runBlock\n- **runBlock**\n  - for every tx, runTx\n  - pay miner and uncles\n- **runTx**\n  - check sender balance\n  - check sender nonce\n  - runCall\n  - transfer gas charges\n- **runCall**\n  - checkpoint state\n  - transfer value\n  - load code\n  - runCode\n  - materialize created contracts\n  - revert or commit checkpoint\n- **runCode**\n  - iterate over code\n  - run op codes\n  - track gas usage\n- **OpFns**\n  - run individual op code\n  - modify stack\n  - modify memory\n  - calculate fee\n\nThe opFns for `CREATE`, `CALL`, and `CALLCODE` call back up to `runCall`.\n\n# DEVELOPMENT\n\nDeveloper documentation - currently mainly with information on testing and debugging - can be found [here](./DEVELOPER.md).\n\n# EthereumJS\n\nSee our organizational [documentation](https://ethereumjs.readthedocs.io) for an introduction to `EthereumJS` as well as information on current standards and best practices.\n\nIf you want to join for work or do improvements on the libraries have a look at our [contribution guidelines](https://ethereumjs.readthedocs.io/en/latest/contributing.html).\n\n# LICENSE\n\n[MPL-2.0](https://www.mozilla.org/MPL/2.0/)\n\n[discord-badge]: https://img.shields.io/static/v1?logo=discord&label=discord&message=Join&color=blue\n[discord-link]: https://discord.gg/TNwARpR\n[vm-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/vm.svg\n[vm-npm-link]: https://www.npmjs.com/package/@ethereumjs/vm\n[vm-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-monorepo/package:%20vm?label=issues\n[vm-issues-link]: https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aopen+is%3Aissue+label%3A\"package%3A+vm\"\n[vm-actions-badge]: https://github.com/ethereumjs/ethereumjs-monorepo/workflows/VM/badge.svg\n[vm-actions-link]: https://github.com/ethereumjs/ethereumjs-monorepo/actions?query=workflow%3A%22VM%22\n[vm-coverage-badge]: https://codecov.io/gh/ethereumjs/ethereumjs-monorepo/branch/master/graph/badge.svg?flag=vm\n[vm-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-monorepo/tree/master/packages/vm\n","readmeFilename":"README.md"}