Skip to content
On-chain interpreter for WebAssembly written in Solidity
Branch: master
Clone or download
Latest commit 662865e Sep 6, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
contracts
data
merkle-computer
node
scripts
test resolved conflicts Aug 16, 2018
.gitattributes
.gitignore New wasm test, initializing wasm file works Jul 3, 2018
.gitmodules
.travis.yml
Dispute Resolution Layer.jpg
Dockerfile
LICENSE we had to license files. the one that counted was also in my name whi… Sep 27, 2017
README.md
alphabet.txt
deploy.js
package-lock.json
package.json
reverse_alphabet.txt

README.md

Build Status

On-chain interpreter

This project contains the code for the WASM onchain dispute resolution.

Usage

Install necessary dependencies:

npm install

Ensure you have a development blockchain you can use. For example:

npm install -g ganache-cli

ganache-cli

Or you can use parity:

Install Parity, then run it with

echo > passfile
parity --chain dev --unlock=0x00a329c0648769a73afac7f9381e08fb43dbea72 --reseal-min-period 0 --password passfile

If Parity complains about password or missing account, try

parity --chain dev --unlock=0x00a329c0648769a73afac7f9381e08fb43dbea72

and then exit Parity. Now it should have created the development account.

Then you need to compile the smart contracts. You will need solc already installed on your machine.

You will also need to download and install ocaml-offchain next to the webasm-solidity (ex: ../webasm-solidity)

chmod 755 ./scripts/compile.sh
npm run compile

Then deploy the smart contracts to the blockchain with:

npm run deploy

Now you can run the task lifecycle test

npm run test test/task-lifecycle.js

To test the solidity wasm interpreter run this

chmod 755 ./scripts/runtests.sh

If the test doesn't output an error, it should have passed. If the proof was wrong, then it will complain about invalid EVM opcode (this is how reverting the state is currently handled in the EVM).

Example Application

If you want to see the code in the context of an example application follow these instructions. This application uses ipfs so you'll have to make sure you install it. In a separate directory follow these installation instructions:

wget https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
tar xf go-ipfs_v0.4.10_linux-amd64.tar.gz
cd go-ipfs
./install.sh
ipfs init

And then the daemon can be started with:

ipfs daemon

Run the test node:

cd node/
node deploy-tasks.js > config.json
node app.js

For user interface, app.html and socketio.js have to be on a web server in the same machine as the test node is running.

You can’t perform that action at this time.