System

This page provides some explanation for how the Coputer network works by showing how this page was generated and served to you. The network is split up into a number of separate systems, so the function of each will be outlined here.

Gateway

The process begins when your browser sends a request is sent to a gateway, the entrypoint for the Coputer network for any programs written to produce web requests.

The gateway, such as the one hosted at coputer.heliodex.cf, looks at the parameters of the request and determines which program to execute. Programs are identified by a name and the public key of the publisher. The gateway requests the nearest communication system for the output of the program, providing it with its name, public key, and request parameters.

Source code for the gateway reference implementation
Diagram with a cloud representing the internet in the top left, a rounded rectangle for the gateway, and an oval for the communication system. 2 arrows show the request coming from the internet to the gateway, and the gateway sending the request to the communication system.
Diagram showing the gateway sending requests to the communication system

Communication system

The communication system is a service responsible for key management and connecting and distributing Coputer programs and their outputs. The program's publisher will have used it to store the program and distribute it across the network.

The communication system receives the request from the gateway and asks its execution system to process the request. If it fails (can't connect, or the program is not stored, cannot be executed, returns an error etc), the communication system will send out a request to its peers for the program output. If the output is found it is sent back to the gateway, otherwise an error is returned.

Source code for the communication system reference implementation
Diagram with 4 circles representing communication systems in the network, and arrows going between them representing the transfer of requests and responses. The first node asks for the program, 2 others do not have it, and the final one returns the response
Diagram showing transfers between communication systems over a network

Execution system

The execution system is responsible for storing, executing, and caching responses of Coputer programs. Upon receiving the request to process the program, it checks if the program is stored, returning an error if it isn't. Then it will check if the program output is already cached, returning the cached response if it is.

If we have the program and its response is not cached, it's now time to run it. The entrypoint to the program is compiled then executed by the virtual machine, the most complex part of the Coputer system. The VM dynamically compiles any dependencies and executes the program in a sandboxed, deterministic environment. Once a response is obtained, it is sent back through the communication system to the gateway, completing the request.

Source code for the execution system reference implementation
Diagram with the communication system displayed as an oval on the top, the execution system as a rectangle on the bottom, and two arrows going between them representing the transfer
Diagram showing transferring the program to the execution system, then sending the results back to the communication system