git ssb


0+

wanderer / evm2wasm



Branch:

wanderer committed remove wabt depsLatest: ad59176 on 1/1/2017, 3:22:30 PM
📄.gitignore
📄.travis.yml
📄LICENSE
📄README.md
📁bin
📁docs
📄index.js
📄opcodes.js
📄package.json
📁tests
📁wasm

SYNOPSIS

NPM Package
Build Status

js-standard-style

EVM (Ethereum VM 1.0) to eWASM transcompiler. Here is a online frontend.

INSTALL

npm install evm2wasm

DEVELOP

API

./docs/

TECHINCAL NOTES

EVM is stack based and offers access to memory, storage and state via special instructions.
Here we replicate the stack layout in WebAssembly and implement each operation working on this stack.

OPCODES

Every opcode (bar some special instructions) receives the current stack pointer ($sp) as i32 and must return the adjusted stack pointer.

STACK LAYOUT

The stack grows from memory location 0, where 256 bit values are stored linearly in LSB byteorder.
The $sp points to the starting position of the top stack entry (and not the next free stack position). If the stack is empty, it is set to -32.

MEMORY LAYOUT

The eWASM contract memory layout is currently as follows:

.---------------------------------------------------
| eWASM memory starts here
+---------------------------------------------------
| Reserved space for the stack (32768 bytes)
| - each stack entry is 256 bit
| - the stack is limited to 1024 entries
+---------------------------------------------------
| Word count (4 bytes)
| (Number of 256 bit words stored in memory)
+---------------------------------------------------
| Previous memory cost in word count (4 bytes)
| (The cost charged for the last memory allocation)
+---------------------------------------------------
| Scratch space (32 bytes)
+---------------------------------------------------
| Reserved space for the SHA3 context (1024 bytes)
+---------------------------------------------------
| Contract memory starts here ("unlimited" in size)
`---------------------------------------------------

METERING

The generated eWASM contract contains gas metering. It is assumed evm2wasm will become a deployed trusted contract, which returns eWASM code that does not need to be run through the gas injector contract.

LICENSE

MPL-2.0)


Built with git-ssb-web