# Coronium supply

> Coronium for device owners at https://supply.coronium.ai: connect a device with the open agent, and earn a share of what buyers pay for the traffic it carries. Buyers use https://coronium.ai.

This file is written from the service's own list of facts, whose digest is `00a38b8f822c`. Questions and more devices go to support@coronium.ai. An account withdraws its own device with one call.

coronium.io is the per-device shop for dedicated mobile modems and the marketplace where modem owners earn; coronium.ai is access for AI agents to proxies and devices on one account.

Every refusal carries `code`, `cause` and `fix`. Whether sign-up is open on this site, the sign-up call answers: while it is closed an existing account signs in with its access code. Whether buyers are charged and whether per-GB traffic is sold to them, `GET /app/api/buy` answers in `charging` and `peerSales`.

An agent does the whole job with HTTP calls and a shell: [/llms-full.txt](/llms-full.txt) holds every step and call in order, in one file, from an account to a payout. `GET /.well-known/search?q=<text>` finds a passage in these documents; the search guide below says how.

Before anything is signed: a device on a hosting or data-centre network, such as a cloud server, connects, is measured, and is then withheld as `class_not_sold`. It carries no buyer traffic and earns nothing. No read classes a network before sign-up: the first measurement after the device connects does. Tell your person so before they sign, because a signature is never withdrawn.

## The prompt to give an agent

> Read https://supply.coronium.ai/guides/integrate.md and follow its device steps to connect this machine to Coronium. Tell me first if this machine is in a data centre, where a device earns nothing. Before you sign the partner agreement, show me its text and wait for my yes; keep every secret in a file and out of this chat; when you finish, tell me the device's state and how to stop it.

The shortest that is still safe:

> Follow https://supply.coronium.ai/guides/integrate.md to connect this machine to Coronium, and get my yes before you sign anything.

When the agent is to use your account, add: "My access code is in the file coronium-account.json in this folder; read it there and never print it."

The device steps keep their files in one folder, `~/coronium` unless `CORONIUM_DIR` names another. An access code your person gives you goes into `coronium-account.json` in that folder: move the file there, or export `CORONIUM_DIR` as the folder that holds it.

## Which file answers which question

- What bandwidth sharing is, what is shared, what a device earns and the SDK for an app, before any account: [bandwidth sharing](/bandwidth-sharing.md), a page for people at [/bandwidth-sharing](/bandwidth-sharing).
- Sharing inside an app or across a fleet, as it stands today: [the bandwidth sharing SDK](/bandwidth-sharing/sdk.md).
- Everything, in one fetch: [/llms-full.txt](/llms-full.txt).
- Make the account, sign the agreement, enrol a device: [enrolment](/guides/device-enrol.md).
- Which file to download, and which way to run it: [the agent files](/guides/device-files.md), then [the Linux kit](/guides/device-linux-kit.md), [a container](/guides/device-docker.md) or [the program alone](/guides/device-program.md).
- Is it connected, and does it carry traffic: [device states](/guides/device-states.md).
- What did it earn, and how is it paid: [the statement and a payout](/guides/device-payouts.md).
- A newer agent, stopping, removing, withdrawing: [update, stop, remove and withdraw](/guides/device-lifecycle.md).
- Sign out, ending this session with `POST /app/api/logout`: [its block](/guides/device-lifecycle.md#sign-out).
- A line in the log, or an installer that refuses: [troubleshooting](/guides/device-troubleshoot.md).
- A call answered with a `code`: [refusals](/guides/device-refusals.md).

## Guides

In the order of the job:

- [Every integration in one file](/guides/integrate.md): each section below, in order, with the prompts and what only your person decides, and the sections for buyers.
- [Enrolment](/guides/device-enrol.md): the account, the partner agreement and one device.
- [The agent files](/guides/device-files.md): `/kit/index.json`, each file with its state and its limits, and how to check one.
- [The Linux kit](/guides/device-linux-kit.md), [a container](/guides/device-docker.md), a service on [macOS](/guides/device-macos.md) or [Windows](/guides/device-windows.md), or [the program alone](/guides/device-program.md), built for Linux, Windows, macOS and routers: each file's state, limits and what was observed of it are in the files section.
- [Device states](/guides/device-states.md): every state and reason with what to do, earnings and payouts.
- [Device health](/guides/device-health.md): whether a connected device still carries traffic, what each reading means, and what the checks cost its connection.
- [The statement and a payout](/guides/device-payouts.md): `GET /app/api/earnings` field by field, what the share applies to, and the payout request as a block to run.
- [Update, stop, remove and withdraw](/guides/device-lifecycle.md): one answer each, with the release `/kit/index.json` publishes and the call that withdraws a device.
- [Troubleshooting](/guides/device-troubleshoot.md): each line the agent and the installer print, with its cause and what to do, and what a device refuses.
- [Refusals](/guides/device-refusals.md): every code of a device owner's calls, with who acts and what to do.
- [Many devices](/guides/device-tokens.md): enrolment by token. While the operator keeps it closed, its routes answer 503 `enrol_tokens_off` and each device is enrolled with `POST /app/api/devices`.
- [Notifications](/guides/notifications.md): what happened on the account, devices admitted, withheld or gone offline included, how to mark it read, and whether it is mailed.
- [Search](/guides/search.md): `/.well-known/search`, the request, the answer and its bounds.
- [Stated limits](/guides/limits.md): what the service does not do yet.
- [Skills to install](/.well-known/agent-skills/index.json): `coronium-device` for this job alone, and `coronium` for this job and a buyer's.

## Files and API

- [Agent downloads](/kit/index.json): each way to connect and each file, with its state, its limits and its SHA-256. [`SHA256SUMS`](/kit/SHA256SUMS) lists the same digests, and [the signing contract](/kit/SIGNING.md) says what a signature and an enrolment store.
- `GET /app/api/agreement`: the partner agreement in force, its version and its SHA-256, with no account.
- [OpenAPI document](/openapi.json): every call, with its request, its answer and its refusals.
- [Documents manifest](/docs-manifest.json): every document of this site with its address, its title and, where the site serves the file as it is, its SHA-256 and size.
- [Discovery file](/.well-known/coronium-supply.json): the addresses above as JSON.
- [This site's front page as Markdown](/index.md): what `/` answers a request that accepts `text/markdown`.
- [Farmer portal](/farmer): the same steps in a browser, after sign-in.

This page: https://supply.coronium.ai/guides/device-enrol.md.

# Connect a device: account, agreement and enrolment

Calls go to https://supply.coronium.ai: each block sets `SUPPLY` to it unless you exported `SUPPLY`, and enters one folder, `~/coronium` unless you exported `CORONIUM_DIR`. The blocks use curl, jq, sha256sum and python3 and keep every answer in a file only you can read: check a file by its keys, never by printing it. Enrol a device only when its owner, and whoever pays for its connection, agreed.

On a hosting or data-centre network a device is withheld as `class_not_sold` and earns nothing: tell your person before they sign.

## Steps

1. Sign up once, then sign in.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
mkdir -p "${CORONIUM_DIR:=$HOME/coronium}" && cd "$CORONIUM_DIR" || exit
[ ! -e coronium-account.json ] || jq -e 'has("accessCode")' coronium-account.json >/dev/null || { echo "coronium-account.json holds no accessCode: correct or move it" >&2; exit 1; }
if [ ! -e coronium-account.json ]; then
  curl -sS "$SUPPLY/app/api/signup/challenge" -o coronium-challenge.json
  jq -e 'has("challenge") or error("\(.code): \(.cause) Fix: \(.fix) \(.retryAt // "")")' coronium-challenge.json >/dev/null || exit 1
  python3 -c 'import hashlib,json,sys,itertools;a=json.load(sys.stdin);c=a["challenge"];print(json.dumps({"challenge":c,"nonce":str(next(n for n in itertools.count() if int.from_bytes(hashlib.sha256(f"{c}:{n}".encode()).digest(),"big")>>256-a["difficulty"]==0))}))' < coronium-challenge.json | curl -sS -c coronium.cookies -H 'Content-Type: application/json' -d @- "$SUPPLY/app/api/signup" -o coronium-signup.json
  jq -e 'has("accessCode") or error("\(.code): \(.cause) Fix: \(.fix) \(.retryAt // "")")' coronium-signup.json >/dev/null || exit 1
  mv coronium-signup.json coronium-account.json
fi
jq -c '{code: .accessCode}' coronium-account.json | curl -sS -c coronium.cookies -H 'Content-Type: application/json' -d @- "$SUPPLY/app/api/login"
```

Expect: `{"signedIn":true}`. A new account's file holds `accessCode`, `accountId` and `credential`, shown this once. A refusal prints its code, cause and fix, and no account is made: on `registration_closed`, your person makes `coronium-account.json` in this folder with `chmod 600`, holding `{"accessCode": "<access code>"}`, then rerun; on `signups_paused` or `rate_limited`, wait until the time named. A file there without an access code stops the block: correct it or move it. Safe to repeat: yes; it signs up only when the file is absent.

2. Read the partner agreement, and show it.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
curl -sS -b coronium.cookies "$SUPPLY/app/api/consent" -o coronium-consent.json
jq -j '.text // empty' coronium-consent.json > coronium-agreement.md
jq '{version, sha256, approved, status, code}' coronium-consent.json
```

Expect: `approved` true, and `status` `unsigned`, `signed` or `countersigned`; `sha256sum coronium-agreement.md` prints `sha256`. Show your person `coronium-agreement.md` whole, with `version` and `sha256`, and wait for their yes. While `approved` is false nobody can sign. Safe to repeat: yes.

3. Sign, after the yes. Write `coronium-signer.json` as `{"name": "<full legal name>", "organisation": "<only when they sign for one>"}`: the person or organisation that controls the account, never you, trimmed, without `|` or a line break. The block keeps the signed body in `coronium-signature.json`.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
[ -s coronium-signature.json ] || {
  now=$(date -u +%Y-%m-%dT%H:%M:%S.000Z)
  sig=$(jq -j --arg now "$now" --slurpfile s coronium-signer.json '"coronium-partner-agreement|\(.version)|\(.accountId)|\($s[0].name)|\($s[0].organisation // "")|\(.sha256)|\($now)"' coronium-consent.json | sha256sum | cut -d' ' -f1)
  jq -c --arg now "$now" --arg sig "$sig" --slurpfile s coronium-signer.json '{consent: {version, sha256}, agreed: true, signer: $s[0], signedAt: $now, signature: $sig}' coronium-consent.json > coronium-signature.tmp && mv coronium-signature.tmp coronium-signature.json || exit
}
curl -sS -b coronium.cookies -H 'Content-Type: application/json' -d @- "$SUPPLY/app/api/consent" < coronium-signature.json | jq '{signatureId, version, code}'
```

Expect: a `signatureId`. [`/kit/SIGNING.md`](/kit/SIGNING.md) has the fingerprint with a worked example, and what is stored with a signature and each enrolment. If refused: `bad_signed_at` (more than 10 minutes from the server's clock: fix the clock, delete `coronium-signature.json`, repeat), `already_signed` (signed already with other values; that stands, go on), `consent_outdated` (step 2, then delete `coronium-signature.json`). Safe to repeat: yes, with the same file. A signature is never withdrawn.

4. Enrol one device.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
[ -s coronium-enrol.json ] || { jq -c --arg id "$(od -An -tx1 -N8 /dev/urandom | tr -d ' \n')" '{consent: {version, sha256}, agreed: true, requestId: $id}' coronium-consent.json > coronium-enrol.tmp && mv coronium-enrol.tmp coronium-enrol.json || exit; }
[ -s coronium-device.json ] || {
  curl -sS -b coronium.cookies -H 'Content-Type: application/json' -d @- "$SUPPLY/app/api/devices" < coronium-enrol.json -o coronium-device.tmp
  jq -e 'has("deviceSecret")' coronium-device.tmp >/dev/null && mv coronium-device.tmp coronium-device.json || { jq '{code, cause, fix, deviceId}' coronium-device.tmp; exit 1; }
}
jq '{deviceId, relay, state}' coronium-device.json
```

Expect: `deviceId`, `relay` and `state` `new`; the file also holds `deviceSecret`, shown this once. A refusal prints its code, cause and fix and keeps no device file; act on `fix` and repeat: `agreement_unsigned` (step 3), `device_cap_reached` (the account holds `terms.deviceLimit` of `GET /app/api/earnings`), `enrolment_repeated` (this `requestId` enrolled `deviceId` already and its secret is gone: withdraw it, delete `coronium-enrol.json`, enrol again). Safe to repeat: yes; one `requestId` enrols once. For a second device, in this same folder, first move `coronium-enrol.json` and `coronium-device.json` aside.

5. Write the settings file.

```sh
umask 077
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
jq -er 'if (.relay and .deviceId and .deviceSecret) then "CORONIUM_RELAY=\(.relay)\nCORONIUM_DEVICE=\(.deviceId)\nCORONIUM_DEVICE_SECRET=\(.deviceSecret)" else error("no relay, device or secret in coronium-device.json") end' coronium-device.json > agent.env.tmp && mv agent.env.tmp agent.env
```

Expect: no output; `cut -d= -f1 agent.env` prints the three names. A null `relay` means ask the operator. Safe to repeat: yes.

## Then

[Choose and check the agent file](/guides/device-files.md), run it one way, and [read the device's state](/guides/device-states.md). Tell the person sharing the device [what it refuses](/guides/device-states.md#what-a-device-refuses).

This page: https://supply.coronium.ai/guides/device-files.md.

# Choose and check the agent file

Calls go to https://supply.coronium.ai. `/kit/index.json` lists what this server publishes now, with `"schema": 2`: stop on another number or none. Each file has `name`, `sha256`, `bytes`, `way`, `os`, `arch`, `kind`, `state`, `checked` and `limits`.

## Steps

1. Pick a file by `os`, `arch` and `kind`. `uname -m` prints `x86_64` for `amd64`, `aarch64` or `arm64` for `arm64`, `armv7l` for `armv7` and `armv6l` for `armv6`. A MIPS router prints `mips` either way: take `mipsle` when its firmware names a little-endian architecture such as `mipsel_24kc`. `kind` is `kit` for the Linux kit, `docker` for the image, `binary` for the program alone, and `install` and `uninstall` for the scripts that make the program a service on macOS and Windows and remove it, whose `arch` is `any`.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
curl -fsS "$SUPPLY/kit/index.json" -o coronium-kit.json
jq -r '.files[] | select(.os == "linux" and .arch == "amd64") | "\(.name) \(.kind) \(.state) \(.limits | join(","))"' coronium-kit.json
```

Expect: one line per file of that system. Only a `preview` file needs the owner's yes, to its state and each of its `limits`, whatever `checked` reads. Safe to repeat: yes.

2. Download the file and check it against the list.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
FILE=coronium-agent-linux-amd64
curl -fsSLO "$SUPPLY/kit/$FILE"
jq -r --arg f "$FILE" '.files[] | select(.name == $f) | "\(.sha256)  \(.name)"' coronium-kit.json | sha256sum -c
```

Expect: `coronium-agent-linux-amd64: OK`; stop on anything else. Nothing is signed yet: the list is as trustworthy as its HTTPS connection. Safe to repeat: yes.

## Then

Linux with systemd and a person at its terminal: [the Linux kit](/guides/device-linux-kit.md). A Docker host: [the image](/guides/device-docker.md). A service on [macOS](/guides/device-macos.md) or [Windows](/guides/device-windows.md): its installer. Anything else, a container among them, or no person at the terminal: [the program alone](/guides/device-program.md).

## Every file

The table is the next build's.

<!-- facts:begin kit.files -->
| Way | `os` | `arch` | `kind` | `state` | `limits` |
|---|---|---|---|---|---|
| Linux agent kit | `linux` | `amd64` | `kit` | `available` | `system_ca_roots_required` |
| Docker image | `linux` | `amd64` | `docker` | `available` | `not_run_by_coronium` |
| Linux agent kit | `linux` | `amd64` | `binary` | `available` | `system_ca_roots_required` |
| Linux agent kit | `linux` | `arm64` | `kit` | `available` | `not_run_by_coronium`, `system_ca_roots_required` |
| Docker image | `linux` | `arm64` | `docker` | `available` | `not_run_by_coronium` |
| Linux agent kit | `linux` | `arm64` | `binary` | `available` | `not_run_by_coronium`, `system_ca_roots_required` |
| Linux agent kit | `linux` | `armv7` | `binary` | `preview` | `not_run_by_coronium`, `system_ca_roots_required` |
| Linux agent kit | `linux` | `armv6` | `binary` | `preview` | `not_run_by_coronium`, `system_ca_roots_required` |
| Linux agent kit | `linux` | `riscv64` | `binary` | `preview` | `not_run_by_coronium`, `system_ca_roots_required` |
| Routers | `linux` | `mips` | `binary` | `preview` | `not_run_by_coronium`, `no_installer`, `system_ca_roots_required`, `large_for_small_flash` |
| Routers | `linux` | `mipsle` | `binary` | `preview` | `not_run_by_coronium`, `no_installer`, `system_ca_roots_required`, `large_for_small_flash` |
| Windows | `windows` | `amd64` | `binary` | `available` | `not_run_by_coronium`, `unsigned` |
| Windows | `windows` | `arm64` | `binary` | `available` | `not_run_by_coronium`, `unsigned` |
| Windows | `windows` | `any` | `install` | `available` | `not_run_by_coronium`, `unsigned`, `starts_at_login` |
| Windows | `windows` | `any` | `uninstall` | `available` | `not_run_by_coronium`, `unsigned` |
| macOS | `darwin` | `arm64` | `binary` | `preview` | `not_run_by_coronium`, `unsigned` |
| macOS | `darwin` | `any` | `install` | `preview` | `not_run_by_coronium`, `starts_at_login` |
| macOS | `darwin` | `any` | `uninstall` | `preview` | `not_run_by_coronium` |
| Android app SDK | `android` | `arm64_x86_64` | `aar` | `preview` | `sharing_apps_only`, `notice_proposed`, `container_run_only` |
<!-- facts:end kit.files -->

What Coronium observed of each file: [the program alone](/guides/device-program.md), Each system.

`version` is the published agent's. `GET /app/api/devices` returns, as `agent`, the name each device's agent gave its relay, such as `agent/0.1.0`, or null when its relay reported none. A name states a version, not a build: two builds of one version read the same.

<!-- facts:begin kit.words -->
States:

- `available`: Coronium took this exact file through its whole check on this system: digest checked, started by the published steps, connected to the relay, one billed request with bytes billed equal to bytes carried, then stopped and removed by the published steps. `checked` is the day of that record when it holds this file's SHA-256, and null otherwise. A file that also carries `not_run_by_coronium` is available by the owner's decision, without that check.
- `preview`: Built for this system, its header read back from its bytes, and not yet through that whole check here. Use it only when the device's owner accepts that and each of its limits.
- `not_available`: There is no file for this way. The way names its reason.

Limits:

- `not_run_by_coronium`: No run of this file on this system is recorded against its row.
- `unsigned`: Not code-signed: the system may warn about it or block it.
- `no_installer`: No installer and no service: you start it from a shell.
- `starts_at_login`: Its service belongs to one user and starts when that user logs in, not when the machine starts: after a restart it is back once that user has logged in.
- `system_ca_roots_required`: Needs the system's certificate roots (the ca-certificates package), which minimal, container and router images often lack. The Docker image carries its own.
- `large_for_small_flash`: Large for a router with 8 to 16 MB of flash.
- `sharing_apps_only`: Only for an app whose stated main purpose is sharing its user's connection, in a store that allows that or given out directly. A store allows proxying for others at most as an app's own purpose, and one forbids it outright: never inside a game, a utility or any other app.
- `notice_proposed`: The notice the library shows its user is proposed and not yet approved: the supply site enrols no device under it, and in an app that is not debuggable the library opens no consent screen.
- `container_run_only`: Run end to end on a development Android instance only, never on a phone: an ARM64 phone, real charging, the system's battery limits and mobile networks are not yet checked.

Reasons a way has no file:

- `platform_policy`: The platform's review rules allow background services only for listed purposes, and a proxy is not one. None is planned.
- `not_built`: Not built, or this build left its files out.
<!-- facts:end kit.words -->

A sharing kit inside another developer's product is not built.

This page: https://supply.coronium.ai/guides/device-linux-kit.md.

# Run it with the Linux kit

The kit installs the agent as a systemd service, after checking every file and showing the partner agreement. Calls go to https://supply.coronium.ai. The kit carries these same steps in its `README.md`.

<!-- facts:begin part.linux-kit -->
## Needs

- Linux on x86-64 or ARM64, root through `sudo`, and `curl` and `sha256sum`.
- The system's certificate roots, which minimal and container images leave out: `sudo apt-get install -y ca-certificates` on Debian and Ubuntu, `sudo apk add ca-certificates` on Alpine, `sudo dnf install -y ca-certificates` on Fedora and RHEL.
- Outbound TCP to the relay. No inbound port.
- From the device's enrolment at https://supply.coronium.ai/farmer or through the API: the relay `host:port`, the device id, the device secret, and the agreement digest shown for the device, which is the `sha256` of the text the account signed.
- The kit digest: the line for `coronium-agent-linux-<arch>/SHA256SUMS` in https://supply.coronium.ai/kit/SHA256SUMS, which the farmer portal also shows.
- A person at the device's terminal: the installer shows the partner agreement and asks them to type it. An agent hands this step to its person, or runs the program alone instead.

## Steps

1. Download and check the kit as your normal user, before anything runs as root. Every block works in one folder, `~/coronium` unless `CORONIUM_DIR` names another. `ARCH` is `amd64` when `uname -m` prints `x86_64`, and `arm64` for `aarch64`.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
mkdir -p "${CORONIUM_DIR:-$HOME/coronium}"
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
ARCH=amd64
curl -fsSLO "$SUPPLY/kit/SHA256SUMS"
curl -fsSLO "$SUPPLY/kit/coronium-agent-linux-$ARCH.tar.gz"
grep " coronium-agent-linux-$ARCH.tar.gz\$" SHA256SUMS | sha256sum -c
tar -xzf "coronium-agent-linux-$ARCH.tar.gz"
grep " coronium-agent-linux-$ARCH/SHA256SUMS\$" SHA256SUMS | sha256sum -c
(cd "coronium-agent-linux-$ARCH" && sha256sum -c SHA256SUMS)
```

Expect: every line ends `OK`. If one does not, stop and write to the contact in `PARTNER-AGREEMENT.md`. Nothing is signed yet: the digests are only as trustworthy as the site they came from. Safe to repeat: yes.

2. Install, from the kit's folder. Without systemd, add `--no-systemd`: the installer then prints one command that runs the agent in the foreground as the user `nobody`, and nothing starts it after a reboot.

```sh
umask 077
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
cd coronium-agent-linux-*/ && sudo ./install.sh
```

Expect: `Installed.` and the consent record, which holds no secret. The settings go to `/etc/coronium-agent/agent.env`, readable by root only. If refused: `no_certificate_roots` (install the roots above), `kit_digest_mismatch` (download the kit again), `agreement_not_accepted` (the kit's agreement is not the text the account signed: sign the text in force, then enrol), `consent_not_given`, `bad_relay`, `bad_device_id` or `bad_secret` (run it again with the right value), `no_systemd` (add `--no-systemd`), `wrong_architecture`, `checksum_mismatch` or `consent_draft` (get a new kit). Safe to repeat: yes, and it keeps the settings.

3. Check.

```sh
umask 077
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
systemctl is-active coronium-agent
journalctl -u coronium-agent -n 20 --no-pager
```

Expect: `active` and `connected to the relay`. A problem is one log line with its cause and its fix, and the agent dials again by itself. If its settings are refused five times in five minutes the service stops: fix the cause, then `sudo systemctl restart coronium-agent`.

## Stop and remove

Stop, remove, withdraw: https://supply.coronium.ai/guides/device-lifecycle.md.
<!-- facts:end part.linux-kit -->

## If it is not connected

```sh
umask 077
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
sudo systemctl enable --now coronium-agent
sudo systemctl restart coronium-agent
journalctl -u coronium-agent -n 5 --no-pager
```

The first line starts a service that was stopped or disabled; the second starts one that gave up after refused settings; the third shows why it is not connected, if it is not.

## Update

`/kit/index.json` names the published `version`, and publishing a newer agent does not stop one that is running. To update, download and check the new kit as in step 1 and run its installer as in step 2. It checks every file of the kit again and asks for the two digests and your agreement before it replaces the program, keeps `/etc/coronium-agent/agent.env`, and starts the service again. Then check as in step 3. When a check fails, nothing is replaced.

This page: https://supply.coronium.ai/guides/device-docker.md.

# Run it in a container

The image runs the agent as user 65534, not as root, on a read-only filesystem, with no shell and no installer. It carries certificate roots of its own. Calls go to https://supply.coronium.ai.

## Needs

- Docker on Linux, outbound TCP to the relay, and no inbound port.
- `agent.env` from [enrolment](/guides/device-enrol.md), in the folder every block works in: `~/coronium` unless `CORONIUM_DIR` names another. A person who has none yet makes it there with `touch agent.env && chmod 600 agent.env`, then writes three lines into it in an editor, such as `nano agent.env`: `CORONIUM_RELAY=us1.almanac.channel:17001`, `CORONIUM_DEVICE=<device id>` and `CORONIUM_DEVICE_SECRET=<device secret>`, without quotes and never on a command line.
- One container per public address: when an earlier residential device already exits from that address, the later one is withheld as `same_exit`.

No installer shows the agreement here, so the signature and the acceptance stored at enrolment are its record.

## Steps

1. Download, check and load the image. `ARCH` is `amd64` for `x86_64` and `arm64` for `aarch64`.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
mkdir -p "${CORONIUM_DIR:-$HOME/coronium}"
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
ARCH=amd64
curl -fsSLO "$SUPPLY/kit/SHA256SUMS"
curl -fsSLO "$SUPPLY/kit/coronium-agent-docker-$ARCH.tar"
grep " coronium-agent-docker-$ARCH.tar\$" SHA256SUMS | sha256sum -c
docker load -i "coronium-agent-docker-$ARCH.tar"
curl -fsS "$SUPPLY/kit/index.json" | jq -r .version > coronium-version.txt
```

Expect: `OK`, then `Loaded image: coronium-agent:<version>`, with the version `coronium-version.txt` now holds. Stop if the check fails. Safe to repeat: yes.

2. Run it, beside `agent.env`.

```sh
umask 077
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
VERSION=$(cat coronium-version.txt)
chmod 600 agent.env
docker run -d --name coronium-agent --restart unless-stopped --read-only \
  --cap-drop ALL --security-opt no-new-privileges --env-file agent.env "coronium-agent:$VERSION"
for second in $(seq 20); do docker logs coronium-agent 2>&1 | grep -q 'connected to the relay' && break; sleep 1; done
docker logs -n 20 coronium-agent
```

Expect: `connected to the relay`, once the agent has connected: the block waits for that line for a short while before it prints the log. A problem is one line with its cause and its fix. The agent does not retry a refused setting: Docker starts it again with a growing pause until the file is fixed. Docker reads `agent.env` only when it creates the container, so after a change run `docker rm -f coronium-agent` and this step again. Safe to repeat: after `docker rm -f coronium-agent` only; Docker refuses a second container of the same name.

## If it is not connected

```sh
umask 077
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
docker start coronium-agent
docker logs -n 5 coronium-agent
```

The first line starts a container that stopped; the second shows why it is not connected, if it is not. With `--restart unless-stopped` Docker starts it again after a restart of the machine, unless you stopped it yourself.

## Update

`/kit/index.json` names the published `version`, and publishing a newer image does not stop a container that is running. To update, run step 1 again, which checks the new image before it is loaded, then `docker rm -f coronium-agent` and step 2. `agent.env` stays as it is. `docker rmi coronium-agent:<old version>` removes the image it replaced.

## Stop and remove

Stop, remove, withdraw: [update, stop, remove and withdraw](/guides/device-lifecycle.md).

This page: https://supply.coronium.ai/guides/device-program.md.

# Run the program alone

The program alone is built for Linux, Windows, macOS and routers; the state and limits of each file and what Coronium observed of it are listed below, under Each system. Started this way it has no service: a shell starts it detached, with the three settings of `agent.env` in its environment, never as arguments, and never as root, and nothing starts it again unless a supervisor of your own does. A published installer makes it a service on [macOS](/guides/device-macos.md) and on [Windows](/guides/device-windows.md), and on Linux with systemd [the kit](/guides/device-linux-kit.md) does. Calls go to https://supply.coronium.ai.

## Needs

- The file for the system, checked as in [the files section](/guides/device-files.md), and `agent.env` from [enrolment](/guides/device-enrol.md), both in the folder every block works in: `~/coronium` unless `CORONIUM_DIR` names another.
- Outbound TCP to the relay, no inbound port, and one device per public address.
- On Linux and routers, the system's certificate roots: without them the program logs that the system has none, with the package to install. Windows and macOS check the relay's certificate with their own store.

## Steps

1. Start it. On Linux, macOS and routers, put the file's name in `FILE`:

```sh
umask 077
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
FILE=coronium-agent-linux-amd64
chmod 0755 "$FILE"
RUN="$PWD/$FILE"
AS=""
if [ "$(id -u)" = 0 ]; then
  id coronium-agent >/dev/null 2>&1 || useradd --system --no-create-home --shell /usr/sbin/nologin coronium-agent 2>/dev/null || adduser -S -D -H -s /sbin/nologin coronium-agent || { echo "no_service_user: the user coronium-agent could not be made. Fix: make it with the system's own tool, then run this again"; exit 1; }
  mkdir -p /opt/coronium && cp "$FILE" /opt/coronium/coronium-agent && chmod 0755 /opt/coronium /opt/coronium/coronium-agent
  RUN=/opt/coronium/coronium-agent
  AS=coronium-agent
fi
(set -a; . ./agent.env; set +a
  if [ -n "$AS" ]; then exec nohup su -s /bin/sh "$AS" -c "exec $RUN"; else exec nohup "$RUN"; fi >>coronium-agent.log 2>&1 </dev/null &
  echo $! >coronium-agent.pid)
sleep 5; tail -n 1 coronium-agent.log
```

It runs detached, with its log in `coronium-agent.log`, and `kill "$(cat coronium-agent.pid)"`, in the working folder, stops it. From a root shell, such as a server's console or a container without systemd, it does not run as root: the block makes a system user of its own, `coronium-agent`, or stops where the system has no tool that makes one, as on many routers, puts the program in `/opt/coronium` and runs it as that user, so no other user's process reads the settings in its environment; `agent.env` and the log stay with root.

On Windows, in PowerShell, in the folder of the file and `agent.env`:

```powershell
Get-Content agent.env | ForEach-Object { $name, $value = $_ -split '=', 2; Set-Item "env:$name" $value }
.\coronium-agent-windows-amd64.exe
```

Expect: `connected to the relay`. Each problem is one line, `not connected: <cause>. Fix: <fix>. Dialing again in <time>`, and the program dials again by itself after a lost connection. A setting it refuses ends it with exit status 2 and `<code>: <cause>. Fix: <fix>`: `bad_relay`, `bad_device_id` or `bad_secret` means `agent.env` is wrong. Safe to repeat: once it is stopped; a second copy with the same settings replaces the first at the relay.

2. Know each system's limits, which `/kit/index.json` lists for each file.

- Windows and macOS: the file has no code signature, so the system may warn about it or block a copy a browser downloaded; a copy fetched with curl carries no download mark.
- Routers: copy the file to the router, and check that it has certificate roots, room in flash and memory, and a clock set by NTP, because a router that boots with its clock in the past fails the certificate check until the time is set. A router's memory, flash, resolver and clock are not measured by Coronium yet.

## Each system

The next build's state and limits of the program's files; `/kit/index.json` speaks for what this server publishes now:

<!-- facts:begin kit.program -->
- `linux` on `amd64`: `available`; limits `system_ca_roots_required`.
- `linux` on `arm64`: `available`; limits `not_run_by_coronium`, `system_ca_roots_required`.
- `linux` on `armv7`, `armv6`, `riscv64`: `preview`; limits `not_run_by_coronium`, `system_ca_roots_required`.
- `linux` on `mips`, `mipsle`: `preview`; limits `not_run_by_coronium`, `no_installer`, `system_ca_roots_required`, `large_for_small_flash`.
- `windows` on `amd64`, `arm64`: `available`; limits `not_run_by_coronium`, `unsigned`.
- `darwin` on `arm64`: `preview`; limits `not_run_by_coronium`, `unsigned`.
<!-- facts:end kit.program -->

What Coronium observed of each published file, the kit and the image included. A dated note speaks only for the digest it names:

- Linux `amd64` kit and program: two runs of two earlier builds, one that installed, started and removed the kit and one that carried a billed request. No run of a published file.
- Docker `amd64`, digest `bd501040b7432344`: on 26 November 2026, connected, measured and withheld as a data-centre network. No billed request.
- Windows `amd64` and `arm64`, digests `e2a3557e46c9e546` and `5ca66a8dec3becd9`: on 26 November 2026, started on hosted virtual machines of their architecture and reached the relay's refusal of an unknown device. Never enrolled.
- macOS `arm64`, digest `2b24631d8079012d`: on 29 November 2026, set up by hand on a Mac on a home line as the launchd user agent the installer writes, with that program. It connected, and its device, measured and admitted on an earlier day under an earlier build, read admitted and routable. No billed request, and the installer itself was not run. An earlier build, digest `c739273a9de679a3`, ran once on 26 November 2026: connected, measured and withheld as an unclassified network.
- Linux `arm64`, `armv7`, `armv6`, `riscv64` and both router files: run only under emulation, which is not a run on that system.

## If it is not connected

Nothing starts the program alone again: after a restart of the machine, or when it ended, run step 1 again, or give it a supervisor that does. `tail -n 5 coronium-agent.log`, in the working folder, shows why it is not connected.

## Update

`/kit/index.json` names the published `version`, and publishing a newer agent does not stop one that is running. To update, download and check the new file as in [the files section](/guides/device-files.md), stop the running program, put the new file in its place and start it as before. `agent.env` stays as it is.

## Stop and remove

Stop, remove, withdraw: [update, stop, remove and withdraw](/guides/device-lifecycle.md).

This page: https://supply.coronium.ai/guides/device-states.md.

# Device states, earnings and payouts

Calls go to https://supply.coronium.ai, signed in as in [enrolment](/guides/device-enrol.md).

## Steps

1. Read the devices once a minute until the new one is measured.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
curl -sS -b coronium.cookies "$SUPPLY/app/api/devices" | jq -c 'if .code then {code, cause, fix} else .devices[] | {deviceId, status, state, reason} end'
```

Expect: `online` once the agent connects. Then act on `state` and `reason`:

| Reads | Means | Do |
|---|---|---|
| `status` `offline` | the agent is not connected | unless you stopped it, its log says why: [troubleshooting](/guides/device-troubleshoot.md) |
| `new`, `not_measured` | connected, not measured yet | read again a minute later |
| `withheld`, `unclassified_asn` | the network is not classified yet | nothing: leave it running, tell your person, do not enrol again |
| `withheld`, `class_not_sold` | a network Coronium does not sell, such as a data centre | stop it: it earns nothing. Do not enrol again from this network |
| `withheld`, `same_exit` | an earlier residential device, of any account, exits from this address | move it to a connection of its own, or stop it |
| `withheld`, `exit_unverified` or `exit_changed` | three measurements in a row failed, or the country changed | keep it running: it is measured again |
| `withheld`, `supplier_blocked` | the operator blocked the account | tell your person |
| `admitted` | carries buyer traffic as fallback supply | done |
| `established` | carries traffic first, after the operator promoted it on a clean history | done |
| `paused`, `private` | the account's own choice | nothing, unless your person asks |
| `withdrawn` | permanent | a new enrolment, if your person wants one |

`requests`, `bytesUp` and `bytesDown` include Coronium's own exit measurements, which earn nothing. Safe to repeat: yes.

`health` says whether a device still carries traffic: [device health](/guides/device-health.md).

2. Read the statement.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
curl -sS -b coronium.cookies "$SUPPLY/app/api/earnings" | jq '{earned, held, available, requested, paid, payoutMinimumUsdMicros, terms}'
```

Expect: the totals and `terms`; [the statement and a payout](/guides/device-payouts.md) explains each field. Safe to repeat: yes.

<!-- facts:begin payout.day -->
Payouts are paid by hand on the 6th of each month, for requests received before it; later ones the next month.
<!-- facts:end payout.day -->

3. Ask for a payout, only with your person's word: [the block](/guides/device-payouts.md).

## What a device refuses

<!-- facts:begin part.device-refuses -->
Beside the ranges the protocol forbids, a device never dials what its system shows of its own network: its own addresses as its interfaces show them, its default gateway (the home router), any address on the links of its interfaces, and any of these behind a NAT64 prefix that the protocol or its resolver names. Such a target is answered `target_blocked`. What the system does not show is not refused yet: the public address of a router in front of the device, which the device does not know, and a target behind a NAT64 prefix that only the router announces. When the device cannot tell whether an IPv6 target is safe (it cannot read its interfaces, its resolver failed on `ipv4only.arpa` or synthesizes in a form it cannot read, or an IPv6 address of the device has no on-link prefix it can read), it carries IPv4 only, answers a target with no IPv4 address `unreachable`, and its log says why. Nothing to do.
<!-- facts:end part.device-refuses -->

## Stop and withdraw

Stopping the agent stops sharing; withdrawal is for good. [Update, stop, remove and withdraw](/guides/device-lifecycle.md) has the one answer for each. `reason` says who withdrew:

<!-- facts:begin withdrawn.reasons -->
- `user`: the device's own secret: in an app, its user's no
- `account`: the account, signed in
- `token`: a revoke of the token that enrolled it
- `fleet`: Coronium, for the whole account
- `owner`: Coronium, for this device, or an older withdrawal
<!-- facts:end withdrawn.reasons -->

This page: https://supply.coronium.ai/guides/device-payouts.md.

# The statement and a payout

Calls go to https://supply.coronium.ai, signed in as in [enrolment](/guides/device-enrol.md), in the folder its step 1 made. The blocks use curl and jq and keep every answer in a file only you can read. [Device states](/guides/device-states.md) says what each state means and when a payout is paid.

The statement the partner agreement names is `GET /app/api/earnings`: the lines of one month, the totals and the terms in force. The buyer's statement, `GET /app/api/billing/statement`, is another read and says nothing about a device.

## Steps

1. Read the statement.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
curl -sS -b coronium.cookies "$SUPPLY/app/api/earnings" -o coronium-earnings.json
jq 'if .code then {code, cause, fix} else {month, earned: .earned.usdMicros, held: .held.usdMicros, available: .available.usdMicros, requested: .requested.usdMicros, paid: .paid.usdMicros, payoutMinimumUsdMicros, terms} end' coronium-earnings.json
```

Expect: this month's totals and `terms`. For another month add `?month=YYYY-MM` to the address. If it prints a `code`, do what its `fix` names: `sign_in_required` means sign in again, as step 1 of enrolment does. Safe to repeat: yes.

What the answer holds:

- An amount is an object: `usdMicros`, whole micro-USD as a decimal string, and `n`, the exact units, of which `nPerUsdMicro` make one micro-USD.
- `lines`: one line for each `day`, `deviceId`, `country` and `shareBp`, with `bytesUp` and `bytesDown`, `buyersPaid`, `earned`, `releaseOn` and `voided`.
- `buyersPaid` is what buyers paid for the traffic that device carried that day, and `shareBp` is the share of it in basis points: `earned` and `voided` together are `buyersPaid` times `shareBp` over `10000`. The share applies to nothing else. `voided` is the part Coronium voided while it was still held, which is never paid. Free grants, unpaid traffic and an account's own traffic earn nothing, and so do Coronium's own exit measurements.
- `releaseOn` is the day a line's amount leaves `held` and joins `available`: `terms.holdDays` after the day the ledger recorded it.
- `earned`, `held`, `available`, `requested` and `paid` are the totals: everything earned, the part still held, the part a payout may ask for, the part asked for and waiting, and the part paid.
- `terms.standing` is `new`, `established` or `operator`, and sets `holdDays` and `shareBp`. `terms.deviceLimit` is how many devices the account may hold that are not withdrawn, or null without a limit.
- `payoutMinimumUsdMicros` is the least a payout may ask for.

<!-- facts:begin part.earns -->
While `terms.charging` of `GET /app/api/earnings` is false, buyers are not charged, `terms.shareBp` is null and traffic earns nothing.
<!-- facts:end part.earns -->

2. Work out what one GB would earn, from the two reads that state it. Derived, and an estimate only: the statement's `earned` is the amount.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
curl -sS "$SUPPLY/app/api/prices" -o coronium-prices.json
jq -r --slurpfile e coronium-earnings.json '($e[0].terms.shareBp // 0) as $share | .tiers[] | ((.usdMicrosPerGb | tonumber) * $share / 10000 | floor) as $earns | "tier \(.tier) \(.name): buyers pay \(.usdMicrosPerGb) micro-USD a GB; at shareBp \($share) a device earns \($earns) micro-USD a GB"' coronium-prices.json
```

Expect: one line for each price tier. A buyer pays the price of the tier of the exit country, which `countries` of each tier lists, so a device earns `shareBp` of that price for each GB of paid buyer traffic it carried. A device that is not `admitted` or `established` carries none, whatever the line reads. Safe to repeat: yes.

3. Read the devices the statement counts.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
curl -sS -b coronium.cookies "$SUPPLY/app/api/devices?limit=50" -o coronium-devices.json
jq -c 'if .code then {code, cause, fix} else .devices[] | {deviceId, status, state, reason, requests, bytesUp, bytesDown} end' coronium-devices.json
```

Expect: one line for each device. `requests`, `bytesUp` and `bytesDown` include Coronium's own exit measurements, which earn nothing. A longer list answers `nextCursor`: send it back as `cursor`. `counts` holds the devices by state. Safe to repeat: yes.

4. Read the payout requests of the account.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
curl -sS -b coronium.cookies "$SUPPLY/app/api/payouts" | jq -c 'if .code then {code, cause, fix} else .payouts[] | {payoutId, usdMicros, payTo, state, requestedAt, decidedAt, reason} end'
```

Expect: nothing for an account that never asked, else one line for each request, newest first. Safe to repeat: yes.

5. Ask for a payout. Only your person decides this: the amount, the asset, the network and the address are theirs, and a payment to a wrong address is not taken back. They write `coronium-payout.json` as `{"usdMicros": "<the amount>", "asset": "USDC", "network": "<the network of the address>", "address": "<the address>"}`. `asset` is `USDC` or `USDT`. The amount is whole cents, a multiple of `10000`, at least `payoutMinimumUsdMicros` and at most `available.usdMicros` of step 1.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
[ -s coronium-payout-request.json ] || { jq -c --arg id "$(od -An -tx1 -N8 /dev/urandom | tr -d ' \n')" --slurpfile a coronium-account.json '. + {requestId: $id, proof: {code: $a[0].accessCode}}' coronium-payout.json > coronium-payout-request.tmp && mv coronium-payout-request.tmp coronium-payout-request.json || exit; }
curl -sS -b coronium.cookies -H 'Content-Type: application/json' -d @- "$SUPPLY/app/api/payouts" < coronium-payout-request.json | jq '{outcome, usdMicros, state, payTo, code, cause, fix}'
```

Expect: `state` `requested` and `payTo`, the one line the operator pays from. `coronium-payout-request.json` holds the access code: delete it once the answer reads `requested`. If refused, do what `fix` names: `proof_required` (the access code in `coronium-account.json` is not the current one), `not_whole_cents`, `below_minimum` or `nothing_available` (correct the amount in `coronium-payout.json`, delete `coronium-payout-request.json`, repeat), `payout_pending` (one request waits at a time: read step 4), `buyer_in_debt` (the account owes for traffic it sent as a buyer: your person adds funds on the buyer site), `amount_changed` (this `requestId` was sent with other values: delete `coronium-payout-request.json` for a new request). Safe to repeat: yes, with the same file; one `requestId` asks once.

This page: https://supply.coronium.ai/guides/device-lifecycle.md.

# Update, stop, remove and withdraw

Four different things, each with one answer. Updating replaces the program and keeps the device. Stopping ends sharing until you start it again. Removing deletes the files from the machine. Withdrawing ends the device at Coronium for good. None of them does another's work: a removed agent is still an enrolled device, and a withdrawn device still has its files.

Calls go to https://supply.coronium.ai, signed in as in [enrolment](/guides/device-enrol.md), in the folder its step 1 made.

## Update

`/kit/index.json` speaks for the one release this server publishes now. The file names carry no version and a new build replaces the files in place. The agent never downloads or replaces itself. An installed agent keeps working: a relay refuses only a protocol version it no longer speaks, and the agent's log then says so. You learn of a new build by reading the list.

A release states:

- `version`: the version of the agent in every file.
- `files`: each file's `sha256`, `bytes`, `state`, `checked` and `limits`, as [the agent files](/guides/device-files.md) explains.
- `signature`: the signature over the list, or null. While it is null nothing is signed, and a digest is as trustworthy as the HTTPS connection it came over. [The signing contract](/kit/SIGNING.md) says what a signature covers.
- `agreement`: the `version` and `sha256` of the partner agreement the kit carries.

1. Compare what is published with what you installed.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
curl -fsS "$SUPPLY/kit/index.json" -o coronium-kit.next.json
jq '{schema, version, signature, agreement}' coronium-kit.next.json
[ -e coronium-kit.json ] || cp coronium-kit.next.json coronium-kit.json
jq -r '.files[] | "\(.name) \(.sha256)"' coronium-kit.json | sort > coronium-installed.txt
jq -r '.files[] | "\(.name) \(.sha256)"' coronium-kit.next.json | sort | comm -13 coronium-installed.txt -
```

Expect: `"schema": 2`, the version, then one line for each file whose digest changed since `coronium-kit.json` was saved, which [the files section](/guides/device-files.md) does when you choose a file. No line: the file you run is the file published, and there is nothing to do. Safe to repeat: yes.

2. Decide. Take a changed file only when its `state` and each of its `limits` are ones the device's owner accepts. If `agreement` no longer names the text the account signed, read and sign the text in force first, as [enrolment](/guides/device-enrol.md) steps 2 and 3 do.

3. Replace the program the way it was installed. The device keeps its id and its secret: do not enrol again. Stop the old copy before the new one starts, because one device id takes one agent.

- The Linux kit: download and check the new kit as [its guide](/guides/device-linux-kit.md) does, then run its installer again in the new kit's folder, with a person at the terminal as the first time. It keeps the settings, replaces the program and, with systemd, starts the service again.
- A container: load the new image as [its guide](/guides/device-docker.md) does, stop and remove the old container, and run the new one with the same `agent.env`.
- The program alone: download and check the new file as [the files section](/guides/device-files.md) does, stop the running program, put the new file in its place, and start it as [its guide](/guides/device-program.md) does, with the same `agent.env`.

4. Check, then keep the new list as the installed one.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
curl -sS -b coronium.cookies "$SUPPLY/app/api/devices" | jq -c 'if .code then {code, cause, fix} else .devices[] | {deviceId, status, state, reason} end'
mv coronium-kit.next.json coronium-kit.json
```

Expect: the log reads `connected to the relay` and the device reads `status` `online`, in the state it had. Any other line of the log is in [troubleshooting](/guides/device-troubleshoot.md). Safe to repeat: yes.

## Stop

Stopping the agent stops sharing, and the device keeps its place: start it and it serves again.

| How it runs | Stop | Start again |
|---|---|---|
| The Linux kit, with systemd | `sudo systemctl disable --now coronium-agent` | `sudo systemctl enable --now coronium-agent` |
| A container | `docker stop coronium-agent` | `docker start coronium-agent` |
| The program alone | end its process, with Ctrl-C or `kill` and its process id | start it again as [its guide](/guides/device-program.md) does |

After a stop the device reads `status` `offline` within a few reads, and its log names no cause, because nothing failed.

## Remove

Stop it first. Then, the way it was installed:

- The Linux kit: `sudo ./uninstall.sh` in the kit's folder removes the service, the program, its user and `/etc/coronium-agent` with the secret. It warns, with the process id, about an agent you started yourself, which it does not stop.
- The program alone: delete the program's file, `agent.env` and `coronium-device.json`.
- A container: the container, the two files that hold the secret, and the image:

```sh
umask 077
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
VERSION=$(cat coronium-version.txt)
docker rm -f coronium-agent
rm -f agent.env coronium-device.json
docker rmi "coronium-agent:$VERSION"
```

`agent.env` and `coronium-device.json` hold the device's secret. Once they are gone nobody can run this device again, and the device is still enrolled: withdraw it if it is not coming back.

## Withdraw

Withdrawal is for good, and only your person decides it: a withdrawn device never connects or enrols again, relays refuse it (a connection already open stays until it ends), and what it earned stays as recorded. The account withdraws its own device with one call, whose body is `{"confirm": true}`.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
DEVICE=$(jq -r .deviceId coronium-device.json)
printf '{"confirm": true}' | curl -sS -b coronium.cookies -H 'Content-Type: application/json' -d @- "$SUPPLY/app/api/devices/$DEVICE/withdraw" | jq '{outcome, deviceId, state, reason, withdrawnAt, code, cause, fix}'
```

Expect: `state` `withdrawn` and `reason` `account`; a repeat answers `already_applied`. For another device, set `DEVICE` to its `deviceId` from `GET /app/api/devices`. If refused: `device_not_found` (the id is not a device of this account), `confirmation_required` (send `confirm` as true), `sign_in_required` (sign in again). Then stop and remove the agent as above. Safe to repeat: yes.

A device with no session withdraws itself with its own secret, the `CORONIUM_DEVICE_SECRET` line of `agent.env`, sent as a Bearer header on curl's standard input, never kept in a file of its own, and with no cookie. The reason stored is `user`.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
id=$(sed -n 's/^CORONIUM_DEVICE=//p' agent.env)
sed -n 's/^CORONIUM_DEVICE_SECRET=/Authorization: Bearer /p' agent.env | curl -sS -H @- -H 'Content-Type: application/json' -d '{"confirm": true}' "$SUPPLY/app/api/devices/$id/self/withdraw" | jq '{outcome, deviceId, state, reason, withdrawnAt, code, cause, fix}'
```

Expect: `state` `withdrawn` and `reason` `user`. `GET /app/api/devices/{deviceId}/self` with the same header reads the device's own state without changing it. A wrong id or secret answers `device_not_found`, and many of them from one address answer `rate_limited` with `retryAt`.

When neither can be done, because the access code and the device's secret are both lost, Coronium withdraws the device on request:

<!-- facts:begin supply.contact -->
The one contact for device owners is support@coronium.ai: a question, more devices, or a withdrawal the account cannot make itself.
<!-- facts:end supply.contact -->

## Sign out

Signing out ends this session: the device keeps running and the account keeps its devices. Sign in again as [enrolment](/guides/device-enrol.md) does.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
curl -sS -b coronium.cookies -c coronium.cookies -H 'Content-Type: application/json' -d '{}' "$SUPPLY/app/api/logout" | jq '{signedIn, code, cause, fix}'
```

Expect: `"signedIn": false`; a read after it answers `sign_in_required`. Safe to repeat: yes.

## Pause and private

`paused` and `private` are the account's own choices, set by a person in the farmer portal. The call behind them takes a browser's origin and fresh proof, so it is not a call for an agent. To stop sharing for a while, stop the agent.

This page: https://supply.coronium.ai/guides/device-troubleshoot.md.

# Troubleshooting: what the agent prints, why, and what to do

The agent logs only when its link to the relay changes: one line when it connects, one line when it does not. It never logs a request or an address. Find the line you see below. The words in code are the exact words of the program, so search this page, or this site, for them.

Where the log is: `journalctl -u coronium-agent -n 20 --no-pager` for the Linux kit, `docker logs -n 20 coronium-agent` for a container, and the terminal for the program alone.

## The two lines

| Line | Means | Do |
|---|---|---|
| `connected to the relay` | the device is linked and can carry streams | read its state, as [device states](/guides/device-states.md) step 1 does |
| `not connected: <cause>. Fix: <fix>. Dialing again in <time>` | the link is down; the agent dials again by itself after the time | find `<cause>` below; do what `<fix>` names |

A start that is refused prints `<code>: <cause>. Fix: <fix>` once and ends with exit status 2: see Settings the agent refuses.

## Causes of a line that starts not connected

| Cause holds | Means | Do |
|---|---|---|
| `the relay refused the connection` | nothing listens at that host and port, or a firewall answers for it | check `CORONIUM_RELAY` against the `relay` of `coronium-device.json`; allow outbound TCP to it |
| `the network timed out` | no answer from the relay's address | check the device's internet connection and outbound TCP to the relay; a captive network or a firewall that drops packets reads like this |
| `the connection was reset` | something on the path closed the connection | nothing if it is rare; if it repeats, the network blocks the relay's port |
| `the relay closed the connection` | the relay ended the connection before the device was let in | nothing: it dials again |
| `a network error` | any other failure of the dial, a name that does not resolve among them | check the device's DNS and the relay's host name |
| `the relay's certificate is not trusted` | the relay's certificate did not verify | check that the relay `host:port` is the one from enrolment and that the device's date and time are right; a network that intercepts TLS also reads like this |
| `this system has no certificate roots, so the relay's certificate cannot be checked` | a minimal, container or router image without its roots | install the `ca-certificates` package, then restart the agent: the roots are read once |
| `the relay sent nothing for three keepalive periods` | the link went silent, as on a sleeping or roaming connection | nothing: it dials again |
| `the connection to the relay was lost` | the link broke after it was up | nothing: it dials again; if it repeats, check the connection |
| `the relay did not answer HELLO` | the device connected and got no answer in time | nothing: it dials again |
| `the relay broke the protocol` | the relay sent something this agent does not accept | update the agent, as [update, stop, remove and withdraw](/guides/device-lifecycle.md) says |
| `the agent failed while serving the relay` | a fault inside the agent; it recovers and dials again | if it repeats, update the agent and tell the contact in the partner agreement the line |

## When the relay refuses or ends the link

The line reads `the relay refused the device (REFUSE code <number>): <cause>` or `the relay ended the connection (GOAWAY code <number>): <cause>`, and its `<fix>` is the relay's own. The relay's causes:

| Cause holds | Means | Do |
|---|---|---|
| `no device with this id is in the directory` | the relay does not know this device id yet, or the id is wrong | a device enrolled a moment ago is let in on the next try. If it stays, `CORONIUM_DEVICE` is not the `deviceId` of `coronium-device.json` |
| `the credential is not this device's secret` | `CORONIUM_DEVICE_SECRET` is not this device's | write `agent.env` again from `coronium-device.json`, as [enrolment](/guides/device-enrol.md) step 5 does. A lost secret is not shown again: withdraw the device and enrol a new one |
| `this device was withdrawn` | the device was withdrawn, which is for good | stop this agent. To share again, enrol a new device, with your person's yes |
| `the device authorization directory is missing or expired` | the relay is starting or lost its list of devices | nothing: it dials again |
| `this relay holds as many devices as it is set to take` | the relay is full | nothing: it dials again after the time the relay names |
| `this relay lets devices in at a limited rate and this second is taken` | many devices are connecting at once | nothing: it dials again |
| `this device was let in as often as one device may be, or was turned away, within the last second` | two agents use one device id, or one restarts in a loop | run one agent for each device id |

A line with `GOAWAY code 4` means the same id connected again elsewhere and replaced this link: stop the other agent that uses this id, or enrol this device under an id of its own. The agent then stays away longer than after any other line; `Dialing again in` says how long. `GOAWAY code 1` is a planned restart of the relay, and the agent dials again by itself.

## Settings the agent refuses

| Code | Means | Do |
|---|---|---|
| `bad_relay` | `CORONIUM_RELAY` is empty or not `host:port` | set it to the `relay` of `coronium-device.json` |
| `bad_device_id` | `CORONIUM_DEVICE` is not a device id | set it to the `deviceId` of `coronium-device.json` |
| `bad_secret` | `CORONIUM_DEVICE_SECRET` is not the secret as hex | write `agent.env` again from `coronium-device.json` |
| `bad_flags` | an argument the program does not take | pass the settings in the environment, as `agent.env` holds them, and no argument |
| `bad_max_streams` | `-max-streams` is outside its range | leave the flag out |
| `bad_linger_limit` | `-linger-limit` is not a positive duration | leave the flag out |

A null `relay` in `coronium-device.json` means the service names no relay for new devices: ask the operator, at the contact in the partner agreement.

## What the Linux installer refuses

`install.sh` prints `<code>: <cause>. Fix: <fix>` and installs nothing.

| Code | Do |
|---|---|
| `not_root` | run it with `sudo` |
| `no_sha256sum` | install coreutils or busybox |
| `checksum_missing`, `checksum_mismatch`, `consent_draft` | do not install: download the kit again and check it |
| `wrong_architecture` | take the kit for this machine: `uname -m` names it |
| `no_certificate_roots` | install the `ca-certificates` package |
| `no_systemd` | run `./install.sh --no-systemd` |
| `no_useradd`, `no_unprivileged_user` | install the package the fix names, or use `--no-systemd` |
| `kit_digest_mismatch` | the digest typed is not this kit's: compare it with `/kit/SHA256SUMS` and download again if they differ |
| `agreement_not_accepted` | the kit's agreement is not the text the account signed: sign the text in force, then enrol |
| `consent_not_given` | the person at the terminal did not type the agreement: run it again when they agree |

## Connected, and no traffic

`status` `online` with a `state` other than `admitted` or `established` is not a fault of the agent. [Device states](/guides/device-states.md) has each `state` and `reason` with what to do: a network that is not classified, a network Coronium does not sell, an address another device already exits from. An admitted device carries traffic only when a buyer's request selects it.

## What a device refuses

The agent on the device refuses these, whoever asks, and no setting changes it:

- A destination on the device itself, on a private home or office range, link-local, carrier-grade NAT, multicast or reserved, and an IPv6 address that carries one of those inside it. The buyer's stream ends with `target_blocked`.
- More streams at once than it told the relay it carries: the next one ends with `too_many_streams`.
- Any inbound connection: it listens on no port.
- A second copy of itself under the same device id: the newer link replaces the older.

It reports no usage and no earnings of its own: the edge is the one meter.

This page: https://supply.coronium.ai/guides/device-refusals.md.

# Refusals: every code of a device owner's calls

Every refusal is JSON with `code`, `cause` and `fix`, and its HTTP status is not 200 or 201. The `fix` of the answer you hold is the service's own word for what to do: where this page and that `fix` differ, the answer wins. This page adds who acts, you or your person, and the step to return to. A refusal that names a time carries `retryAt` and a `Retry-After` header: wait until then.

A block of these guides prints `code`, `cause` and `fix` when a call is refused. If a block prints a jq error instead, read the file it wrote, or send the call again without jq: the answer is a refusal.

## The calls

- `GET /app/api/signup/challenge` and `POST /app/api/signup`: a new account.
- `POST /app/api/login`: sign in with the access code.
- `GET /app/api/agreement`, `GET /app/api/consent` and `POST /app/api/consent`: read and sign the partner agreement.
- `POST /app/api/devices` and `GET /app/api/devices`: enrol a device, and list the devices.
- `GET /app/api/earnings`, `GET /app/api/payouts` and `POST /app/api/payouts`: the statement and a payout.
- `POST /app/api/devices/{deviceId}/withdraw`: the account withdraws a device.
- `GET /app/api/devices/{deviceId}/self` and `POST /app/api/devices/{deviceId}/self/withdraw`: a device reads and withdraws itself.

## The calls' refusals

| Code | Answered by | Who acts | Do |
|---|---|---|---|
| `registration_closed` | sign-up | your person | new accounts are not made now: they give you the access code of their account, in `coronium-account.json` |
| `signups_paused` | sign-up | you | the hour's new accounts are spent: wait until `retryAt`, then ask a new challenge |
| `challenge_required` | sign-up | you | send the `challenge` and a `nonce`, as enrolment step 1 does |
| `challenge_invalid`, `challenge_expired`, `challenge_used`, `challenge_wrong_use` | sign-up | you | ask a new challenge and solve that one; a challenge is spent by one sign-up |
| `proof_insufficient` | sign-up | you | the nonce does not solve the challenge: solve it again as the block does |
| `challenge_too_easy` | sign-up | you | ask a new challenge from the network you send from |
| `rate_limited` | sign-up, sign-in, a device's own two calls | you | wait until `retryAt`, or a few minutes when none is given; do not loop |
| `bad_credentials` | sign-in | your person | the access code is wrong or was replaced: they give you the current one |
| `sign_in_required` | every call with a session | you | sign in again, as enrolment step 1 does; the session cookie belongs to the site you signed in on |
| `session_required` | every call | you | a call with a session takes the cookie and no `Authorization` header; a device's own call takes its header and no cookie |
| `consent_not_approved` | the agreement, signing, enrolment | nobody yet | the text is a draft on this service: nothing can be signed or enrolled until `approved` reads true |
| `confirmation_required` | signing, enrolment, withdrawal | your person | their yes is missing: send `agreed` or `confirm` as true only after they said it |
| `consent_outdated` | signing, enrolment | your person | the text changed: read it again, show it, sign the text in force |
| `invalid_signer` | signing | your person | the name is not a full legal name as the call takes it: write `coronium-signer.json` again |
| `bad_signed_at` | signing | you | the device's clock is off: set it, delete `coronium-signature.json`, sign again |
| `bad_signature` | signing | you | the fingerprint does not match the fields: delete `coronium-signature.json` and run the signing block again |
| `already_signed` | signing | nobody | this version is signed already, with other values: that signature stands; go on to enrolment |
| `signing_not_configured` | signing, enrolment | the operator | the service cannot take a signature now: tell your person and the contact below |
| `agreement_unsigned` | enrolment | your person | sign the text in force first: enrolment steps 2 and 3 |
| `device_cap_reached` | enrolment | your person | the account holds as many devices as `terms.deviceLimit` allows: withdraw one for good, or ask for a higher limit |
| `enrol_rate_reached` | enrolment | you | the account's day of enrolments is spent: send again after `retryAt` |
| `enrolment_repeated` | enrolment | you | this `requestId` enrolled `deviceId` already and its secret was shown once: withdraw that device, delete `coronium-enrol.json` and `coronium-device.json`, enrol again |
| `invalid` | any call with a body or a query | you | a field is missing, unknown or out of range: `cause` names it |
| `proof_required` | a payout | your person | the access code sent as proof is not the current one |
| `not_whole_cents`, `below_minimum`, `nothing_available` | a payout | your person | correct the amount: whole cents, at least `payoutMinimumUsdMicros`, at most `available.usdMicros` |
| `payout_pending` | a payout | nobody | one request waits at a time: wait until it is paid or declined |
| `amount_changed` | a payout | you | this `requestId` was sent before with other values: send the first values, or a new `requestId` |
| `buyer_in_debt` | a payout | your person | the account owes for traffic it sent as a buyer: they add funds on the buyer site |
| `device_not_found` | withdrawal, a device's own two calls | you | the id is not a device of this account, or the header is not this device's secret |

## From the gateway

These come from the web server in front of the service, before any call is read.

| Code | Means | Do |
|---|---|---|
| `rate_limited` | too many requests or connections from this address | wait a few seconds |
| `not_found` | nothing is served at this address | read [/llms.txt](/llms.txt) for the addresses of this site |
| `method_not_allowed` | the address takes another method | read [/openapi.json](/openapi.json) for the call |
| `body_too_large` | the body is over the size the address takes | send a shorter body |
| `wrong_origin` | a request named another site as its origin | send no `Origin` header from a program |
| status `503`, with any code | the service behind the address did not answer | try again in a minute |

## Enrolment by token

`POST /app/api/enrol-tokens`, `GET /app/api/enrol-tokens`, `POST /app/api/enrol-tokens/{tokenId}/revoke`, `PUT /app/api/devices/{deviceId}` and `PUT /app/api/devices` answer `503` with `enrol_tokens_off`, before they read anything, while the operator keeps enrolment by token closed. Then each device is enrolled with `POST /app/api/devices`. [Many devices](/guides/device-tokens.md) describes the calls for when they answer.

## The contact

<!-- facts:begin supply.contact -->
The one contact for device owners is support@coronium.ai: a question, more devices, or a withdrawal the account cannot make itself.
<!-- facts:end supply.contact -->

This page: https://supply.coronium.ai/guides/device-macos.md.

# Run it on macOS

The installer sets the program up as a launchd user agent: a service of your own user, which starts when you log in and is started again whenever it ends. Calls go to https://supply.coronium.ai. `/kit/index.json` lists the state and the limits of the program and of the installer, and [the files section](/guides/device-files.md) says what each means.

## Needs

- A Mac with Apple silicon, Terminal and your own user, never `sudo`.
- `agent.env` from [enrolment](/guides/device-enrol.md), in the folder of the downloads. Without it the installer asks for the three values, the secret without showing it.
- Outbound TCP to the relay, no inbound port, and one device per public address.

No installer shows the agreement here, so the signature and the acceptance stored at enrolment are its record.

## Steps

1. Download, check and install, in a folder of its own. The installer runs only when every check line ends `OK`.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
for f in SHA256SUMS coronium-agent-darwin-arm64 coronium-agent-darwin-install.sh coronium-agent-darwin-uninstall.sh; do curl -fsSLO "$SUPPLY/kit/$f"; done
grep -E '  coronium-agent-darwin-(arm64|install\.sh|uninstall\.sh)$' SHA256SUMS | shasum -a 256 -c && sh coronium-agent-darwin-install.sh
```

Expect: three lines ending `OK`, then `Installed.` The installer checks the files again, moves `agent.env` into `~/Library/Application Support/CoroniumDevice`, readable by you only, and writes `~/Library/LaunchAgents/ai.coronium.device.plist`, which holds no setting. If refused: `checksum_missing` or `checksum_mismatch` (download again), `wrong_architecture` (no program is published for an Intel Mac), `runs_as_root` (run it without `sudo`), `quarantined` (a browser downloaded the program: fetch it with curl as above), `bad_settings_file`, `bad_relay`, `bad_device_id` or `bad_secret` (correct `agent.env`), `service_not_started` (log in to the Mac's desktop as this user). Nothing is signed yet: the digests are as trustworthy as the site they came from. Safe to repeat: yes, and it keeps the settings; an `agent.env` beside the installer is then not used, and the installer says to delete it.

2. Check.

```sh
umask 077
launchctl print gui/$(id -u)/ai.coronium.device | grep state
tail -n 20 "$HOME/Library/Application Support/CoroniumDevice/agent.log"
```

Expect: `state = running` and `connected to the relay`. A problem is one log line with its cause and its fix, and the agent dials again by itself. launchd starts an agent that ended again after a pause, so a refused setting repeats in the log until `agent.env` is right.

The service belongs to your user: it runs while you are logged in. After a restart it is back once you log in, and not before. Nothing trims `agent.log`.

## If it is not connected

```sh
umask 077
launchctl bootstrap gui/$(id -u) "$HOME/Library/LaunchAgents/ai.coronium.device.plist"
launchctl kickstart -k gui/$(id -u)/ai.coronium.device
tail -n 5 "$HOME/Library/Application Support/CoroniumDevice/agent.log"
```

The first line loads the service and fails harmlessly when it is loaded; the second starts it again; the third shows why it is not connected, if it is not.

## Update

`/kit/index.json` names the published `version`, and publishing a newer agent does not stop one that is running. To update, run the block of step 1 again in an empty folder, without `agent.env`. The installer checks the new files before it touches anything, keeps the settings that are installed, ends the running service, puts the new program in place and starts it. When a check fails, the installed program stays as it is and keeps running.

## Stop and remove

`launchctl bootout gui/$(id -u)/ai.coronium.device` stops sharing until you log in again. To remove the service, the program, its log and `agent.env` with the secret:

```sh
umask 077
sh "$HOME/Library/Application Support/CoroniumDevice/uninstall.sh"
```

It warns, with the process id, about an agent you started yourself, which it does not stop. Removing it does not withdraw the device; [update, stop, remove and withdraw](/guides/device-lifecycle.md) says how.

This page: https://supply.coronium.ai/guides/device-windows.md.

# Run it on Windows

The installer sets the program up as a scheduled task of your own user, which starts when you log on and is started again after it fails. It is written to need no administrator rights and no other tool; it was not run by Coronium on Windows, so neither is measured. Calls go to https://supply.coronium.ai. `/kit/index.json` lists the state and the limits of the program and of the installer, and [the files section](/guides/device-files.md) says what each means.

## Needs

- Windows on x86-64 or ARM64, Windows PowerShell, and your own user.
- `agent.env` from [enrolment](/guides/device-enrol.md), in the folder of the downloads. Without it the installer asks for the three values, the secret without showing it.
- Outbound TCP to the relay, no inbound port, and one device per public address.

No installer shows the agreement here, so the signature and the acceptance stored at enrolment are its record.

## Steps

1. Download, check and install, in PowerShell, in a folder of its own. `$ARCH` is `amd64` for x86-64 and `arm64` for ARM64. The block stops at the first line that fails.

```powershell
& {
$ErrorActionPreference = 'Stop'
$SUPPLY = 'https://supply.coronium.ai'
$ARCH = 'amd64'
Invoke-WebRequest -UseBasicParsing "$SUPPLY/kit/SHA256SUMS" -OutFile SHA256SUMS
foreach ($f in "coronium-agent-windows-$ARCH.exe", 'coronium-agent-windows-install.ps1', 'coronium-agent-windows-uninstall.ps1') {
  Invoke-WebRequest -UseBasicParsing "$SUPPLY/kit/$f" -OutFile $f
  $listed = Select-String -Path SHA256SUMS -Pattern ('  ' + [regex]::Escape($f) + '$')
  if (-not $listed -or $listed.Line.Split(' ')[0] -ne (Get-FileHash $f -Algorithm SHA256).Hash.ToLower()) { throw "$f does not match SHA256SUMS" }
}
powershell -NoProfile -ExecutionPolicy Bypass -File .\coronium-agent-windows-install.ps1
}
```

Expect: no error from the checks, then `Installed.` The installer checks the files again, moves `agent.env` into `%LOCALAPPDATA%\CoroniumDevice`, a folder only your user can read, and registers the task `CoroniumDevice`, which holds no setting. The scripts are not signed, so each is started with `-ExecutionPolicy Bypass` after its digest is checked. If refused: `checksum_missing` or `checksum_mismatch` (download again), `wrong_architecture`, `policy_blocks_scripts` (the machine's administrator allows signed scripts only), `bad_settings_file`, `bad_relay`, `bad_device_id` or `bad_secret` (correct `agent.env`), `service_not_started` or `program_not_replaced` (the cause is in the message; after the second, the program installed before runs on). A file a browser downloaded carries a download mark the installer does not handle: download with this block. Nothing is signed yet: the digests are as trustworthy as the site they came from. Safe to repeat: yes, and it keeps the settings.

2. Check.

```powershell
(Get-ScheduledTask -TaskName CoroniumDevice).State
Get-Content -Tail 20 "$env:LOCALAPPDATA\CoroniumDevice\agent.log"
```

Expect: `Running` and `connected to the relay`. A problem is one log line with its cause and its fix, and the agent dials again by itself.

The task belongs to your user: it runs while you are logged on. After a restart it is back once you log on, and not before. Windows starts a failed task again only as often as the task's restart count allows; past it, the task stays down until you log on again. Nothing trims `agent.log`.

## If it is not connected

```powershell
Enable-ScheduledTask -TaskName CoroniumDevice
Start-ScheduledTask -TaskName CoroniumDevice
Get-Content -Tail 5 "$env:LOCALAPPDATA\CoroniumDevice\agent.log"
```

The first two lines start the task again; the third shows why it is not connected, if it is not.

## Update

`/kit/index.json` names the published `version`, and publishing a newer agent does not stop one that is running. To update, run the block of step 1 again in an empty folder, without `agent.env`. The installer checks the new files before it touches anything, keeps the settings that are installed, copies the new program beside the installed one, ends the running task, moves the new program into place and starts it. When a check or the move fails, the installed program stays as it is and runs on.

## Stop and remove

`Stop-ScheduledTask -TaskName CoroniumDevice; Disable-ScheduledTask -TaskName CoroniumDevice` stops sharing and keeps it stopped. To remove the task, the program, its log and `agent.env` with the secret:

```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File "$env:LOCALAPPDATA\CoroniumDevice\uninstall.ps1"
```

It warns, with the process id, about an agent you started yourself, which it does not stop. Removing it does not withdraw the device; [update, stop, remove and withdraw](/guides/device-lifecycle.md) says how.

This page: https://supply.coronium.ai/guides/device-health.md.

# Device health

Calls go to https://supply.coronium.ai, signed in as in [enrolment](/guides/device-enrol.md). The states that decide whether a device may carry buyers at all are in [device states](/guides/device-states.md).

## What it is

Coronium checks that each connected device still carries traffic. A device that is `online` and `admitted` or `established` reads `health` in `GET /app/api/devices`; any other device reads `health` as null.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
curl -sS -b coronium.cookies "$SUPPLY/app/api/devices" | jq -c '.counts.byHealth, (.devices[] | {deviceId, status, health})'
```

Expect: `health.state`, `health.reason` for a failing device, `health.since` for when the state began and `health.firstByteMs` for how quickly the first byte of the last passed check came back. `counts.byHealth` counts those devices by state. Safe to repeat: yes.

<!-- facts:begin health.states -->
| `health` reads | Means | Do |
|---|---|---|
| `unchecked` | Connected. Its first check is on its way. | Nothing. |
| `healthy` | Passed its last check. | Nothing. |
| `slow` | Passes its checks, but slowly. It may be used after faster devices. | Check the line, or move the device closer to its router. |
| `failing`, `silent` | Connected, but it does not answer. | Restart the agent and read its log. |
| `failing`, `no_bytes` | It opens connections and returns no data. | Look for a firewall, a VPN or a sign-in page on this network. |
| `failing`, `tls_failed` | Something on this network alters secure connections. | Remove the inspecting proxy or antivirus, or use another network. |
| `failing`, `no_route` | It cannot reach the internet. | Check the connection and its DNS. |
<!-- facts:end health.states -->

A failing device gets no new buyer traffic, keeps the traffic it carries, and is checked again by itself: nobody has to act for it to come back. A device that connects is checked at once, with two bounds: one that reconnects again and again is not checked for it each time, and one that fails and reconnects sooner than its next check was due waits for that check. A reconnect too quick for the directory to show is not seen as a new connection, so such a device waits for its scheduled check. An account is told once a day of devices that stay failing, by the `device_withheld` [notification](/guides/notifications.md).

## What the checks cost

<!-- facts:begin health.checks -->
A check is one short secure connection through the device to Coronium's own servers. It uses the device's connection, earns nothing and is in no count of `requests`, `bytesUp` or `bytesDown`. A connected device on a home line that carries no traffic is checked about every 20 minutes. A device on a mobile exit, or one that carries traffic, is checked about every 60 minutes. One check is ended once it has moved 8192 bytes of payload both ways together, as the edge counts them. No check of a device starts once its checks have moved 1048576 bytes of payload in a UTC day, as the edge counts them. The device's line also carries what the edge does not count: the connection's own framing and the name lookup. A device that just connected or failed a check is checked sooner.
<!-- facts:end health.checks -->

This page: https://supply.coronium.ai/guides/device-tokens.md.

# Many devices: enrolment by token

A token lets each device enrol itself, holding no session or access code, and no device secret crosses the network. Calls follow [enrolment](/guides/device-enrol.md).

## Needs

- These routes answer `503` `enrol_tokens_off` until the operator opens them ([limits](/guides/limits.md)).
- An account signed in that signed the text in force ([enrolment](/guides/device-enrol.md), steps 1 to 3), and the yes of the devices' owner.

## Steps

1. Mint a token with the access code as proof; `expiresInHours` and `label` are optional, and `uses` above what the account may still enrol is refused with `most`.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
jq -c '{consent: {version, sha256}, agreed: true, uses: 1, label: "rack_a"}' coronium-consent.json > coronium-mint.json
jq -c --slurpfile m coronium-mint.json '$m[0] + {proof: {code: .accessCode}}' coronium-account.json | curl -sS -b coronium.cookies -H 'Content-Type: application/json' -d @- "$SUPPLY/app/api/enrol-tokens" -o minted.json
if jq -e '.tokenId | strings' minted.json > /dev/null; then
  jq -r '"Authorization: Bearer \(.token)"' minted.json > token.header
  jq -c .consent minted.json > consent.json
else
  jq -r '"\(.code): \(.cause) Fix: \(.fix)"' minted.json; false
fi
```

Expect: `token.header` and `consent.json` for each device; the token is shown once. A refusal prints its code, cause and fix and writes neither: `enrol_tokens_off` (enrol as in [enrolment](/guides/device-enrol.md)), `token_limit_reached` (revoke one), `device_cap_reached`, `agreement_unsigned`. Safe to repeat: no.

2. On each device, make the id and secret and write `agent.env` before any call, so a lost answer is sent again with the same pair.

```sh
umask 077
[ -e agent.env ] || {
  head -c 32 /dev/urandom >secret.bin
  id=$(od -An -tx1 -N16 /dev/urandom | tr -d ' \n' | sed -E 's/^(.{8})(.{4})(.{4})(.{4})(.{12})$/\1-\2-\3-\4-\5/')
  printf 'CORONIUM_DEVICE=%s\nCORONIUM_DEVICE_SECRET=%s\n' "$id" "$(od -An -tx1 -v secret.bin | tr -d ' \n')" >agent.env
}
```

3. Exchange the token. The body is `secretSha256`, the SHA-256 of the raw secret bytes, never of their hex text, and `consent`.

```sh
umask 077
SUPPLY=${SUPPLY:-https://supply.coronium.ai}
id=$(sed -n 's/^CORONIUM_DEVICE=//p' agent.env)
printf '{"secretSha256":"%s","consent":%s}' "$(sha256sum secret.bin | cut -d' ' -f1)" "$(cat consent.json)" >exchange.json
code=$(curl -sS -o answer.json -w '%{http_code}' -X PUT -H @token.header -H 'Content-Type: application/json' \
  --data-binary @exchange.json "$SUPPLY/app/api/devices/$id")
case "$code" in 200|201) printf 'CORONIUM_RELAY=%s\n' "$(jq -r '.relay // empty' answer.json)" >>agent.env && rm -f token.header secret.bin exchange.json ;; esac
echo "$code"
```

Expect: `201` (`applied`), or `200` (`already_applied`, no use spent) for the same id and secret. If refused: `bad_enrol_token`, `enrol_token_expired`, `enrol_token_used` or `enrol_token_revoked` (mint another), `consent_outdated` (sign the text in force, then mint again), `device_id_taken` (delete `agent.env` and `secret.bin`, start at step 2). A 429 means wait: until `retryAt` when given, else a second. A null `relay` means ask the operator. Safe to repeat: yes.

Then run the agent with `agent.env`; [`/kit/SIGNING.md`](/kit/SIGNING.md) has a worked digest.

## Many devices in one call

`PUT /app/api/devices` takes `consent` and `devices`, pairs of `deviceId` and `secretSha256`, and skips entries the account already holds; [the API](/openapi.json) has the rest.

**Never bake `agent.env` into an image**: copies of one id and secret are one device, each replacing the last at the relay. Bake `token.header` and `consent.json`; make the pair at first boot.

## Read, revoke and withdraw

`GET /app/api/enrol-tokens` lists each token's `state`, `used` and `app`, never the token. `POST /app/api/enrol-tokens/{tokenId}/revoke` with `{}` revokes one; `{"withdrawDevices": true, "confirm": true}` also withdraws its devices. Replacing the access code revokes all.

This page: https://supply.coronium.ai/guides/notifications.md.

# Coronium: notifications

An account keeps a list of what happened that its person or agent should know: a payment, a delivered or ending private line, a sign-in, a replaced credential, devices admitted, withheld or gone offline, refused requests. An agent reads it with the session cookie a sign-in sets: step 2 of the agent instructions in [/guides/integrate.md](/guides/integrate.md). A credential is refused here with `session_required`. Both sites answer these calls for the same account, and a session cookie is sent only to the site that set it.

Run the commands in the folder that holds the cookie file `coronium.cookies`; a block run elsewhere enters the device folder, `~/coronium` unless `CORONIUM_DIR` names another. They use curl, jq and sed, and call the site that file names: the supply site after the device steps, the buyer site after the quickstart. Set `BASE` to choose another.

## Read

`GET /app/api/notifications` answers the newest first. `unread` is the count of unread notifications, `mail` says whether the mailed kinds go to the account's confirmed address, and `next` is the cursor of the next page, or null. Each notification has `id`, `kind`, `firstAt`, `lastAt`, `count`, `read` and `data`. Add `?unread=true` for unread ones alone, and `cursor=<next>` for the next page; any other parameter is refused with `invalid`.

```
umask 077
[ -e coronium.cookies ] || cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
BASE=${BASE:-https://$(sed -n '/coronium_client_session/{s/^#HttpOnly_//;s/[[:space:]].*//;p;q;}' coronium.cookies)}
curl -sS -b coronium.cookies "$BASE/app/api/notifications?unread=true" | jq 'if .code then {code, cause, fix} else {unread, next, notifications: [.notifications[] | {id, kind, count, lastAt, data}]} end'
```

A refusal prints its `code`, `cause` and `fix`. `sign_in_required` means this site holds no session for that cookie: sign in on it, or set `BASE` to the site you signed in on.

A kind that counts its events keeps one notification for each reason and UTC day, so a whole fleet admitted in one day is one notification whose `count` is the number of devices; a device that moves back and forth counts once in each. Devices that lost their connection are one notification and one mail for an account and UTC day, whose `count` grows with each outage that passes the stated time; a device whose relay is itself away, and one withheld as `class_not_sold` or `supplier_blocked`, is not counted. A new event of a counted notification makes it unread again without moving it, so read `?unread=true` to find every unread one. A sign-in is listed already read. Refused requests are counted for a UTC day once it has ended and the edges' last counts have arrived. To read them all, follow `next` until it is null. Old notifications are deleted after a while, read or not: [/guides/limits.md](/guides/limits.md) says when.

## Mark read

`POST /app/api/notifications/read` takes exactly one of `{"id": "<id>"}`, which marks that notification, or `{"through": "<id>"}`, which marks it and every older one. It answers `marked` and the new `unread`. A repeat marks none. An id that is not one of this account's answers `notice_not_found`.

```
umask 077
[ -e coronium.cookies ] || cd "${CORONIUM_DIR:-$HOME/coronium}" || exit
BASE=${BASE:-https://$(sed -n '/coronium_client_session/{s/^#HttpOnly_//;s/[[:space:]].*//;p;q;}' coronium.cookies)}
newest=$(curl -sS -b coronium.cookies "$BASE/app/api/notifications" | jq -r '.notifications[0].id // empty')
[ -n "$newest" ] && jq -cn --arg id "$newest" '{through: $id}' | curl -sS -b coronium.cookies -H 'Content-Type: application/json' -d @- "$BASE/app/api/notifications/read"
```

## Mail

The kinds marked Mailed below are sent to the account's confirmed email address once per notification, not once per event it counts. A replaced credential is the exception: each replacement after the last mail ended is mailed again. `POST /app/api/notifications/mail` with `{"mail": false}` stops that, and `{"mail": true}` starts it again. Without a confirmed address nothing is mailed.

## Kinds

<!-- facts:begin notice.kinds -->
- `payment_credited`: A payment or a grant was added to your balance. Mailed.
- `payment_reversed`: A payment was reversed and taken from your balance. Mailed.
- `payment_failed`: A payment from an agent did not settle, and nothing was added. Mailed.
- `private_line_delivered`: An order of private lines was delivered. Mailed.
- `private_line_ending`: A private line ends soon. Mailed.
- `rotation_link_replaced`: A rotation link of a private line was replaced.
- `credential_replaced`: The account's credential was replaced. Mailed.
- `browser_credential_made`: A browser signed in to this account made a proxy password, for itself or a lasting one for your tools and agents. Mailed.
- `signed_in`: Someone signed in to this account.
- `device_admitted`: Devices were admitted and serve traffic.
- `device_withheld`: Devices were withheld and serve no traffic. Mailed.
- `device_offline`: Devices lost their connection and have not come back, so they serve no traffic. Mailed.
- `requests_refused`: Requests of the account were refused yesterday.
- `balance_empty`: The balance is empty, so traffic stopped. Mailed.

A device whose relay is itself away, or only just back, is still reported once it has been without a connection for 120 minutes.
<!-- facts:end notice.kinds -->

`balance_empty` is about the balance an account buys traffic from. It says nothing about a device: no device stops for it, and an account that only shares devices needs no funds.

`data` holds integers as decimal strings and ids, never a secret: `usdMicros` and `source` or `cause` for a payment, `quoteId`, `orderId` with `lines` or `expiresAt`, `way` of a sign-in, `state` or `reason` of devices (the words of [/guides/device-states.md](/guides/device-states.md)), and `day` with `requests` for refused requests, whose codes `GET /app/api/usage/outcomes` lists.

This page: https://supply.coronium.ai/guides/search.md.

# Search the documents of this site

`/.well-known/search` finds passages in the documents this site serves to agents and answers them as Markdown. It retrieves text: no model is called and nothing is generated, so every line of an answer is a line of a document you can fetch. It needs no account and reads none.

Each site searches its own documents: the buyer site its index, guides and content pages, the supply site the device owners' index and guides. The documents of a site are the ones its `/docs-manifest.json` lists.

## Ask

With GET, the text goes in `q`:

```sh
BASE=${BASE:-https://coronium.ai}
curl -sS --get "$BASE/.well-known/search" --data-urlencode "q=how is a payout requested"
```

With the HTTP QUERY method, the text is the body: plain text, JSON with the one key `q`, or a form with the one field `q` (plain words under the form type, as curl sends `--data` with no header, are taken as the text). QUERY is safe and can be repeated, like GET, and it keeps the text out of the address.

```sh
BASE=${BASE:-https://coronium.ai}
curl -sS -X QUERY -H 'Content-Type: text/plain' --data 'device withheld class_not_sold' "$BASE/.well-known/search"
curl -sS -X QUERY -H 'Content-Type: application/json' --data '{"q":"device withheld class_not_sold"}' "$BASE/.well-known/search"
```

On the supply site set `BASE=https://supply.coronium.ai`. Send `Accept: text/markdown`, or no `Accept` header.

## The answer

The answer is `text/markdown`. Its first line names the query, with a backslash before each character Markdown would read as markup, and each hit is a second-level heading with the address of its document on this site and its score, then the passage:

```text
# Search results for: "<the query>"

## <the address of the document> (score: 1.000)

**<the title> > <a heading> > <a step>**

<the passage>
```

- The address is the document's own: fetch it for the whole text.
- The bold line is the passage's place in its document: the title, the headings above it and, in a guide, its step.
- A long passage is cut at the end of a line, and its last line then reads `The passage goes on in <address>.`
- A query that matches nothing answers the first line and the sentence `No passage of this site matches.`, with status 200.
- The answer carries `Accept-Query`, the media types a QUERY body may have, and an `ETag`; the same query is the same answer until the site is released again.

## How a passage is ranked

Each document is cut at its headings, and under a heading at each numbered step, so a passage is one heading or one step with the text under it. A word is a run of letters, digits and underscores, in lower case; a word with underscores, such as a refusal code, also counts as each of its parts. Passages are ranked by BM25 over those words, with the words of a passage's headings weighted above its text. The score shown is the passage's rank score divided by the best one, so the first hit reads `1.000`. There is no stemming and no list of synonyms: search for the words a document would use, and for a code or a log line, the exact words.

## Bounds

<!-- facts:begin search.limits -->
- A search query is at most 400 bytes.
- A search answers at most 5 passages.
- One address may send 60 search requests a minute.
<!-- facts:end search.limits -->

## Refusals

A refusal is JSON with `code`, `cause` and `fix`.

| Status | Code | When |
|---|---|---|
| 400 | `invalid` | no `q`, another parameter, a body that is not what its `Content-Type` says, JSON with another key, or a form with another field |
| 400 | `content_type_required` | a QUERY with no `Content-Type` |
| 406 | `not_acceptable` | an `Accept` header that takes neither Markdown nor any text |
| 413 | `body_too_large` | a body over the size the address takes |
| 403 | `wrong_origin` | a request that names another site as its `Origin`: a page of another site cannot search this one from a browser |
| 405 | `method_not_allowed` | a method other than GET and QUERY, `OPTIONS` among them |
| 415 | `unsupported_media_type` | a QUERY body that is not `text/plain`, `application/json` or `application/x-www-form-urlencoded` |
| 422 | `unprocessable_query` | a query that is empty, too long, or holds no letter or digit |
| 429 | `rate_limited` | too many searches from one address; `retryAt` and `Retry-After` say when to send again |

## How a page names it

Every HTML page of this site but its not-found page names the search in four `meta` tags of its head, `agent:instructions`, `agent:endpoint`, `agent:method` and `agent:documentation`, and the Markdown form of a page carries the same four values in an `agent` block of its front matter. The address they give is the GET form, with `{query}` where the text goes.

Whether an outside search engine may index this site is the content signal of `/robots.txt`, which names no rule for this address. This search is the site's own and does not depend on it.

This page: https://supply.coronium.ai/guides/limits.md.

# Stated limits

- The operator opens and closes registration, the proxy endpoint, the chat and per-GB peer sales: `GET /app/api/buy` answers `registration`, `chat` and `peerSales`, and `GET /app/api/proxy` answers `endpoint.state`. Closed, enrolment by token ([Many devices](/guides/device-tokens.md)) answers 503 `enrol_tokens_off`, an app token `app_devices_off`, and every route under `/app/api/sessions` 503 `device_sessions_off`.
- The service sells mobile and residential peer devices. Carrier modems (`mbl`), ISP addresses and datacenter addresses asked for in a username are recorded as demand and answered `on_request`. A dedicated carrier modem is the Private mobile proxies product. Reserved addresses are not offered.
- A product the buyer site's `/llms.txt` does not list as available is not built; a signed-in account may ask for one, free.
<!-- facts:begin numbers.list -->
- The proxies page marks a balance low when it buys less than 1 GB at the chosen price.
- A count under 5 devices reads `few`, and a city, carrier or network with fewer than 5 devices online is not listed.
- A quote lasts 30 minutes.
- A request for a product that is not built carries a note of at most 500 bytes.
- A private line takes one rotation in 120 seconds, whichever way it was asked.
- A private line's rotation interval is at least 2 minutes.
- A private line's rotation interval is at most 1440 minutes.
- An account replaces one private line in 24 hours.
- While orders are taken, private lines that cannot be delivered at once are usually supplied within about 3 days.
- At most 20 private devices wait to be supplied per account.
- A route refused repeatedly is answered from memory, with `Retry-After`, up to 60 seconds.
- Notifications are kept 90 days after their last event.
- A read lists 20 notifications at most.
- A private line's end is reported 3 days before.
- A device that was connected and then stays without a connection for 30 minutes is reported to its account, in one notification a day that counts the devices.
- Outcomes are read 31 days at most.
- Edges reread credentials every 1 second.
- A replaced credential answers `credential_replaced` for up to 30 days.
- One address may send the enrolment exchange 60 tokens that can enrol nothing per sign-in window; a live token never counts.
- Sign-up challenges last 10 minutes.
- A mailed link works once, for 15 minutes.
- A withdrawn device never connects again; for 30 days relays refuse it with no retry, then as unknown.
- An account enrols at most 1000 devices of its own a day, withdrawn ones counted, fewer if its device limit is lower.
- The Android app library shares at most 2 GB a day, and an app may only lower it.
- The operator makes at most 20 accounts an hour.
- Hosting networks add 4 challenge bits.
- A chat confirmation waits 10 minutes for its click.
- Chat confirmations and the record of chat actions are kept 90 days.
- Without an account, one address asks the chat at most 60 requests in a quarter of an hour.
- Guests together ask the chat at most 600 requests in a quarter of an hour.
- An account holds at most 5 lasting credentials: proxy passwords for its tools and agents.
- A model reads at most 100 requests of one account's chat a day.
- One account's chat uses at most 300000 model tokens a day.
- One chat message makes at most 4 requests of a model.
- A chat message a model reads reserves 148384 tokens of the day and is settled to what it used.
<!-- facts:end numbers.list -->
- IP class and carrier are decided by the network (ASN) a device exits from. The exit is measured on IPv4 only. A modified agent can recognise the measurement.
- A sticky session holds one device while it stays in the pool, then moves to another device.
- A city name that two states share selects both unless `state` is given.
- A proxy request to mail ports 25, 465, 587 and 2525, or to an IPv6 literal, is refused with `target_blocked`.
- One buyer's limit on simultaneous streams is counted per edge server.
- Traffic in flight when a balance runs out, an account is suspended or a byte cap is reached is charged in full until the stop takes effect (not measured yet). Traffic charged into debt earns the device owner nothing.
- A usage batch delivered more than 15 minutes late, across a device's change of country, is priced at the new country.
- A reversed payment does not take back earnings already credited to a device owner.
- An account saves at most 64 session sets of up to 1,000 sessions each. Saved sessions have no traffic counters.
- An account holds at most three open quotes with one provider. A refund or dispute is recorded for the operator to reverse by hand.
- The `limits` of every device session quote bound one account's sessions.
- A network in no reviewed list is classed by its operator name: hosting is a data centre, not sold; any other is residential, never mobile.
- An agent file marked `preview` in `/kit/index.json` was built for its system but not yet through Coronium's whole check there. Nothing in `/kit/` is signed yet.
- An account holds at most `terms.deviceLimit` devices (`GET /app/api/earnings`) when that is a number. Payouts are made by hand, one request at a time, from the payout minimum up. A payout request is proven with the access code.
- Top-ups are tested against provider stand-ins; `GET /app/api/buy` answers which way to pay is `configured`.
- No capacity figure is claimed for this build: throughput gates run on separate hardware, published with hardware, node count and duration.

This page: https://supply.coronium.ai/bandwidth-sharing. Updated 2026-12-01.

---
title: Peer bandwidth sharing for devices and apps
description: Share bandwidth from a device you own, or add a bandwidth sharing SDK to your app. What is shared, what a device earns, when it is paid, how to stop.
label: Bandwidth sharing
template: hub
audience: device-owners
updated: 2026-12-01
#facts:begin agent.supply
agent:
  instructions: "Search the documents of this site by keywords or a question. Send the text as q and read the Markdown that comes back: the passages that match, each under its source address and score. Nothing is generated."
  endpoint: "https://supply.coronium.ai/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://supply.coronium.ai/guides/search.md"
#facts:end agent.supply
---

# Peer bandwidth sharing: earn a share of what buyers pay

Bandwidth sharing means you let a network send web traffic out through an internet connection you already pay for, and you earn a share of what buyers paid for that traffic.

Earnings start once Coronium charges buyers, which `GET /app/api/buy` answers in `charging`. Nothing on this page is a guarantee of earnings.

## How bandwidth sharing works

<!-- kit:path -->
1. A buyer, or an AI agent that works for one, asks for a public web page and says which country it should be loaded from.
2. Coronium's edge takes the request, picks a device and counts every byte of the request and of the answer. It is the only meter.
3. The relay holds the one encrypted connection that each device opened outward, and passes the request down it.
4. The agent on your device opens the connection to the site and passes the bytes both ways. It opens no port on your network.
5. The site answers your device's public address, as it would answer you, and the answer travels back the same way.
<!-- /kit:path -->

## What is bandwidth sharing?

Your internet plan can carry more than you use. A buyer, often a company or its AI agent, needs to load a public web page from a real home or mobile connection, and your device fetches it for them.

People also call it peer bandwidth sharing, internet sharing or selling unused internet. Developers add it to an app or a fleet with [the bandwidth sharing SDK](/bandwidth-sharing/sdk).

## How do I share my bandwidth?

<!-- kit:steps -->
1. **Create an account** on [this site](/signup). An account is one access code, and an email address is optional.
2. **Read and sign [the partner agreement](/agreement).** It says what your device carries, what Coronium records and how earnings work.
3. **Add a device and run the agent.** The [farmer portal](/farmer) shows the commands for your system.
<!-- /kit:steps -->

A new device starts as fallback supply, which buyers reach only when no established device can serve them. An AI agent can take the same steps for you: [enrolment](/guides/device-enrol.md) has the calls, and the [agent page of the farmer portal](/farmer/agent) has the prompt.

## Is it safe?

It carries a real risk, and no network can honestly promise otherwise: other people's traffic leaves from your internet address, to sites they choose.

- **What is shared.** Your connection, its public address and your data allowance. Your DNS provider sees the names that are requested.
- **What is never touched.** Your files, your browsing and your own network. The agent reads its own settings and the system's DNS settings, certificate roots, network interfaces and routing table. It opens no listening port, and it refuses your home router and private address ranges.
- **What you control.** Nothing starts without your signature. Stopping the agent stops traffic at once, and you can pause, remove or withdraw a device.
- **What the software does not do.** It does not limit buyers to one site, and it keeps no record of destinations on your device. Coronium keeps that record and gives it to you on request.

Sections 3 and 4 of [the partner agreement](/agreement) state every destination rule the software enforces, and [update, stop, remove and withdraw](/guides/device-lifecycle.md) has the command for each system.

## Sell bandwidth: what a device earns and when it is paid

You earn a share of what buyers paid for the traffic your devices carried. Nothing else earns: not time online, not a sign-up and not a referral.

- **The share.** Each device earns the share in your account's terms, which `terms.shareBp` of `GET /app/api/earnings` answers. A buyer pays the price of the exit country's tier for each GB, and a device earns that share of it for each GB of paid buyer traffic it carried.
- **The hold.** Every earned amount is held, then released. The agreement states the longest hold.
- **The payout.** Once your released amount reaches the minimum, you request an exact amount in your account, in USDC or USDT.
- **Your costs.** You pay your own taxes, electricity, data and device costs.

<!-- facts:begin payout.day -->
Payouts are paid by hand on the 6th of each month, for requests received before it; later ones the next month.
<!-- facts:end payout.day -->

The farmer portal shows the terms in force for your account. [The statement guide](/guides/device-payouts.md) lists each field of the statement and works out what one GB would earn.

<!-- kit:callout limit -->
While Coronium does not charge buyers, statements read Unpriced and traffic earns nothing. There is no minimum traffic and no guarantee of earnings, and invented or padded traffic earns nothing.
<!-- /kit:callout -->

## Devices and systems that work today

| Way to connect | State | What to know |
|---|---|---|
| [Linux agent kit](/guides/device-linux-kit.md) | `available` | An installer and a service, for x86-64 and ARM64. |
| [Docker image](/guides/device-docker.md) | `available` | An image for x86-64 and ARM64. |
| [Windows](/guides/device-windows.md) | `available` | A program and a service script. It is not code-signed. |
| [macOS](/guides/device-macos.md) | `preview` | A program and a service script for Apple silicon. |
| [Routers](/guides/device-program.md) | `preview` | The program alone, started from a shell. |
| [Android app SDK](/guides/device-android-sdk.md) | `preview` | A library inside a publisher's app, never run on a phone. |
| iOS | `not_available` | The platform's review rules do not allow it. None is planned. |

<!-- kit:faq -->
### What do the state words mean?

`available` means Coronium took that exact file through its whole check on that system, or the owner made it available by a recorded decision. Such a file keeps the limit `not_run_by_coronium`: the Docker image, the Windows files and the Linux ARM64 files carry it. `preview` means the file was built for the system and not taken through that check.

The states above are Coronium's record of each way. `/kit/index.json` answers what this site publishes today, file by file, and a build may publish less. [The agent files](/guides/device-files.md) explains each file's state and limits. Nothing in `/kit/` is signed yet, so a digest is only as trustworthy as the HTTPS connection to this site.

### What do I need to share bandwidth?

- A device and an internet connection that are yours to use this way, on a plan whose terms allow it.
- A home or mobile network. A device on a hosting or data-centre network is withheld as `class_not_sold` and earns nothing.
- A connection of its own for each device. On a residential network a second device behind the same public address is withheld as `same_exit`.
- A network you control: not an employer, school, library or hotel network.
- The knowledge of everyone else who uses the connection that it is shared.
- An adult who signs for a business or an independent activity, not as a consumer.

A new account may hold a small number of devices. The farmer portal shows the limit in force, and Coronium may allow an account more.
<!-- /kit:faq -->

## Earn from unused internet: five checks before you join any network

Many networks pay for unused internet. Put the same questions to each one before you install anything, this one included.

- **What is paid for?** A share of real buyer payments, a rate per GB, or time online. Find out where the figure comes from.
- **Who counts the traffic?** The count should be one you can read, line by line.
- **What does the software do on your device?** Check whether it opens ports, reads files or updates itself.
- **Is your consent recorded?** You should be able to read the exact text you agreed to, later, with its version.
- **Is a monthly sum promised?** Demand decides what a device carries. Nobody can promise a fixed sum.

Coronium's answers are on this page and in [the partner agreement](/agreement). Ready to share? [Create a device owner account](/signup).

## Bandwidth sharing SDK for your app

For developers and publishers there is an Android library, and the agent itself for desktops, device products and fleets. The library is `preview`, with three limits:

- It is only for an app whose stated main purpose is sharing its user's connection.
- Its notice to the user is proposed and not approved, so it cannot ship to users today.
- It was run on a development Android instance, never on a phone.

[The bandwidth sharing SDK page](/bandwidth-sharing/sdk) states what your users must be shown, how earnings are attributed and each integration step.

## For large buyers

This supply is what buyers send traffic through. Companies and their AI agents buy it as mobile and residential proxies, paid per GB from one balance, on [coronium.ai](https://coronium.ai/). Every exit is a real device whose owner signed the partner agreement, and one meter at the edge counts each byte for the buyer and for the device owner alike.

## Bandwidth sharing questions and answers

<!-- kit:faq -->
### Is bandwidth sharing safe?

It carries a real risk. What limits it here: the agent opens no port, reads none of your files and refuses your own network, and you can stop at any time. What does not: buyers are not limited to one site, and you answer for your device and your connection, as section 9 of [the partner agreement](/agreement) says.

### What traffic passes through my device?

Connections that buyers open to public internet addresses they choose. The agent passes the bytes both ways and keeps no record of destinations. It refuses your own network, and Coronium's servers refuse the mail ports. Section 4 of [the partner agreement](/agreement) lists every refused destination.

### Does bandwidth sharing slow my connection?

It can. Shared traffic uses the same line as your own. The agent carries up to a set number of connections at once, the default of one of its settings, and the desktop agent sets no daily limit on bytes. Coronium publishes no speed figure, so this page states none. If your line feels slow, stop the agent.

### How much can I earn by sharing bandwidth?

Coronium promises no traffic and no earnings. What a device earns is decided by whether Coronium charges buyers, the share in your account's terms, the price tier of the country your device exits from, and how much paid buyer traffic it carried. A new account's devices are fallback supply, so a new device may carry little.

### When are device owners paid?

Device owners are paid on request, once a month. An earned amount is held first and then released. When your released amount reaches the minimum, you request it in your account. The section "Sell bandwidth" on this page states the payout day.

### Which devices can share bandwidth?

A Linux machine, a machine that runs Docker, and a Windows machine are `available` today. macOS and routers are `preview`. Android works only through the library inside a sharing app. There is no iOS app.

### Can I run many devices?

Yes, within the device limit of your account, with a connection of its own for each. Enrolment by token is the way to add many devices once its routes are open: [many devices](/guides/device-tokens.md) has the calls.

### What happens to my IP address reputation?

The sites that buyers reach see your address. A site that sees a lot of traffic from one address may slow it, add checks or block it, and a block list may list it. Coronium does not promise otherwise and is not liable for a blocked or listed address. To keep the two apart, share a connection that you do not use yourself.

### Is bandwidth sharing allowed by my internet provider?

That depends on your plan. Some providers forbid sharing or reselling a connection. You confirm that your provider's terms allow it for every device you add, so read them first.

### How do I stop sharing?

Stop the agent. Traffic stops at once, and you need nobody's permission. [Update, stop, remove and withdraw](/guides/device-lifecycle.md) has the command for each system.
<!-- /kit:faq -->

<!-- facts:begin sentence -->
Mobile and residential proxies for AI agents: real IP addresses on real devices, and next the phones, Macs and browsers an agent can drive.

One account, one balance, one file to read.
<!-- facts:end sentence -->

This page: https://supply.coronium.ai/bandwidth-sharing/sdk. Updated 2026-12-01.

---
title: Bandwidth sharing SDK for apps and fleets
description: The Android library and the agent for desktops and fleets, as they stand today: what your users must see and agree to, how earnings are attributed, each step.
label: Bandwidth sharing SDK
template: article
audience: device-owners
updated: 2026-12-01
#facts:begin agent.supply
agent:
  instructions: "Search the documents of this site by keywords or a question. Send the text as q and read the Markdown that comes back: the passages that match, each under its source address and score. Nothing is generated."
  endpoint: "https://supply.coronium.ai/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://supply.coronium.ai/guides/search.md"
#facts:end agent.supply
---

# Bandwidth sharing SDK for apps, devices and fleets

Coronium has two ways to put bandwidth sharing into a product: an Android library for an app whose purpose is sharing, and the agent itself for desktops, device products and fleets. This page states each as it stands today.

The Android library is `preview` and cannot ship to users yet: its notice to the user is not approved.

## The Android library, as it stands

The Android library lets the user of your app share the phone's connection. `/kit/index.json` lists it as `preview`, with three limits:

- `sharing_apps_only`: it is only for an app whose stated main purpose is sharing its user's connection. It never ships inside a game, a utility or any other app. [Store declarations](/guides/device-android-store.md) says where such an app may ship.
- `notice_proposed`: the notice the library shows its user is proposed and not approved. Until it is, this site enrols no device from an app, and an app that is not debuggable opens no consent screen.
- `container_run_only`: it was run end to end on a development Android instance, never on a phone.

So today you can build with the library and test it in a debuggable app. [The Android library](/guides/device-android-sdk.md) has the dependency, the calls and the states.

## Desktops, home servers and fleets: the agent and enrolment by token

A desktop app, a device product or a fleet runs the same agent a device owner runs: the Linux kit, the Docker image, the Windows program or the program alone. Each device must sit on a home or mobile network. A machine in a data centre earns nothing.

For many devices, enrolment by token lets each device enrol itself. The device holds no session and no access code, and no device secret crosses the network. The token routes answer `enrol_tokens_off` until the operator opens them, and an app token answers `app_devices_off`. Until then your account adds each device with `POST /app/api/devices`. [Many devices](/guides/device-tokens.md) has the calls.

## What your users must be shown and agree to

In an Android app, the library does this itself, and your app may not change it:

- Only the user turns sharing on, on a screen the library shows, with the sharing notice unchanged. `/kit/APP-NOTICE.md` is that notice.
- Your app cannot turn sharing on, hide it, restyle or shorten the notice, accept it for the user or bring it back after a no. It may always turn sharing off.
- No other feature of your app may depend on sharing.
- While the phone shares, a notification says so and carries `Turn off`.
- The phone shares only while it charges and its network is not metered: not on mobile data, not while roaming and not through a VPN.
- The notice states a daily limit. Your app may lower it and may never raise it.
- Your privacy policy, your store listing and your app name the sharing and what Coronium receives.
- An app aimed at children may not hold the library.

For desktops and fleets, the account that mints a token signs the partner agreement, and every device added with that token is added by that account. You need the yes of each device's owner, and everyone who uses the connection must know that it is shared.

## How earnings are attributed

- Every device enrolled under your account, by token or one by one, earns for your account. Your statement lists each day, device and country with the bytes, what buyers paid and your share.
- Each device earns the share in your account's terms, which `terms.shareBp` of `GET /app/api/earnings` answers. There is no payment per install or per active user, and no referral or bonus scheme.
- Rewards to your users are yours to pay. Keep each device id beside your own user. A reinstall is a new id.
- `GET /app/api/devices` filters devices by `token` and by `app`, and counts them for each app.
- The edge alone meters. The library's own daily count is a stop on the phone and is sent nowhere.

## Integration steps

<!-- kit:steps -->
1. Make the account and sign the partner agreement: [enrolment](/guides/device-enrol.md).
2. Choose the file for each system and check its digest: [the agent files](/guides/device-files.md).
3. Run it: [the Linux kit](/guides/device-linux-kit.md), [a container](/guides/device-docker.md), [Windows](/guides/device-windows.md), [macOS](/guides/device-macos.md) or [the program alone](/guides/device-program.md).
4. For many devices, mint a token and let each device enrol itself: [many devices](/guides/device-tokens.md).
5. In an Android app, add the library and read the store rules: [the Android library](/guides/device-android-sdk.md) and [store declarations](/guides/device-android-store.md).
6. Watch each device's state and health: [device states](/guides/device-states.md) and [device health](/guides/device-health.md).
7. Read what each device earned and how it is paid: [the statement guide](/guides/device-payouts.md).
<!-- /kit:steps -->

[Every integration in one file](/guides/integrate.md) holds all of these in order, as Markdown for you or for an AI agent. [The API document](/openapi.json) has every call, and [the index for agents](/llms.txt) says which file answers which question.

## What is on request

<!-- kit:callout on-request -->
These are not open to every account today. Write to Coronium at the contact the partner agreement names, and say what you need.

- Shipping the Android library to real users, which waits for the approved notice.
- Enrolment by token, while its routes answer `enrol_tokens_off`.
- More devices than a new account may hold.
- A library for another platform, such as a smart TV or a desktop app. None is built.

There is no iOS library, and none is planned: the platform's review rules do not allow it.
<!-- /kit:callout -->

What sharing means for the person whose connection it is, and what a device earns, is on [the bandwidth sharing page](/bandwidth-sharing). To start, [create an account](/signup).

<!-- facts:begin sentence -->
Mobile and residential proxies for AI agents: real IP addresses on real devices, and next the phones, Macs and browsers an agent can drive.

One account, one balance, one file to read.
<!-- facts:end sentence -->
