You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -19,27 +17,35 @@ The VM currently supports the following hardfork rules:
19
17
-`Constantinople`
20
18
-`Petersburg` (default)
21
19
22
-
If 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)).
20
+
If 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)).
23
21
24
22
# INSTALL
23
+
25
24
`npm install ethereumjs-vm`
26
25
27
26
# USAGE
27
+
28
28
```javascript
29
29
varVM=require('ethereumjs-vm')
30
30
31
31
//create a new VM instance
32
32
var vm =newVM()
33
-
var code ='7f4e616d65526567000000000000000000000000000000000000000000000000003055307f4e616d6552656700000000000000000000000000000000000000000000000000557f436f6e666967000000000000000000000000000000000000000000000000000073661005d2720d855f1d9976f88bb10c1a3398c77f5573661005d2720d855f1d9976f88bb10c1a3398c77f7f436f6e6669670000000000000000000000000000000000000000000000000000553360455560df806100c56000396000f3007f726567697374657200000000000000000000000000000000000000000000000060003514156053576020355415603257005b335415603e5760003354555b6020353360006000a233602035556020353355005b60007f756e72656769737465720000000000000000000000000000000000000000000060003514156082575033545b1560995733335460006000a2600033545560003355005b60007f6b696c6c00000000000000000000000000000000000000000000000000000000600035141560cb575060455433145b1560d25733ff5b6000355460005260206000f3'
34
-
35
-
vm.runCode({
36
-
code:Buffer.from(code, 'hex'), // code needs to be a Buffer
-[old blog post](https://wanderer.github.io/ethereum/nodejs/code/2014/08/12/running-contracts-with-vm/)
45
51
@@ -51,48 +57,48 @@ To build for standalone use in the browser, install `browserify` and check [run-
51
57
52
58
## VM
53
59
54
-
For documentation on ``VM`` instantiation, exposed API and emitted ``events`` see generated [API docs](./docs/index.md).
60
+
For documentation on `VM` instantiation, exposed API and emitted `events` see generated [API docs](./docs/index.md).
55
61
56
62
## StateManger
57
63
58
-
The API for the ``StateManager`` is currently in ``Beta``, separate documentation can be found [here](./docs/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.
64
+
The API for the `StateManager` is currently in `Beta`, separate documentation can be found [here](./docs/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.
59
65
60
66
# Internal Structure
67
+
61
68
The VM processes state changes at many levels.
62
69
63
-
***runBlockchain**
64
-
* for every block, runBlock
65
-
***runBlock**
66
-
* for every tx, runTx
67
-
* pay miner and uncles
68
-
***runTx**
69
-
* check sender balance
70
-
* check sender nonce
71
-
* runCall
72
-
* transfer gas charges
73
-
***runCall**
74
-
* checkpoint state
75
-
* transfer value
76
-
* load code
77
-
* runCode
78
-
* materialize created contracts
79
-
* revert or commit checkpoint
80
-
***runCode**
81
-
* iterate over code
82
-
* run op codes
83
-
* track gas usage
84
-
***OpFns**
85
-
* run individual op code
86
-
* modify stack
87
-
* modify memory
88
-
* calculate fee
70
+
-**runBlockchain**
71
+
- for every block, runBlock
72
+
-**runBlock**
73
+
- for every tx, runTx
74
+
- pay miner and uncles
75
+
-**runTx**
76
+
- check sender balance
77
+
- check sender nonce
78
+
- runCall
79
+
- transfer gas charges
80
+
-**runCall**
81
+
- checkpoint state
82
+
- transfer value
83
+
- load code
84
+
- runCode
85
+
- materialize created contracts
86
+
- revert or commit checkpoint
87
+
-**runCode**
88
+
- iterate over code
89
+
- run op codes
90
+
- track gas usage
91
+
-**OpFns**
92
+
- run individual op code
93
+
- modify stack
94
+
- modify memory
95
+
- calculate fee
89
96
90
97
The opFns for `CREATE`, `CALL`, and `CALLCODE` call back up to `runCall`.
91
98
92
-
93
99
# DEVELOPMENT
94
100
95
-
Developer documentation - currently mainly with information on testing and debugging - can be found [here](./docs/developer.md).
101
+
Developer documentation - currently mainly with information on testing and debugging - can be found [here](./docs/developer.md).
96
102
97
103
# EthereumJS
98
104
@@ -101,4 +107,5 @@ See our organizational [documentation](https://ethereumjs.readthedocs.io) for an
101
107
If 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).
0 commit comments