Oasis Runtime with SSVM - second-state/oasis-ssvm-runtime GitHub Wiki

  • Use oasis-runtime & oasis-parity with our patch
  • Use docker image secondstate/oasis-ssvm
  • Send wasm tx and run it in
git clone https://github.com/oasisprotocol/oasis-core.git --branch v20.7
git clone https://github.com/second-state/oasis-runtime.git --branch dm4/local-parity
git clone https://github.com/second-state/oasis-parity.git --branch dm4/ssvm

docker pull secondstate/oasis-ssvm
docker run -it --rm \
  --name oasis-ssvm \
  --security-opt apparmor:unconfined \
  --security-opt seccomp=unconfined \
  -e OASIS_UNSAFE_SKIP_AVR_VERIFY=1 \
  -e OASIS_UNSAFE_SKIP_KM_POLICY=1 \
  -v $(pwd):/root/code \
  -w /root/code \
  secondstate/oasis-ssvm \
  bash

# in docker
cd ~/code/oasis-runtime
rustup target add x86_64-fortanix-unknown-sgx
make -C ../oasis-core
make symlink-artifacts OASIS_CORE_SRC_PATH=../oasis-core
make
make run-gateway

Log after running gateway:

 INFO  gateway/main > Starting the web3 gateway
 INFO  gateway/execute > Waiting for the Oasis Core node to be fully synced
 INFO  gateway/execute > Oasis Core node is fully synced, proceeding with initialization
 INFO  gateway/main    > Web3 gateway is running

In another shell:

docker exec -it oasis-ssvm bash
cd /ssvm/web3
npm install web3 truffle-hdwallet-provider
node index.js

index.js is from https://gist.github.com/dm4/f51356cc6c817a1f2cf3e942a4f18615/

After running index.js, you'll see SSVM log in the shell running gateway:

result Ok(EvmcLoaderSucces)
Instantiate: ("ssvm", "0.4.0")
Host: get_storage
Host: set_storage
Host: get_storage
Host: set_storage
Host: get_storage
Host: set_storage
Host: get_storage
Host: set_storage
Host: get_storage
Host: set_storage
Host: get_storage
Host: set_storage
Host: get_storage
Host: set_storage
Host: get_storage
Host: set_storage
Host: get_storage
Host: set_storage
Host: get_storage
Host: set_storage
Output:  "0000000000000000000000000000000000000000000000000000000000000037"
GasLeft: 2251799813421427
Status:  EVMC_SUCCESS