A gateway can replace its own binary from a signed release. The pieces:
scripts/build-release.sh <version> <base-url>. The version is stamped into the binary (main.version), and -version prints it.
nostrino-release writes manifest.json as compact JSON (pretty-printing wouldre-space the signed bytes and break the signature), a JSON envelope of the manifest bytes and an Ed25519 signature over exactly those bytes. Each artifact is named with its SHA-256 and size.
-update-url and -update-pubkey. It fetchesthe manifest, verifies the signature, refuses anything not newer, matches its platform, downloads the artifact, and checks the digest before writing.
the old binary is kept as <path>.prev so a bad release is a rollback away. The gateway then
execs the new binary, so the process that serves the relay is the new code, with no window in
which two gateways hold the same key.
SIGHUP checks and applies. The admin channel does the same over the relay, so anoperator can update a remote gateway without shell access.
It is off unless the gateway is started with `-debug-admin` and at least one -admin <pubkey>.
Without both, the gateway never subscribes to the admin kind, so there is no code path that can
receive a command: the capability does not exist on a production gateway.
Commands, each answered with JSON even when refused:
| command | what it does |
|---|---|
version | the running version and served chains |
health | the same report -health-listen serves |
update-check | fetch and verify the manifest, install nothing |
update-apply | install a newer signed release, then exec into it |
rollback | restore <path>.prev and exec into it |
The operator's key is a Nostr secp256k1 key, not the release key and not SSH:
nostrino-admin -genkey # prints a secret, then the matching public key
Put the public key in -admin on the gateway, keep the secret on the operator's machine, and send:
nostrino-admin -key <secret> -gateway <gateway pubkey> -relay wss://swaprelay.smesh.lol -cmd version
The command is a NIP-44 encrypted kind-23198 event signed by the operator's key; the gateway
authorizes the author against -admin before it decrypts, and replies on the same kind.
A gateway is often run by more than one person, and every one of them should be able to watch it
and to update it without a shared secret. -admin is repeatable and comma-separated, and every
listed key has the same rights: all five commands, and the health report.
-admin d023f6ea…,18562433… # or -admin d023f6ea… -admin 18562433…
Three consequences worth knowing:
version, health and update-check run concurrently, soone administrator's health poll answers while another's update is downloading.
update-apply or rollback at the same moment, the second is answered `administrator <hex> is already replacing
the running binary; one control operation at a time` instead of queueing behind a download it
would then refuse as "not newer".
admins: ["…"], so a new administratorcan confirm their key is registered and an existing one can see they are not alone.
The deployed policy for swaprelay.smesh.lol is kept in docs/swaprelay-policy.json (the live copy
is /etc/torly/policy/swaprelay.json on the relay host). On the relay side, the policy's kind-23198
rule needs the key of every operator and of every gateway that answers on that relay:
the reply is published by the gateway, so a gateway whose key is absent from authors receives
commands and its answers are dropped — which looks like a gateway that ignores its operator.
It can withhold updates and it can serve an older manifest. It cannot make a gateway run a binary
that was not signed by the release key, because the signature covers the manifest and the manifest
names the hash of every artifact. It also cannot make a gateway downgrade below its running
version, or below min_version when the release sets one.
The release key is therefore the whole security boundary: keep it offline, sign releases on a machine that does not run a gateway, and publish only the public half.
Releases are GitHub release assets on mlekudev/nostrino-releases (public, binaries only — the
source lives on the gitea host). The manifest is uploaded as an asset too, so the gateway can be
pointed at a URL that never changes:
-update-url https://github.com/mlekudev/nostrino-releases/releases/latest/download/manifest.json
-update-pubkey 25a69c9cd27498feaf8af556a57bb3e059a216e6f99ab35fb2c3d941202ce3a1
scripts/publish-release.sh <version> <owner/repo> builds both platforms, signs the manifest with
artifact URLs under releases/download/v<version>, and runs gh release create with the four
assets. git.smesh.lol is the git host and serves repositories, not artifacts, so it is not the
release URL; the static host under relay.orly.dev still has the 0.3.1/0.3.2 copies and can serve
as a mirror.
The relay must accept kind 23198 for the admin channel: a policy rule with require_auth, the
operator key and the gateway key as authors, and a small rate limit. Without it the relay drops the
command under default deny and the gateway never sees it — which looks like a broken gateway.
Each release also carries nostrino-admin-<version>-<os>-<arch>, the operator CLI that sends the
commands. It is deliberately not in the manifest: the manifest describes what a gateway installs
into itself, and a gateway must never install an operator tool over its own binary. The gateway
ignores assets it is not pointed at; the operator checks the CLI's digest from the release notes.
A gateway picks up the update channel only when it is started with all four flags, and it installs the next release into the file it is running from. So the one manual install has two rules:
execs a different file).
nostrino-bridge \
... existing flags ...
-debug-admin \
-admin <operator pubkey> \
-update-url https://github.com/mlekudev/nostrino-releases/releases/latest/download/manifest.json \
-update-pubkey 25a69c9cd27498feaf8af556a57bb3e059a216e6f99ab35fb2c3d941202ce3a1
With those in place, SIGHUP and the admin channel both check the manifest and install a newer
signed release. The old binary is left as <path>.prev for rollback.
Where the file lives matters more than how it is started:
| deployment | where the binary goes | updates survive |
|---|---|---|
| systemd unit on the host | /opt/nostrino/nostrino-bridge, ExecStart=/opt/nostrino/nostrino-bridge ... | yes |
| container with a volume | the volume, e.g. /data/nostrino/nostrino-bridge, entrypoint runs that path | yes, until the container is recreated |
| container image only | the image's /usr/local/bin | no — recreated from the image, the update is lost |
On a recreated container the gateway simply comes back on the image's version and updates itself
again; it is not a failure, just a wasted download. The version command says which one is running.
NOSTRINO_RELEASE_KEY=~/.config/nostrino/release.key \
./scripts/build-release.sh 0.3.0 https://downloads.example/nostrino
# publish dist/* and dist/manifest.json; the gateway needs only -update-url and -update-pubkey
go run ./cmd/nostrino-release -check dist/manifest.json -pubkey <public hex>