Skip to content

[DEPRECATED-the currently maintained repo is https://github.com/TrueBitFoundation/ocaml-offchain]. off-chain WASM interpreter with support for generating merkle proofs of the internal state of the machine.

License

Notifications You must be signed in to change notification settings

TrueBitFoundation/python-offchain

Repository files navigation

Build Status build status Coverage Status License: MIT

PyOffchain

PyOffcahin is a Truebit custom WASM interpreter/tool. It has been written to be fairly modular and flexible(at the cost of being slower but speed is not a concern) so it can be used as a wasm python library as well.

Status

Right now PyOffchain can:
run very simple wasm files.
pretty dump info on the wasm file.

In the future:
have a linker.
have an assembler and a disassembler.

Getting PyOffcahin

To clone the repo you should:

git clone https://github.com/ronin010011/tb-wasm-machine-poc

The submodule is the WASM testsuite. If you are not planning on developing python-offchain you can leave this be otherwise run:

git submodule init
git submodule update

To get the wasm objects for the testsuite, run the script names testsuiteobjectify.sh and pass it the name of the assembler you're using:
For wabt:

./testsuiteobjectify.sh wast2wasm

For binaryen:

./testsuiteobjectify.sh wasm-as

WASM Pretty Dumps

There are a total of four options that give you pretty dumps of a wasm file:

  • --sectiondump: dumps the hex of a section given by its name.
  • --hexdump: dumps the whole wasm file in hex format. Expects an integer for the number of bytes to show in each line.
  • --dbgsection: dumps a section given by name in a human friendly format.
  • --dbg: dumps the whole wasm file in a human friendly format.
  • --memdump: dumps the linear memory starting from offset zero til the given address.
  • --idxspc: dumps the index space a human friendly format.

A Very Simple Stack Machine Interpreter

If this is the first time you are hearing about stack machines, you can check out a very simple stack machine interpreter.
It is a very simple stack machine. You have been warned.

About

[DEPRECATED-the currently maintained repo is https://github.com/TrueBitFoundation/ocaml-offchain]. off-chain WASM interpreter with support for generating merkle proofs of the internal state of the machine.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published