Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.

Rewrite in WASM or as a smart contract #4

Closed
axic opened this issue Jul 20, 2016 · 2 comments
Closed

Rewrite in WASM or as a smart contract #4

axic opened this issue Jul 20, 2016 · 2 comments

Comments

@axic
Copy link
Member

axic commented Jul 20, 2016

Requiring every Ethereum node implementation to rewrite this Javascript project in their language of choice seems unrealistic.

Perhaps making this project available as a WASM piece of code makes sense, given WASM must be supported by nodes.

Ultimately for reducing/removing issues regarding consensus, this project should be deployed as a smart contract and invoked as such.

@axic
Copy link
Member Author

axic commented Jul 20, 2016

Having every EVM1 opcode implemented as a piece of WASM code (like this) gives a good foundation for transforming evm2wasm into a smart contract.

A possible approach is:

  • Write the contract in C/C++ (the best supported language for wasm currently)
  • Compile each of those snippets and keep the binary blob
  • Implement the compileEVM method (from here) which receives a binary input (EVM1 bytecode) and returns the transformed binary
  • Compile and distribute as a WAST/WASM code

Interface as a WASM code:

  • evm2wasm
  • input: (i32 inputOffset) (i32 inputLength) (i32 outputOffset)
  • output: i32 - 0 (false) or 1 (true)

Possibly a evm2wasm_estimate_length method would be useful which gives the minimum space needed for the output.

Interface as a contract:

  • input: EVM1 bytecode as a binary
  • output: EVM2 bytecode as a binary

@axic
Copy link
Member Author

axic commented Dec 19, 2017

As an intermediate step it could be rewritten in C/C++ to generate a .wast as currently and use for example binaryen to compile that to .wasm. This could also be done via directly linking to the binaryen API and using those calls internally.

@axic axic mentioned this issue Jan 10, 2018
jwasinger pushed a commit to jwasinger/evm2wasm that referenced this issue Feb 14, 2018
Makefile: add -fPIC and cleanup target
@axic axic mentioned this issue Mar 15, 2018
44 tasks
@axic axic closed this as completed Aug 2, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant