Introducing the Fetch.AI Virtual Machine

Fetch.ai
Fetch.ai
Published in
4 min readFeb 13, 2019

We’re pleased to announce our Virtual Machine (VM) is now live. A VM is a computer programme that emulates a processor and is used to execute a smart contract (another computer programme) when transactions are made across the network.

In the case of Fetch.AI and other distributed ledgers the VM is critical as it enables smart contracts to be deployed and transactions to run in multiple places. In short, it enables a massively replicated execution of the smart contract across all computers on the Fetch.AI network, accounting for different types of hardware that may be involved. Our VM is fully integrated with the Fetch.AI Smart Ledger so a record of each smart contract is stored.

Smart contracts are important because they make a distributed ledger ‘general purpose’. Developers are able to build smart contracts to address specific problems, harnessing the potential of the underlying infrastructure. With our VM we’re opening the capabilities of Fetch.AI to the developer community so they can conceive and deploy new innovations.

You’re probably familiar with Ethereum and its virtual machine. This VM represented a major breakthrough as it enabled smart contracts to be deployed at scale. Since then we’ve seen the Ethereum VM used for everything from simple insurance smart contracts e.g. ‘The plane is delayed by more than three hours, make compensation payments to holders of insurance policy X’, to Crypto Kitties, and a whole lot in between. But with Fetch.AI we’re focused on decentralised solutions to the next layer of problems, typically requiring advanced machine learning algorithms.

Today’s blockchain virtual machines simply weren’t designed for data-intensive machine learning problem solving and are unsuited to running say, a neural network. In the case of the Ethereum VM its design requires ‘gas’ to execute computing functions, which is a clever solution to prevent spam but makes it too costly for the use cases we’re focused on. In fact, the Fetch.AI VM is the first and only VM designed specifically for data-intensive decentralised machine learning tasks — although it’s pretty neat at more conventional computing tasks too.

We envisage users of our network packaging up complex optimisation and scheduling problems within a smart contract, which can then be coded within and executed via our VM. The ‘miners’ on the Fetch.AI network then compete with each other for rewards as part of the network’s consensus process. They do this by providing the best algorithmic solution to the overall problem, or a subset of the problem.

Smart contracts in Fetch.AI might contain problems like parcel delivery optimisation. For example, they may solve questions such as ‘How do I organise a set of independent delivery drivers within a city to most efficiently deliver a series of packages to known destination addresses, with specific service level agreements around delivery times for those packages?’. This type of problem requires the ability to execute statistical analysis and advanced programmes across a wide variety of distributed machines using different hardware.

Over a year invested in our native maths library

One of the reasons today’s VM’s aren’t suited to statistical analysis tasks is the lack of mathematical precision available. If you were building a centralised machine learning model on standardised hardware this wouldn’t be a problem. LAPACK offers an enormous maths library that developers can draw on and it has been maintained since the 1950s. The trouble is, LAPACK uses the ‘Doubles’ and ‘Floats’ standards to specify decimal numbers.

However, smart contracts can only work with the ‘Integer’ standard for specifying numbers. There’s a very good reason for this. Doubles and Floats give you very slightly different representations of numbers when using different hardware processors. So, a number on a Raspberry Pi may be different to the representation of the same number on an Intel processor when you get down as far as the 10th decimal place. For decentralised machine learning to take place, this represents a problem.

When you’re practising decentralised computing you must have complete consistency and reproducibility, otherwise you would end up with very different hashes of what should be the same number. Of course, none of this matters to the user, but it’s a big deal for machines.

Remember, there is no maths library built for Integers. This creates a real headache for developers looking to create statistical analysis smart contracts. That’s why we’ve created a native version of the well-known BLAS maths library directly within the Fetch.AI VM. This enables us to easily code statistical functions like multiplying matrices with vectors. The upshot is the ability to do very advanced statistical analysis within a smart contract and in a way that can be replicated across any machine. It has taken over a year to achieve this, but it’s key to delivering our vision for synergetic smart contracts.

You can learn more about our Virtual Machine by watching our interview with head of software engineering Troels Rønnow:

--

--

Fetch.ai
Fetch.ai

Build, deploy and monetize AI apps and services.