All Projects → TrueBitFoundation → ocaml-offchain

TrueBitFoundation / ocaml-offchain

Licence: Apache-2.0 License
Fork of WebAssembly reference interpreter with support for generating proofs needed for blockchain verification

Programming Languages

WebAssembly
147 projects
ocaml
1615 projects
javascript
184084 projects - #8 most used programming language
c
50402 projects - #5 most used programming language
Batchfile
5799 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to ocaml-offchain

Esta
Interpreted language and bytecode VM of my own design written in Rust [Unmaintained]
Stars: ✭ 28 (-33.33%)
Mutual labels:  interpreter, wasm
Wasm Forth
A Forth implementation compiling to WebAssembly.
Stars: ✭ 92 (+119.05%)
Mutual labels:  interpreter, wasm
Rustpython
A Python Interpreter written in Rust
Stars: ✭ 10,261 (+24330.95%)
Mutual labels:  interpreter, wasm
Winter
Haskell port of the WebAssembly OCaml reference interpreter
Stars: ✭ 42 (+0%)
Mutual labels:  interpreter, wasm
webasm-solidity
[DEPRECATED] On-chain interpreter for WebAssembly written in Solidity
Stars: ✭ 65 (+54.76%)
Mutual labels:  interpreter, truebit
Wasmi
Wasm interpreter in Rust
Stars: ✭ 670 (+1495.24%)
Mutual labels:  interpreter, wasm
Wasmjit
Small Embeddable WebAssembly Runtime
Stars: ✭ 1,063 (+2430.95%)
Mutual labels:  interpreter, wasm
Webassemblyjs
Toolchain for WebAssembly
Stars: ✭ 566 (+1247.62%)
Mutual labels:  interpreter, wasm
Alchemyvm
WebAssembly Virtual Machine Built In Elixir
Stars: ✭ 176 (+319.05%)
Mutual labels:  interpreter, wasm
Wasm Micro Runtime
WebAssembly Micro Runtime (WAMR)
Stars: ✭ 2,440 (+5709.52%)
Mutual labels:  interpreter, wasm
Wain
WebAssembly implementation from scratch in Safe Rust with zero dependencies
Stars: ✭ 160 (+280.95%)
Mutual labels:  interpreter, wasm
warpy
WebAssembly interpreter in RPython
Stars: ✭ 54 (+28.57%)
Mutual labels:  interpreter, wasm
wazm
Web Assembly Zig Machine
Stars: ✭ 54 (+28.57%)
Mutual labels:  interpreter, wasm
interp
Interpreter experiment. Testing dispatch methods: Switching, Direct/Indirect Threaded Code, Tail-Calls and Inlining
Stars: ✭ 32 (-23.81%)
Mutual labels:  interpreter, wasm
idris-codegen-wasm
WebAssembly Code Generation Backend for Idris Compiler
Stars: ✭ 79 (+88.1%)
Mutual labels:  wasm
wendy
Wendy is an compiler / interpreter for WendyScript
Stars: ✭ 14 (-66.67%)
Mutual labels:  interpreter
holyc
An easy to use C++ to WASM compiler (Highly-experimental)
Stars: ✭ 33 (-21.43%)
Mutual labels:  wasm
i8080-Space-Invaders
Intel i8080 Space Invaders Arcade Emulator
Stars: ✭ 19 (-54.76%)
Mutual labels:  interpreter
3bc-lang
Low level language, tiny virtual machine that works on computers and microcontrollers. (Friendly Punched cards)
Stars: ✭ 155 (+269.05%)
Mutual labels:  interpreter
awesome-internals
A curated list of awesome resources and learning materials in the field of X internals
Stars: ✭ 78 (+85.71%)
Mutual labels:  interpreter

Build Status

Installation of the off-chain interpreter

These instructions were tested on Ubuntu 17.04.

First install dependencies

apt-get install -y wget gcc ocaml opam libzarith-ocaml-dev m4 pkg-config zlib1g-dev
opam init -y
eval $(opam config env)
opam install cryptokit yojson

Then go to the interpreter directory of the repo

cd interpreter
make

If the build fails it may be due to an outdated version of ocaml. To upgrade simply run opam switch 4.06.0, and then follow the steps above starting with eval $(opam config env).

This should generate the executable wasm in the interpreter directory.

Testing the off-chain interpreter

./wasm -m ../test/core/fac.wast

If there are no errors, it means that the tests were passed.

./wasm -t -m ../test/core/fac.wast

This command will print the trace messages, it will basically output every instruction that the interpreter runs.

Outputting proofs:

./wasm -case 0 -step 4 -m ../test/core/fac.wast

This will make a proof for step 4 in the computation. Because there are many test cases, one of them has to be selected, so for example -case 0 will select the first test case.

Using the JSON-RPC Server

cd server
npm install
node index.js

A client can communicate with the server like this:

var jayson = require('jayson');

// create a client
var client = jayson.client.http({
  port: 3000
});

// invoke *command* with *args*
client.request('*command*', [*args*], function(err, response) {
  if(err) throw err;
  console.log(response.result);
});

Docker

If you want to run these tests inside of a Docker container you can pull the latest docker image and try it out.

docker run --name tb-offchain -ti hswick/ocaml-offchain:latest`
cd webasm/interpreter
./wasm -t -m ../test/core/fac.wast
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].