{"name":"ethereumjs-vm","version":"2.0.2","description":"an ethereum VM implementation","main":"index.js","dependencies":{"async":"^2.1.2","async-eventemitter":"^0.2.2","ethereum-common":"0.0.18","ethereumjs-account":"^2.0.3","ethereumjs-block":"^1.2.2","ethereumjs-util":"^4.0.1","fake-merkle-patricia-tree":"^1.0.1","functional-red-black-tree":"^1.0.1","merkle-patricia-tree":"^2.1.2"},"devDependencies":{"ethereumjs-blockchain":"^1.4.1","ethereumjs-testing":"0.0.1","ethereumjs-tx":"1.1.0","level":"^1.4.0","leveldown":"^1.4.6","levelup":"^1.3.2","memdown":"^1.1.0","minimist":"^1.1.1","standard":"^5.2.2","tape":"^4.2.0"},"scripts":{"testVM":"./tests/tester -v","testState":"./tests/tester -s","testBlockchain":"./tests/tester -b","lint":"standard","test":"./tests/tester -a"},"repository":{"type":"git","url":"git+https://github.com/ethereumjs/ethereumjs-vm.git"},"keywords":["ethereum","VM"],"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","standard":{"ignore":["dist/**","examples/runcode-browserify.js"]},"gitHead":"1233e78390b141f0bb0dd64d1fbae81cad43904e","_id":"ethereumjs-vm@2.0.2","_shasum":"84e2372a5715a80a62f7f2a312f8c64537e8a842","_from":".","_npmVersion":"3.10.9","_nodeVersion":"8.0.0-pre","_npmUser":{"name":"null_radix","email":"null_radix@riseup.net"},"dist":{"shasum":"84e2372a5715a80a62f7f2a312f8c64537e8a842","tarball":"http://registry-npm.ywwl.com/ethereumjs-vm/download/ethereumjs-vm-2.0.2.tgz","integrity":"sha512-mebURndcSh7rRsyXUlJexn4TuvdGvTd8lchLLy86PFHACxfeJuzNzncQX6wM2yc080K9U37NeFCTnylDL422Jw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC9efyRLIK0Phki/g5/lU2zVRxEi68xCze434XwJJz84AIgXCzNqBZozYCGkOaGqxi6+Mh/ExZy783vkaHOmDkJ6Hg="}],"size":345430,"noattachment":false,"key":"/ethereumjs-vm/-/ethereumjs-vm-2.0.2.tgz"},"maintainers":[{"name":"null_radix","email":"mjbecze@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/ethereumjs-vm-2.0.2.tgz_1479248310173_0.26691125077195466"},"directories":{},"deprecated":"New package name format for new versions: @ethereumjs/vm. Please update.","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[![Actions Status](https://github.com/ethereumjs/ethereumjs-vm/workflows/vm-test/badge.svg)](https://github.com/ethereumjs/ethereumjs-vm/actions)\n[![Code Coverage](https://codecov.io/gh/ethereumjs/ethereumjs-vm/branch/master/graph/badge.svg)](https://codecov.io/gh/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`\n- `MuirGlacier` (only `mainnet` and `ropsten`)\n\nIf you are still looking for a [Spurious Dragon](https://eips.ethereum.org/EIPS/eip-607) compatible version of this library install the latest of the `2.2.x` series (see [Changelog](./CHANGELOG.md)).\n\n##### MuirGlacier Hardfork Support\n\nAn Ethereum test suite compliant `MuirGlacier` HF implementation is available\nsince the `v4.1.3` VM release. You can activate a `MuirGlacier` VM by using the\n`muirGlacier` `hardfork` option flag.\n\n**Note:** The original `v4.1.2` release contains a critical bug preventing the\n`MuirGlacier` VM to work properly and there is the need to update.\n\n##### Istanbul Harfork Support\n\nAn Ethereum test suite compliant `Istanbul` HF implementation is available\nsince the `v4.1.1` VM release. You can activate an `Istanbul` VM by using the\n`istanbul` `hardfork` option flag.\n\nSupported `Istanbul` EIPs:\n\n- [EIP-152](https://eips.ethereum.org/EIPS/eip-152): Blake 2b `F` precompile,\n  PR [#584](https://github.com/ethereumjs/ethereumjs-vm/pull/584)\n- [EIP-1108](https://eips.ethereum.org/EIPS/eip-1108): Reduce `alt_bn128`\n  precompile gas costs,  \n  PR [#540](https://github.com/ethereumjs/ethereumjs-vm/pull/540)\n  (already released in `v4.0.0`)\n- [EIP-1344](https://eips.ethereum.org/EIPS/eip-1344): Add ChainID Opcode,\n  PR [#572](https://github.com/ethereumjs/ethereumjs-vm/pull/572)\n- [EIP-1884](https://eips.ethereum.org/EIPS/eip-1884): Trie-size-dependent\n  Opcode Repricing,\n  PR [#581](https://github.com/ethereumjs/ethereumjs-vm/pull/581)\n- [EIP-2200](https://eips.ethereum.org/EIPS/eip-2200): Rebalance net-metered\n  SSTORE gas costs,\n  PR [#590](https://github.com/ethereumjs/ethereumjs-vm/pull/590)\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 the VM for standalone use in the browser, see: [Running the VM in a browser](https://github.com/ethereumjs/ethereumjs-vm/tree/master/examples/run-code-browser).\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## VM's tracing events\n\nYou can subscribe to the following events of the VM:\n\n- `beforeBlock`: Emits a `Block` right before running it.\n- `afterBlock`: Emits `RunBlockResult` right after running a block.\n- `beforeTx`: Emits a `Transaction` right before running it.\n- `afterTx`: Emits a `RunTxResult` 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\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# 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","publish_time":1479248312666,"_cnpm_publish_time":1479248312666,"dist-tags":{"beta":"4.0.0-beta.1","latest":"4.2.0"}}