--- name: rholo-node-cloudflare description: >- A rholo testnet node on Cloudflare — use when asked to run, deploy, or host a rholo (RChain in Rust) node, observer, or validator on Cloudflare Workers or Containers; when an agent must ask its host for the rights to do so, by `define` or by hand. Covers what fits (an observer, as an experiment), what doesn't (a validator), and the rights to ask for. Not for running a node on a VPS: follow rholo's own setup guide. --- # A rholo testnet node on Cloudflare Read rholo's [Running a node](https://github.com/rhovision-org/rholo/blob/dev/docs/src/node/validator-observer-setup.md) and [the public testnet](https://github.com/rhovision-org/rholo/blob/dev/docs/src/node/testnet.md) first; they are the authority on flags, ports and genesis. This skill says how they meet Cloudflare. ## An observer fits; a validator doesn't A node needs inbound 40400 (protocol) and 40404 (discovery) **from every peer**; one that admits inbound only from its bootstrap sits at height 0 ([setup guide §3](https://github.com/rhovision-org/rholo/blob/dev/docs/src/node/validator-observer-setup.md#3-network-and-firewall--accept-inbound-from-every-peer)). A [Container](https://developers.cloudflare.com/containers/) gets no inbound TCP from the Internet: requests reach it only through its Durable Object, by `ctx.container.getTcpPort(port).fetch()`. And a Container's disk is ephemeral and at most 20 GB, against rholo's minimum of 100–250 GB NVMe. So: - **Validator: no.** It must take inbound from every peer and stay up; an absent one holds finality back. - **Observer: an experiment.** rholo's fallback for a host that can't take inbound is to seed its data directory from a synced node, minus `node.key.pem` and `node.certificate.pem`. Whether an outbound-only observer then *follows the tip* is unmeasured; measure it before calling it running. - **Read-only watcher: yes.** A Worker that polls nodes' HTTP APIs (`/api/status`, `/api/last-finalized-block`), in the manner of [rho-observer](https://github.com/rhovision-org/rho-observer), needs no Container at all. ## The observer's shape - A Worker with one Durable Object class that owns a Container (`scheduling_policy: "durable_object"`), its image built from rholo's `docker/rnode/Dockerfile`, with `--build-arg GIT_HEAD_COMMIT` so `/version` names the commit. - Instance: custom, up to 4 vCPU, 12 GiB, 20 GB disk; rholo's testnet minimum is 2–4 vCPU and 8 GB RAM. - Start the node as an observer: no `--validator-private-key-path`, `--no-upnp`, the testnet's `--bootstrap` and genesis inputs, `--host` naming nothing peers can dial (there is none). - **Seed on every start.** Keep a seed tarball of a synced data directory in R2, or a [container snapshot](https://developers.cloudflare.com/containers/guides/snapshots/); a host restart otherwise starts from nothing. - **Keep it awake** with a Durable Object alarm that runs more often than `setInactivityTimeout()` (at most 6 hours). - **Expose 40403 only**, the HTTP API, through the Worker's `fetch`. Never 40402 (propose/repl) or 40405 (admin). - Billing is per provisioned memory and disk while it runs, so 8 GiB around the clock is the bulk of the cost; check [Containers pricing](https://developers.cloudflare.com/containers/platform/pricing/) before promising a number. ## Rights: ask for each one, narrowly An agent starts with nothing but messaging to its host. With toybox's `define`, it sends one definition whose slots name exactly what it needs, and the host decides what to bind to each: | slot | what it's for | narrowest binding | |---|---|---| | `deploy` | create and update one Worker, its Container and DO | deploy of one named script, not the account | | `seed` | write and read the seed tarball | one R2 bucket, or one prefix | | `seedFrom` | copy a synced node's data directory | read-only, excluding the node key and certificate | | `logs` | see why a start failed | tail of that one Worker | Ask for no faucet key, no validator key, and no admin port: an observer needs none. If more turns out to be needed, send another definition. Until a Cloudflare device exists to bind those slots to, do the same by hand: prepare the Worker, Dockerfile and `wrangler.jsonc` in a branch, then send the host the commands to run and what each one needs, such as `wrangler deploy` (deploy) and `wrangler r2 object put` (seed). The host runs them with their own login. Don't ask for an account-wide API token to save the host a step. Keep the host's account id, hostnames and tokens out of anything public. ## Sources - [Running a node: testnet now, mainnet later](https://github.com/rhovision-org/rholo/blob/dev/docs/src/node/validator-observer-setup.md) — roles, ports, the inbound rule, seeding a node that can't take inbound. - [Running a validator: hardware requirements](https://github.com/rhovision-org/rholo/blob/dev/docs/src/node/validator-requirements.md) — 2–4 vCPU, 8 GB RAM, 100–250 GB NVMe minimal. - [Containers limits](https://developers.cloudflare.com/containers/platform/limits/) and [FAQ](https://developers.cloudflare.com/containers/faq/) — instance sizes; disk is ephemeral. - [Workers TCP sockets](https://developers.cloudflare.com/workers/runtime-apis/tcp-sockets/) — inbound TCP from outside Cloudflare is "coming soon".