Snark: zk-SNARK trustless stateless (E)VM

We have established that verifiable computing is possible in a trustless space. Next, we look at the Virtual Machine.

A Virtual Machine (VM) is an encapsulated execution environment. Following our previous example of Worker W, Job Provider J, and computation c(a,b), W does not wish to execute arbitrary function c(a,b) provided by J since J might be malicious and attempt to damage W’s systems. So instead W executes c(a,b) in a virtual machine. Here, even if damage is caused, it will not effect W directly.

The VM does not execute c(a,b), c(a,b) is compiled to bytecode b and then b lives inside the VM. This then allows b.c(a,b) to be called.

The above separation is important for understanding the (Ethereum) Virtual Machine.

At the bottom layer we have the VM (EVM), as the second layer, living inside of the EVM we have the binary (compiled contracts and Application Binary Interface (ABI)), and at the top layer we have solidity contracts.

For those familiar with Java, this is the same as the JVM (Java VM), ByteCode (class files) and Java source code. We would have HelloWorld.java, compile it via the Java Compiler (javac) to HelloWorld.class, and then we can execute via the JVM.

For the EVM, we have HelloWorld.sol, we compile and deploy to address 0xA. We can execute functions inside of 0xA. Consider 0xA as the address pointer.

For this article, we consider a stateless EVM. No data will be saved. Consider the stateless function;

def f(a,b):
return a+b

Two important parts here. One, did the EVM compile the code correctly, and Two, if we execute f(1,1), does it execute correctly.

For both of these, we provide a zk-SNARK enabled compiler, and a zk-SNARK enabled EVM.

Execution of f(a,b) will provide witness {“b”: 2, “a”: 1, “~one”: 1, “~out_0”: 3} as well as the Proving Key. The return is embedded and validated within the EVM as well as via Web3 compliant interfaces.

Execution in the EVM (or other compatible VMs) is ensured in a trustless environment. Consensus is no longer required for execution, EVM processing can be asynchronously parallelized, allowing for trusted off-chain execution.