Ragnarök Forge docs
Wrap any command, pay only for the seconds it ran, and get back a receipt signed by the node that ran it.
Quickstart
Needs Node 18.17 or newer. The package has no dependencies.
# run once without installing
npx ragnarok-forge run -- echo hello
# or install the command
npm install -g ragnarok-forge
Without --cloud the command runs on your own machine. Seconds are metered and the receipt is signed for real, but no money moves (settlement: simulated). Use it to see how billing works before you fund anything.
$ ragnarok run --budget 2.00 -- python scraper.py
✓ session opened 0x7f3a…c21e
⧗ metered 412s ████████████ 0.1648 USDG
✓ receipt signed ~/.ragnarok/receipts/0x7f3a….json
✓ settled 0.1648 USDG · refund 1.8352 USDG (simulated)
Run in the cloud
Your account is the ed25519 key the CLI creates at ~/.ragnarok/node.key. There is no sign-up and no API key: every request is signed with that key.
# --cloud sends the command to the Ragnarok node
ragnarok account --cloud # your account id and balance
ragnarok run --cloud --worker python --budget 0.05 -- python -c "print(6*7)"
# or set it once for every command
export RAGNAROK_CLOUD=https://api.ragnarokcloud.com
- Opening a session holds the budget from your balance. Stopping it pays for the seconds the sandbox was up and returns the rest.
- When the budget runs out the sandbox is destroyed.
- Workers:
shell(Alpine 3.20),python(3.12),node(22),ubuntu(24.04). - To run several commands, wrap them in one shell:
ragnarok run --worker shell -- sh -c 'cmd1; cmd2'.
Fund your account
Balances are paid in USDG on Robinhood Chain through the RagnarokVault contract. The node credits your account after 3 confirmations.
In the browser
Run ragnarok fund for your account id and a ready link, or ragnarok account for the id alone, then open ragnarokcloud.com/fund. Connect a wallet, approve USDG and deposit. The CLI also prints a link with your account already filled in.
From a wallet or script
Approve the vault for the amount, then call deposit(bytes20 account, uint256 amount). USDG has 6 decimals, so 1 USDG is 1000000.
| Item | Value |
|---|---|
| Chain | Robinhood Chain (4663) |
| Vault | posted here once the vault is live |
| Token | USDG 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168 |
Deposits pay for compute on this node. They cannot be withdrawn back to the depositor. Unused session budget always returns to your balance.
Sandbox limits
Each session gets its own container under gVisor, a user-space kernel that keeps your code away from the host.
/workCommands
| Command | What it does |
|---|---|
ragnarok run -- <cmd> | Runs the command, meters it by the second, stops it when the budget runs out, signs a receipt. Takes --budget, --worker, --cloud. |
ragnarok account | Your account id. With a node: balance, deposits and recent sessions. |
ragnarok quote <seconds> | What that many seconds cost. |
ragnarok receipts | Every receipt on this machine, newest first. Add --json for scripts. |
ragnarok verify <file> | Checks a receipt's signature. Any edit to any field breaks it. |
ragnarok whoami | Your key's id and public key. |
ragnarok fund | Your account id and the link to fund it. |
ragnarok mcp | Runs the Forge as an MCP server over stdio. See MCP. |
run exits with the command's own exit code, or 124 when the budget ran out.
Receipts
Every session ends in a JSON receipt saved under ~/.ragnarok/receipts/.
{
"session": "0x7f3a…c21e",
"worker": "python",
"seconds": 412,
"paid": "0.164800 USDG",
"refund": "1.835200 USDG",
"status": "completed",
"settlement": "ledger",
"output": "sha256:91c7…",
"node": { "id": "0xbf86…c85d", "pub": "MCow…" },
"sig": "5d0a…"
}
outputis the sha256 of everything the command wrote to stdout and stderr, in order.sigis an ed25519 signature over the canonical JSON of every other field.node.idis derived from the node's public key, so a receipt cannot swap in another key.
JavaScript SDK
import ragnarok from "ragnarok-forge";
const session = await ragnarok.open({ worker: "python", seconds: 600, cloud: "https://api.ragnarokcloud.com" });
const out = await session.exec("python main.py"); // { code, stdout, stderr }
const receipt = await session.stop();
ragnarok.verifyReceipt(receipt); // { ok: true }
open takes budget or seconds, plus an onTick callback. Leave out cloud to run locally.
Python SDK
Same account as the CLI (~/.ragnarok/node.key), same receipts folder. Needs Python 3.9+.
pip install ragnarok-forge
from ragnarok_forge import Forge
forge = Forge() # RAGNAROK_CLOUD, or the public node
print(forge.fund_url()) # fund this account
with forge.open("python", budget="0.25") as s:
r = s.run("python -c 'print(6*7)'")
print(r.code, r.stdout) # 0 42
print(s.receipt["seconds"], s.receipt["paid"], s.receipt["refund"])
forge.run(cmd, worker, budget) does open, run and stop in one call and returns (result, receipt). verify_receipt(r) checks any receipt; quote(seconds) prices a run.
MCP
Give Claude, Cursor or any MCP client a sandbox it pays for by the second. Add this to the client's MCP config:
{
"mcpServers": {
"forge": {
"command": "npx",
"args": ["-y", "ragnarok-forge", "mcp"],
"env": { "RAGNAROK_CLOUD": "https://api.ragnarokcloud.com" }
}
}
}
| Tool | What it does |
|---|---|
forge_run | Runs {cmd, worker, budget} in a fresh sandbox and returns exit code, output and the receipt. |
forge_account | Account id, balance, held funds, recent sessions. |
forge_quote | What a number of seconds costs. |
forge_receipts | Receipts saved on this machine. |
forge_verify | Checks a saved receipt's signature. |
Without RAGNAROK_CLOUD the server refuses to run anything, unless you set RAGNAROK_MCP_LOCAL=1: then commands run on your own machine with no sandbox.
HTTP API
Base URL https://api.ragnarokcloud.com. The CLI and SDK sign requests for you.
| Endpoint | Returns |
|---|---|
GET /v1/node | Node id, rate, workers, deposit details. Public. |
GET /v1/account | Balance, held funds, deposits, recent sessions. |
POST /v1/sessions | Opens a sandbox and holds the budget. Body {worker, budget}. |
POST /v1/sessions/:id/exec | Runs {cmd}, output streamed as NDJSON. |
POST /v1/sessions/:id/stop | Closes, settles, returns the signed receipt. |
GET /v1/receipts/:id | A closed session's receipt. Public. |
Signed requests carry x-ragnarok-key, x-ragnarok-ts, x-ragnarok-nonce and x-ragnarok-sig, an ed25519 signature over METHOD\nPATH\nTS\nNONCE\nsha256(body). Requests older than 60 seconds or with a reused nonce are refused.
Vault
The Ragnarök Vault keeps what your AI apps should know about you. It is encrypted in your browser (AES-256-GCM, key from PBKDF2 of your rune key or 24-word phrase) before anything is stored.
- Sync. The encrypted block is kept on this site so the same key opens it on any device (Already have a vault on another device? on the vault's first screen). The server stores ciphertext and a hash of an auth token derived from your key; it never sees the key.
- Apps. Each app gets its own key and only the halls you switch on. Your browser encrypts a copy of just those halls for that key. Revoking deletes that copy, so the key fails on its next request.
- Saga log. The server writes a log entry every time an app fetches its copy, before it answers. Your browser pulls those reads in.
- Runestones. Every hour the server folds the new reads into a Merkle root chained to the previous one. Verify any read against its stone in the Runestones tab.
- Ravens. Apps can suggest a memory. It arrives encrypted and waits until you keep, merge or reject it.
- Legacy. Saving a legacy seals a copy for your heir with a key that exists only in the heir link. The server releases it after the number of days you chose without the vault being opened.
- Sharing, import, backup run entirely in your browser.
Vault MCP
Connect an app to your vault with the key from the vault's Apps tab:
{
"mcpServers": {
"ragnarok": {
"command": "npx",
"args": ["-y", "ragnarok-vault-mcp"],
"env": { "RAGNAROK_APP_KEY": "rgk_…" }
}
}
}
| Tool | What it does |
|---|---|
search | Searches the memories this app may read. |
list_halls | The halls this app may read, with counts. |
read_memory | One memory in full, by id. |
recent | The newest memories, optionally in one hall. |
suggest | Sends a memory to your Ravens. Nothing is saved until you keep it. |
ask_self | Your self card: your summary plus the newest memory per hall. |
npx ragnarok-vault-mcp --check with the key set prints what that key can read.
Run a node
A node runs strangers' code, so give it a server of its own. On a fresh Ubuntu 22.04/24.04 server with DNS pointing at it:
git clone https://github.com/ragnarokforge/ragnarok-forge.git && cd ragnarok-forge
sudo DOMAIN=api.example.com bash deploy/install.sh
The script installs Docker, gVisor, Node 22 and Caddy, pulls the four worker images and starts the service. Limits live in deploy/ragnarok.service. To take deposits, deploy contracts/RagnarokVault.sol and set RAGNAROK_VAULT and RAGNAROK_VAULT_FROM.