{"_id":"@0yi0/ethereumjs-vm","_rev":"2-421ad76d164cc7364007baddd732839c","name":"@0yi0/ethereumjs-vm","dist-tags":{"latest":"4.0.0-0.0.1"},"versions":{"4.0.0":{"name":"@0yi0/ethereumjs-vm","version":"4.0.0","description":"An Ethereum VM implementation","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build:dist":"ethereumjs-config-build","prepublishOnly":"npm run lint && npm run build:dist && npm run testBuildIntegrity","coverage":"nyc npm run coverageTests && nyc report --reporter=text-lcov > .nyc_output/lcov.info","coverageTests":"npm run build:dist && tape './tests/api/**/*.js' ./tests/tester.js -s --dist","coveralls":"npm run coverage && if [ -n \"$COVERALLS_REPO_TOKEN\" ]; then coveralls <.nyc_output/lcov.info; fi","docs:build":"typedoc lib","testVM":"node ./tests/tester -v","testStateByzantium":"npm run build:dist && node ./tests/tester -s --fork='Byzantium' --dist","testStateConstantinople":"npm run build:dist && node ./tests/tester -s --fork='Constantinople' --dist","testStatePetersburg":"npm run build:dist && node ./tests/tester -s --fork='Petersburg' --dist","testBuildIntegrity":"npm run build:dist && node ./tests/tester -s --dist --test='stackOverflow'","testBlockchain":"npm run build:dist && node --stack-size=1500 ./tests/tester -b --fork='Petersburg' --dist --excludeDir='GeneralStateTests'","testBlockchainGeneralStateTests":"npm run build:dist && node --stack-size=1500 ./tests/tester -b --dist --dir='GeneralStateTests'","testAPI":"npm run build:dist && tape './tests/api/**/*.js'","testAPI:browser":"npm run build:dist && karma start karma.conf.js","test":"echo \"[INFO] Generic test cmd not used. See package.json for more specific test run cmds.\"","tslint":"ethereumjs-config-tslint","tslint:fix":"ethereumjs-config-tslint-fix","lint":"ethereumjs-config-lint","lint:fix":"ethereumjs-config-lint-fix","format":"ethereumjs-config-format","format:fix":"ethereumjs-config-format-fix","formatTest":"node ./scripts/formatTest","tsc":"ethereumjs-config-tsc"},"husky":{"hooks":{"pre-push":"npm run lint"}},"repository":{"type":"git","url":"git+https://github.com/ethereumjs/ethereumjs-vm.git"},"keywords":["ethereum","VM"],"dependencies":{"async":"^2.1.2","async-eventemitter":"^0.2.2","core-js-pure":"^3.0.1","ethereumjs-account":"^3.0.0","ethereumjs-block":"~2.2.0","ethereumjs-blockchain":"^4.0.1","ethereumjs-common":"^1.3.0","ethereumjs-tx":"^2.1.0","ethereumjs-util":"^6.1.0","fake-merkle-patricia-tree":"^1.0.1","functional-red-black-tree":"^1.0.1","merkle-patricia-tree":"^2.3.2","rustbn.js":"~0.2.0","safe-buffer":"^5.1.1","util.promisify":"^1.0.0"},"devDependencies":{"@ethereumjs/config-nyc":"^1.1.1","@ethereumjs/config-prettier":"^1.1.1","@ethereumjs/config-tsc":"^1.1.1","@ethereumjs/config-tslint":"^1.1.1","@types/bn.js":"^4.11.5","@types/core-js":"^2.5.0","@types/lru-cache":"^5.1.0","@types/node":"^11.13.4","browserify":"^16.2.3","coveralls":"^3.0.0","ethereumjs-testing":"git+https://github.com/ethereumjs/ethereumjs-testing.git#v1.2.7","husky":"^2.1.0","karma":"^4.0.1","karma-browserify":"^6.0.0","karma-chrome-launcher":"^2.2.0","karma-detect-browsers":"^2.3.3","karma-firefox-launcher":"^1.1.0","karma-tap":"^4.1.4","level":"^4.0.0","level-mem":"^3.0.1","minimist":"^1.1.1","nyc":"^12.0.2","prettier":"^1.16.4","rlp":"^2.2.3","standard":"^10.0.0","tap-spec":"^5.0.0","tape":"4.6.3","tslint":"^5.16.0","typedoc":"^0.14.2","typedoc-plugin-markdown":"^1.2.1","typescript":"^3.4.3","typestrict":"^1.0.2"},"author":{"name":"mjbecze","email":"mjbecze@gmail.com"},"contributors":[{"name":"Alex Beregszaszi","email":"alex@rtfs.hu"}],"license":"MPL-2.0","bugs":{"url":"https://github.com/ethereumjs/ethereumjs-vm/issues"},"homepage":"https://github.com/ethereumjs/ethereumjs-vm","nyc":{"exclude":["tests"]},"standard":{"ignore":["dist/**","examples/runcode-browserify.js"]},"gitHead":"e6d5f0ff9af281a1aa2072329d4db3dc836855df","_id":"@0yi0/ethereumjs-vm@4.0.0","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-CiOgOXLEyyUHDnD6I9qZPf9R04v9skMfzSz2TXis6zSLY88gLG8QK0NfpunoLwU11uY2PPcQyDxXvW6PL/4GKw==","shasum":"59033c961626bd8a525ad7427f81ff9b53ca675c","tarball":"https://registry.npmjs.org/@0yi0/ethereumjs-vm/-/ethereumjs-vm-4.0.0.tgz","fileCount":97,"unpackedSize":451116,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdY4+iCRA9TVsSAnZWagAAx3QP/1gtiS3Uzw437TCcjnvR\nmGstWlmTArUF4ZX7dTATlxUKf6M4GBYGsMOkC0HDR4KRhmXWMNai/4Nfn/aA\nVb+ayquzUfGGMr58xta7hToKIRs7f8umnOB35YIehf4tFNEBd+GNUnBIL9Hn\npjC31e7IWJqNxkqPpYdgm1ptxJ8fNFcATU4Ooi4LqGtcpFqTo03DpBpX9tAB\nHhU7ofWQlCr7q/ymK5KQ3cgESLkavghYOIdix11wBnnp9UsW5zKS8xEcXP8S\nhZf+1z+vyxQoFqiwA4rB7QMv9xRRsfzvRth/f4LqR12y6OLoILMPiF6j9mZ0\nrX07BqKyAISfUvqhkmia4zqVxnZZBWWw7e9gnZpEAtOBTDGFgio9CgxBD/UX\nxk72SHWSWd3mK0+35z3b3dtTvOBNoTZWnnkbrZwVIsPAIBjL6VNxU2wezcLa\n7NP25nkYEHf3DIfx+xd9WlwBRt7uqYW2pNeTDkgHSKGiuD7nlAvoLiY3KPxw\nRCdrR3PMBTqBvHWLAZcAAK2Q3WMv0KpLLfDlGrVR/iDaaWh4ZEZRDIXXew5d\nQIOrbp/NCKtsc4SBpL/V4hVS6YRoQ7ktjAqKB1Gslvx+2QVEviJC70/w3BoP\no8K5sa2i4Mi3vKCpCv8Zv2QbdT9C8sodns2VugoPrDHMSIKBowL2bEiFFuOx\n3tiJ\r\n=9Izr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAVLfJcaZ6gfLXrvvXf22dIMfUdBkX+sFDm3+j45ZkbxAiBBp/Xa6NHU2hOYK4snv+xdn+ZTq2nWQBv7Vm8o8ni30w=="}]},"maintainers":[{"name":"0yi0","email":"yi@secondstate.io"}],"_npmUser":{"name":"0yi0","email":"yi@secondstate.io"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ethereumjs-vm_4.0.0_1566805921694_0.5312275501025232"},"_hasShrinkwrap":false},"4.0.0-0.0.1":{"name":"@0yi0/ethereumjs-vm","version":"4.0.0-0.0.1","description":"An Ethereum VM implementation","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build:dist":"ethereumjs-config-build","prepublishOnly":"npm run lint && npm run build:dist && npm run testBuildIntegrity","coverage":"nyc npm run coverageTests && nyc report --reporter=text-lcov > .nyc_output/lcov.info","coverageTests":"npm run build:dist && tape './tests/api/**/*.js' ./tests/tester.js -s --dist","coveralls":"npm run coverage && if [ -n \"$COVERALLS_REPO_TOKEN\" ]; then coveralls <.nyc_output/lcov.info; fi","docs:build":"typedoc lib","testVM":"node ./tests/tester -v","testStateByzantium":"npm run build:dist && node ./tests/tester -s --fork='Byzantium' --dist","testStateConstantinople":"npm run build:dist && node ./tests/tester -s --fork='Constantinople' --dist","testStatePetersburg":"npm run build:dist && node ./tests/tester -s --fork='Petersburg' --dist","testBuildIntegrity":"npm run build:dist && node ./tests/tester -s --dist --test='stackOverflow'","testBlockchain":"npm run build:dist && node --stack-size=1500 ./tests/tester -b --fork='Petersburg' --dist --excludeDir='GeneralStateTests'","testBlockchainGeneralStateTests":"npm run build:dist && node --stack-size=1500 ./tests/tester -b --dist --dir='GeneralStateTests'","testAPI":"npm run build:dist && tape './tests/api/**/*.js'","testAPI:browser":"npm run build:dist && karma start karma.conf.js","test":"echo \"[INFO] Generic test cmd not used. See package.json for more specific test run cmds.\"","tslint":"ethereumjs-config-tslint","tslint:fix":"ethereumjs-config-tslint-fix","lint":"ethereumjs-config-lint","lint:fix":"ethereumjs-config-lint-fix","format":"ethereumjs-config-format","format:fix":"ethereumjs-config-format-fix","formatTest":"node ./scripts/formatTest","tsc":"ethereumjs-config-tsc"},"husky":{"hooks":{"pre-push":"npm run lint"}},"repository":{"type":"git","url":"git+https://github.com/ethereumjs/ethereumjs-vm.git"},"keywords":["ethereum","VM"],"dependencies":{"async":"^2.1.2","async-eventemitter":"^0.2.2","core-js-pure":"^3.0.1","ethereumjs-account":"^3.0.0","ethereumjs-block":"~2.2.0","ethereumjs-blockchain":"^4.0.1","ethereumjs-common":"^1.3.0","ethereumjs-tx":"^2.1.0","ethereumjs-util":"^6.1.0","fake-merkle-patricia-tree":"^1.0.1","functional-red-black-tree":"^1.0.1","merkle-patricia-tree":"^2.3.2","rustbn.js":"~0.2.0","safe-buffer":"^5.1.1","util.promisify":"^1.0.0"},"devDependencies":{"@ethereumjs/config-nyc":"^1.1.1","@ethereumjs/config-prettier":"^1.1.1","@ethereumjs/config-tsc":"^1.1.1","@ethereumjs/config-tslint":"^1.1.1","@types/bn.js":"^4.11.5","@types/core-js":"^2.5.0","@types/lru-cache":"^5.1.0","@types/node":"^11.13.4","browserify":"^16.2.3","coveralls":"^3.0.0","ethereumjs-testing":"git+https://github.com/ethereumjs/ethereumjs-testing.git#v1.2.7","husky":"^2.1.0","karma":"^4.0.1","karma-browserify":"^6.0.0","karma-chrome-launcher":"^2.2.0","karma-detect-browsers":"^2.3.3","karma-firefox-launcher":"^1.1.0","karma-tap":"^4.1.4","level":"^4.0.0","level-mem":"^3.0.1","minimist":"^1.1.1","nyc":"^12.0.2","prettier":"^1.16.4","rlp":"^2.2.3","standard":"^10.0.0","tap-spec":"^5.0.0","tape":"4.6.3","tslint":"^5.16.0","typedoc":"^0.14.2","typedoc-plugin-markdown":"^1.2.1","typescript":"^3.4.3","typestrict":"^1.0.2"},"author":{"name":"mjbecze","email":"mjbecze@gmail.com"},"contributors":[{"name":"Alex Beregszaszi","email":"alex@rtfs.hu"}],"license":"MPL-2.0","bugs":{"url":"https://github.com/ethereumjs/ethereumjs-vm/issues"},"homepage":"https://github.com/ethereumjs/ethereumjs-vm","nyc":{"exclude":["tests"]},"standard":{"ignore":["dist/**","examples/runcode-browserify.js"]},"gitHead":"736f928c2453d2ec576bdb50cbde903ca0c641a4","_id":"@0yi0/ethereumjs-vm@4.0.0-0.0.1","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-ccMYQaCm+GWF3QfdEIWuW9ol7oxP+XUgo6Ki48dN9elsfSmHXiG9VpJq4gVtDwmj0zpIRWzUlZhxFin/DGUSeA==","shasum":"8e7f041e536d36729235e41c32fc6e228206410d","tarball":"https://registry.npmjs.org/@0yi0/ethereumjs-vm/-/ethereumjs-vm-4.0.0-0.0.1.tgz","fileCount":97,"unpackedSize":451166,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdZNniCRA9TVsSAnZWagAAkQMP/3QjQQAEZ0qQrWvFCKY4\n8SVRmvUHhs8eaMN1tMPMdaKd2gGhwCxgVxkGZPLcgyJyMM4eHBrg9vYXedqw\nG5l95kW443DoROYUvVEMrrDCGjQKRXqCELX9NTzr4DcMHa2cC2ksmV9RNED3\nPe7u1ZO2JtZ9tgu9TM/PaRVr5dsQq4ZPKNd8VJQ/gOYvJ8teb3XbMRjDY7Rl\ntLvWCUG95umGk6Z0pfBkGXkBVGXQjhSl8NAEf2Dc24x0TLKYpJGvOLE5UTPr\noCZM2B3TZtJ7d4Rx6EdVKLKX5dmNm1Of6mjek7hqC+oUCmUQpSjF1Wye7AlQ\na3GDQll2VSOD4nLRvCAWsiaBrNHtAc/reLkvyhziUsfUnBqqXcNZHVUUq1JI\n4FdauKvl/3WoGloCwEYx8m//FY6oK3TRywurPTmHTIj8+FzoTKTSSGRlI4vX\n2GbRx3LEEVlh6ju0Khl/52iT7BE2VhTg7Lxyo2/L89tWOE5NMZ2nc5F0TTty\nnhe5r3g3RgtXAd3g1WmRL/WQ6JE4hZoYgi6Oh1UvDuq/p/LDaNJcUO5E+jD8\nExF/CNaANX1viEgwBoe3oWMiG4JZoEaxXj9/djfEzzbVGFIKA75AWBDDpzXN\nmDc8qIhrFJagCgnh9NiNNSXaKKpSU9e2gIDymK/QjzqRHOM3nQ+rDygNJyuS\nlzLU\r\n=V+kA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICSypSz57ZiqHu65dDOuxPRzgKg0avURIACHq2M3hblBAiBCAFNAO6eyDzzMcOQ9gnA8WlNMgf5+vydtNe58tFmkqQ=="}]},"maintainers":[{"name":"0yi0","email":"yi@secondstate.io"}],"_npmUser":{"name":"0yi0","email":"yi@secondstate.io"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ethereumjs-vm_4.0.0-0.0.1_1566890465477_0.046371696657439454"},"_hasShrinkwrap":false}},"time":{"created":"2019-08-26T07:52:01.468Z","4.0.0":"2019-08-26T07:52:01.828Z","modified":"2022-04-04T10:29:45.558Z","4.0.0-0.0.1":"2019-08-27T07:21:05.624Z"},"maintainers":[{"name":"0yi0","email":"yi@secondstate.io"}],"description":"An Ethereum VM implementation","homepage":"https://github.com/ethereumjs/ethereumjs-vm","keywords":["ethereum","VM"],"repository":{"type":"git","url":"git+https://github.com/ethereumjs/ethereumjs-vm.git"},"contributors":[{"name":"Alex Beregszaszi","email":"alex@rtfs.hu"}],"author":{"name":"mjbecze","email":"mjbecze@gmail.com"},"bugs":{"url":"https://github.com/ethereumjs/ethereumjs-vm/issues"},"license":"MPL-2.0","readme":"# SYNOPSIS\n\n[![NPM Package](https://img.shields.io/npm/v/ethereumjs-vm.svg?style=flat-square)](https://www.npmjs.org/package/ethereumjs-vm)\n[![Build Status](https://img.shields.io/circleci/project/github/ethereumjs/ethereumjs-vm/master.svg)](https://circleci.com/gh/ethereumjs/ethereumjs-vm)\n[![Coverage Status](https://img.shields.io/coveralls/ethereumjs/ethereumjs-vm.svg?style=flat-square)](https://coveralls.io/r/ethereumjs/ethereumjs-vm)\n[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs)\n\n[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)\n\nImplements Ethereum's VM in Javascript.\n\n#### Fork Support\n\nThe VM currently supports the following hardfork rules:\n\n- `Byzantium`\n- `Constantinople`\n- `Petersburg` (default)\n- `Istanbul` (`DRAFT`)\n\nIf you are still looking for a [Spurious Dragon](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-607.md) compatible version of this library install the latest of the `2.2.x` series (see [Changelog](./CHANGELOG.md)).\n\n##### Istanbul Harfork Support\n\nWith the `v4.0.0` release we are starting to add implementations of EIPs being\ncandidates or accepted for inclusion within the `Istanbul` hardfork. You can\nactivate a preliminary `Istanbul` VM by using the `istanbul` `hardfork` option\nflag.\n\nCurrently supported `Istanbul` EIPs:\n\n- [EIP-1108](https://eips.ethereum.org/EIPS/eip-1803) (Candidate): `alt_bn128` Gas Cost Reductions, see PR [#540](https://github.com/ethereumjs/ethereumjs-vm/pull/540)\n\nNote that this is highly experimental and solely meant for experimental purposes,\nsince `Istanbul` scope is not yet finalized and most EIPs are still in a `DRAFT`\nstate and likely subject to updates and changes.\n\nA final `Istanbul` VM will be released along a major version bump to likely\n`v5.0.0` or `v6.0.0`.\n\nHave a look at the corresponding issue to follow the discussion and current state on\n[Istanbul planning](https://github.com/ethereumjs/ethereumjs-vm/issues/501).\n\n# INSTALL\n\n`npm install ethereumjs-vm`\n\n# USAGE\n\n```javascript\nconst BN = require('bn.js')\nvar VM = require('ethereumjs-vm').default\n\n// Create a new VM instance\n// For explicity setting the HF use e.g. `new VM({ hardfork: 'petersburg' })`\nconst vm = new VM()\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(err => console.log('Error    : ' + err))\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# BROWSER\n\nTo build for standalone use in the browser, install `browserify` and check [run-transactions-simple example](https://github.com/ethereumjs/ethereumjs-vm/tree/master/examples/run-transactions-simple). This will give you a global variable `EthVM` to use. The generated file will be at `./examples/run-transactions-simple/build.js`.\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## StateManger\n\nThe API for the `StateManager` is currently in `Beta`, separate documentation can be found [here](./docs/classes/statemanager.md), see also [release notes](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/v2.5.0) from the `v2.5.0` VM release for details on the `StateManager` rewrite.\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","readmeFilename":"README.md"}