Skip to content

btc-vision/rust_runtime

 
 

Repository files navigation

Rust runtime for OP_NET VM

Compilation

rustup install nightly # ensure that you have last nightly version
cargo build --release -p example --target wasm32-unknown-unknown
wasm-opt -O2 -Oz --strip-debug --strip-dwarf --dce --disable-multimemory --disable-fp16 --disable-mutable-globals --disable-gc --disable-multivalue --disable-nontrapping-float-to-int --disable-threads --mvp-features --remove-unused-module-elements ./target/wasm32-unknown-unknown/release/example.wasm -o ./rust.wasm

Testing

With opnet-unit-test on wasm interpreter

cp ./rust.wasm ../opnet-unit-test/bytecode/rust.wasm
node build/tests/rust.js

Without wasm32 runtime

cargo test --target x86_64-unknown-linux-gnu

Size (outdated)

  • Compiled code from moto library: 24KB (24689)
  • Unoptimized code from current Rust library: 45KB (45584)
  • Optimized code with wasm-opt: 33KB (33573)

Structure

  • ./src/ - Library providing the interface and helper functions for contract interaction
  • ./example/ - Sample smart contract, similar to contract used in unit tests

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.6%
  • HTML 0.4%