Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

contract-vm

kep39ISC0.0.6

This is an implementation of a minimalist smart contract system, written in TypeScript. Contracts are safely isolated in their own WebAssembly virtual machines.

readme

Contract VM

This is an implementation of a minimalist smart contract system, written in TypeScript. Contracts are safely isolated in their own WebAssembly virtual machines.

This module is designed to be used in Node or the browser.

Usage

let Contract = require('contract-vm')

let bindings = {
  print(msg) {
    console.log(msg)
  }
}

let contract = Contract(codeBuffer, bindings)

let [result, gasCost] = contract.someMethod({ foo: 'bar' })

Features

  • Enforced determinism
  • Metered execution (ie. gas)
  • Lightweight and fast
  • Easily extensible with custom host bindings