LibVMS (alpha, v2.0.0)
An API for running cryptographically auditable VM services. Part of NodeVMS.
Overview
LibVMS is a Javascript VM toolset built on NodeJS. Its goal is to auditably execute services on untrusted or semi-trusted hardware.
To accomplish this, LibVMS uses an append-only ledger to maintain a call log. The call log records the VM script, all RPC calls, and all call results. The log is then distributed on the Dat network; it can not be forged, and it can not be altered after distribution (alterations are trivial to detect).
For each VM, LibVMS provisions a Dat files archive to store state. The archive is distributed over the Dat network for clients to read. As with the call log, the files archive is backed by an append-only ledger.
Auditing
The security of LibVMS rests in the unforgeability of its ledgers, and the ability to fully replay the VM history.
Any client can download the call log and files archive, instantiate their own copy of the VM, and replay the log to verify the results. If a replay is found to produce mismatched state, we can assume either A) the VM script has nondeterministic behaviors, or B) the host has tampered with the state of the VM. In either case, the VM is no longer trustworthy.
Authentication
LibVMS has a concept of users and user ids. In debug mode, the user ids are plain authenticated strings. In production mode, the user ids are authenticated public keys and all calls are signed.
Currently, only debug mode authentication is implemented.
VM environment
LibVMS exposes a set of APIs to the VMs using the global System
object. Currently, it is a fixed API (see docs).
Oracles
"Oracles" are a portion of effectful blackbox code which is executed by the host environment. Their execution is wrapped and their results are cached to the call ledger so that they are not executed on replay. (Oracles require trust in the host environment to execute correctly.)
Currently, oracles are not yet implemented.
Docs
Examples
Run a VM
const VM RPCServer = // the scriptconst scriptCode = ` exports.foo = () => 'bar'`const dir = './bobs-vm-data'const title = 'Bobs VM' // initiate vmconst vm = scriptCodeawait vmconsole // init rpc servervar rpcServer = rpcServerawait rpcServerconsoleconsoleconsole
Connect to run commands
const RPCClient = // connect to the serverconst client = await client // run the commandconsole // => 'bar'
Audit the VM state
const RPCClient CallLog DatArchive VM = // connect to the serverconst client = await client // fetch the call logconst callLog = await CallLog // fetch the dat archiveconst filesArchive = clientbackendInfofilesArchiveUrlawait filesArchive // replay the call logconst vm = await VM // compare outputs (will throw on mismatch)await Verifierawait Verifier