Skip to content

Computing on offers a decentralized computing framework that allows users to run programs on the network. This is done by creating a virtual machine (VM) that executes the program.

Overview of VMs

There are several types of VMs available on the network:

An On-demand VM is created on a Compute Resource Node (CRN) and is destroyed once the program has finished executing. This is great for programs that are responding to user requests or API calls (using ASGI) and can shutdown after processing the event. They are also cheaper to run as they only require one tenth of the $ALEPH tokens to hold, compared to a Persistent VM.

A Persistent VM can be used to run programs that cannot afford to stop or need to handle incoming connections such as polling data from a websocket or AMQP API.

Instances are similar to Persistent VMs, but are specifically designed to run with a SSH key supplied by the user. This allows the user to connect to the VM and interact with it directly. They do not rely on code execution, but rather on the user's ability to connect to the VM and run commands on it. They cost as much as Persistent VMs.

On-demand Execution

On how to deploy a simple Python microVM, see our Python microVM guide

Persistent Execution

When a program is created with persistent execution enabled, the scheduler will find a Compute Resource Node (CRN) with enough resources to run the program and schedule the program to start on that node.

Persistent programs are designed to always run exactly once, and the scheduler will reallocate the program on another CRN would the current one go offline.

⚠️ Automatic data migration across hosts in case such events happen is not available yet.

Message Specification

The execution model of a program is defined in the field message.content.on of messages of type PROGRAM and is non exclusive. The same program can therefore be available as both persistent instance and on demand at the same time.

message = {
    "content": {
        "on": {
          "http": false,
          "persistent": true
        "resources": {
          "vcpus": 1,
          "memory": 128,


Before you begin this tutorial, ensure that you have the following:

  • A computer with Python and the aleph-client utility installed
  • An Ethereum account with at least 2000 ALEPH token
  • Working knowledge of Python

Step 1: Create your program

Let's consider the following example from the FastAPI tutorial. Any other ASGI compatible Python framework should work as well.

Running programs written in any language that works on Linux is possible. This will be documented later.

Create a file named src/

from fastapi import FastAPI

app = FastAPI()

async def root():
    return {"message": "Hello World"}

Test the application locally:

cd ./src/
uvicorn main:app --reload

Step 2: Run a program in a persistent manner

To run the program in a persistent manner on the network, use:

aleph program upload --persistent ./src/ main:app

You can stop the execution of the program using:

aleph unpersist $MESSAGE_ID

Find your program

TODO: Locate the CRN where your program is running.

Instance VMs

TODO: Document Instance VMs