Skip to main content

Running on Solana

A node can take payments on Solana as well as on Algorand. The node binary, your models, your prices and your backend are the same on both. What changes is the chain the payments run on: the keys, the fees, how payouts reach you, and a few settings.

Solana support is experimental and runs on Solana devnet only, Solana's public test network. Payers there pay in Circle's devnet USDC, which has no value. ZeroSignal has no Solana mainnet deployment.

You can run Solana two ways:

  • A Solana node, which serves only Solana payers.
  • Both rails from one node: an Algorand node that also serves Solana payers under a path of its own. See Serving both rails.

What's different on Solana​

AlgorandSolana
Networksmainnet, testnet, localnetdevnet, localnet
Payments run throughthe escrow appthe zs_escrow program
Signing key pays fees inALGOSOL
A settled charge goes toyour owner address, directlyyour node's vault, then to your owner on a schedule (Payouts)
Stake (USDC)$250 per operator, $25 per extra nodeset by the program; devnet: $5 per operator, $1 per extra node
Optional namean NFDa .sol name, shown in place of your address
Built-in HTTPS and IP syncavailable (Reaching your node)not available; bring your own certificate or proxy
Ticket lifetime (zs.ticket_ttl)your choiceat most 30 s
A free model's turnsettles on-chain at zeroopens nothing on-chain; your node's own budget limits it

Register on Solana​

Register on the operator dashboard as you would on Algorand (Registering on-chain), with the network set to Solana devnet and a Solana wallet (Phantom, Solflare, or another wallet the dashboard lists) connected as your owner.

The owner wallet pays for three things: the USDC stake, the SOL rent of your operator and node accounts, and the network fees. Get devnet USDC from faucet.circle.com with Solana Devnet selected, and SOL from faucet.solana.com.

When you add the node, give it your signing key's address (below) and your node's public HTTPS URL. On a node serving both rails, the Solana URL is the same host followed by the Solana path, for example https://node.example.com/sol.

Payouts go to the owner's associated USDC token account, the standard USDC account of that wallet. Registering stakes USDC from it, so it exists then; keep it open and unfrozen afterwards. zs-node init and zs-node doctor check it.

The signing key​

The node loads its Solana signing key from the same places as an Algorand one: a *_MNEMONIC variable or a ZS_MNEMONIC_URLS entry (Environment variables). It accepts three forms:

  • A wallet recovery phrase, 12 to 24 words, which loads as the wallet's first account (m/44'/501'/0'/0'), the one Phantom and Solflare show.
  • A solana-keygen keypair file: ZS_MNEMONIC_URLS=signing=file:///path/to/node.json.
  • A base58 secret key, as a wallet's "Export private key" gives it.

To make a new key, run solana-keygen new -o node.json and load the file:

export ZS_MNEMONIC_URLS=signing=file:///path/to/node.json
warning

solana-keygen new also prints a phrase, but derives its key with no path, so that phrase loads a different address here. Load the keypair file it wrote instead.

A literal: entry in ZS_MNEMONIC_URLS can't hold a keypair file's JSON array, because its commas separate entries; use the key's base58 form.

Generate the config​

zs-node init writes a Solana node's config when you name a Solana network:

zs-node init --base-url=http://127.0.0.1:8080/v1 --network=solana-devnet

It writes a chain: block in place of the algod block and zs.escrow_app_id. Its on-chain check reads your operator and node accounts, checks that the keystore holds the signing key, that the key has enough SOL to start and for payers to route to it, and that the owner has a USDC account. When the key is short of SOL:

zs-node fund-signer --airdrop # asks the devnet faucet for SOL

Without --airdrop, fund-signer prints what the key holds against the floors below and what to send to reach your warning threshold.

A Solana node refuses the Algorand-only settings: the algod block, zs.escrow_app_id, the NFD fields, server.tls.mode: acme, and server.tls.ip_sync. Serve HTTPS with server.tls.mode: manual and a certificate of your own, or behind a reverse proxy or load balancer that terminates TLS.

The chain block​

chain:
rail: solana
network: devnet
KeyDefaultNotes
rail—solana. With no chain block the node is an Algorand node.
network—devnet or localnet. The preset supplies rpc_url and program_id.
rpc_urlthe preset'sA private or paid RPC. Devnet's public RPC is rate-limited; a busy node wants its own. Set it with NODE_CHAIN_RPC_URL when the URL carries a key.
program_idthe preset'sThe payment program, base58. Required when network is unset.
open_policyparityWhen a paid request starts its work. parity starts once the RPC accepts the payer's payment and stops the work if the payment then fails to land. strict waits until it lands, so no work is ever served unpaid, at the cost of the landing time on every request.
open_commitmentfinalizedWhen a payment counts as landed: finalized, or confirmed, which is faster.
payout_interval1hHow often the node sends its accrued payouts and fees out of its vault. At least 1m. See Payouts.
payout_min_micro_usdc1000000The least the node sends at once, one USDC by default. Each send costs a network fee, so a minimum near zero spends more than it moves.
free_daily_tokens1000000Tokens your free models serve per UTC day. See Free models.
free_max_in_flight2Free turns running at once.
free_credit_issuersthe preset'sThe free-credit issuers you trust, as base64 Ed25519 public keys. [] trusts none.
free_uncredited_share0.5The part of the free budget turns without a credit may use, while you trust an issuer. Above 0, at most 1.

NODE_CHAIN_RAIL, NODE_CHAIN_NETWORK, NODE_CHAIN_RPC_URL and NODE_CHAIN_PROGRAM_ID override the block.

Two more settings take a Solana form:

  • zs.ticket_ttl is at most 30s on Solana, so a payer's payment still lands inside the life of the blockhash it was signed against.
  • zs.min_charge.lamports is the network-fee part of your minimum charge, in lamports, converted to USDC at the node's SOL/USD price. It takes the place of algo_txns. It defaults to 0; set it to about 15200 to recover what your signing key pays per request (below). See zs.min_charge.

Keep the signing key funded with SOL​

Your node's signing key pays the network fees of each paid request: about 10,120 lamports to land the payer's payment (two signatures, plus a small priority fee) and about 5,060 to end it. Budget about 15,200 lamports (0.0000152 SOL) per paid request, plus a fee for each payout the node sends. The payer funds the rent of each request's ticket account from its own rent pool; that cost isn't yours.

A Solana account must keep a rent-exempt reserve of about 0.00089 SOL, so the node counts only the SOL above it as spendable. Three thresholds apply:

Spendable SOLWhat happens
under 5,060 lamportsThe node refuses to start.
under 10,120 lamportsProxies and the web client stop routing to the node; it logs an ERROR.
under zs.signing_balance.warn_below_solThe node logs a WARN. Default 0.05 SOL, a few thousand requests' fees.

The spendable balance is published as zs_signing_balance_sol on /metrics. A relay-only node serves no paid requests and needs no SOL.

Payouts​

On Algorand a settled charge goes straight to your owner address. On Solana it goes to your node's vault, a USDC account the program holds for the node, and the protocol fee waits there too. Every chain.payout_interval (an hour by default) the node sends each accrual on once it reaches chain.payout_min_micro_usdc: your earnings to the owner the operator account names at that moment, and the fees to the treasury. Each send costs the node a network fee in SOL.

If the owner has no USDC account, or it's frozen, your earnings stay in the vault and the node logs a WARN on each pass; they go out on the first pass after the owner can take them. Nothing about a payout is stored on the node, so a restart loses nothing: whatever has accrued goes out on the next pass.

Because the earnings wait in the vault, two things work differently from Algorand:

  • Handing the operator to a new owner hands over the unsent earnings. A payout goes to whoever owns the operator when it's sent, not when the request was served. Before a transfer, let a payout pass run, or unregister the node.
  • A node can't be unregistered while it has a live ticket, because the payer's escrow sits in its vault, which closes with it. Unregistering returns the node's stake and rent and pays out what the vault holds.

A payer whose own USDC account can't take a refund loses it to the treasury, as on Algorand.

On a Solana node, zs-node settlement sweep refunds this operator's tickets that are past their deadline and settles its standing claims (--dry-run prints the plan first). settlement import and settlement refund-inactive are Algorand-only.

Free models​

A free model's turn opens nothing on-chain on Solana: the program won't open a ticket worth nothing. Your node's own budget limits what it gives away:

  • chain.free_daily_tokens per UTC day, counted from each free receipt's input and output tokens. Once the day's budget is spent, free requests get 429 free_budget_exhausted until 00:00 UTC.
  • chain.free_max_in_flight free turns at once.

A payer key costs nothing to make, so one payer could otherwise spend the whole budget. Free credits stop that: an issuer the node trusts hands payers who pass its gate a few blind-signed credits a day, and while the node trusts one, turns without a credit may use only chain.free_uncredited_share of the budget and of the free turns in flight. The rest is kept for credited turns. The budget and the spent credits are kept in memory, so a restart resets the day's count.

A free image model is refused on Solana: an image has no tokens to count against the budget.

Serving both rails​

One node can serve Algorand payers and Solana payers at once. Keep the Algorand config as it is (no chain block) and add a rails.solana block:

rails:
solana:
base_path: /sol # the default; the Solana side is served under it
chain:
network: devnet # a Solana node's chain block, as above
zs:
operator_id: 3 # your Solana operator and node
node_id: 1
settlement_db_path: "/var/lib/zs-node/settlement-solana.db"
ticket_ttl: 20s # at most 30s; defaults to zs.ticket_ttl
min_charge:
lamports: 15200

Register the node on each chain at its own URL: on Algorand its usual URL, for example https://node.example.com, and on Solana the same host followed by the base path, https://node.example.com/sol. Payers on each chain reach only their side, directly or through relays.

warning

Both registrations name the same host, which publicly links your Algorand and Solana operators.

What the two sides share: the backend, the models and their prices, the built-in tools, the rate limits, and the listener with its TLS certificate. zs.max_active_tickets and its per-model overrides cap the requests running on both sides together, since both run on one backend.

To keep the Solana side from using the Algorand side's capacity, for example while it runs on devnet beside Algorand mainnet, give it a cap of its own:

rails:
solana:
zs:
max_active_tickets: 2

The Solana side then counts its requests apart, up to that many per model and never more than the node's own cap for the model. The backend may then run both sides' caps at once, so set them so their sum is something it can serve. zs-node doctor compares that sum with the backend's capacity, and provider: local sizes llama-server for it.

What each side keeps apart:

  • Keys. Both signing keys load from the environment at once, and each side finds its own signing_addr among them. The Algorand side logs a WARN for each Solana key it skips; that's expected. Under tee.mode on dstack, put both keys in ZS_MNEMONIC_URLS as literal: entries (algo=literal:<25 words>,sol=literal:<phrase or base58 key>): adding a variable instead changes the measured compose.
  • Settlement ledgers. With a durable ledger, each side needs its own settlement_db_path. The node refuses to start if the two are the same file, or if only the Algorand side has one.
  • Balance warnings. zs.signing_balance.warn_below_algos applies to the Algorand key and warn_below_sol to the Solana key.
  • Ops endpoints. The Solana side's /healthz, /livez and /metrics are under the base path, for example /sol/metrics; scrape both. The root /healthz answers for the whole node: it stays 200 while either side serves and turns 503 only when both have stopped, so point the load balancer's readiness probe at it.
  • Eviction. If one chain evicts or unregisters your operator, that side stops taking requests while the other keeps serving. The node exits once both have stopped.
  • Attestation. Under tee.mode each side publishes its own evidence (/v1/zs/attestation and /sol/v1/zs/attestation), bound to that side's encryption key, operator and node; both come from the same enclave.

Two things report the node as a whole:

  • Capacity metrics. zs_reserve_inflight_slots and zs_reserve_capacity_slots report the one shared pool on both sides, so both show the same numbers; read one side, don't add them. With rails.solana.zs.max_active_tickets set, each side reports its own.
  • Relays. Each side forwards up to 256 relay requests at once, so the node forwards up to 512.

A free image model is refused on Solana, so adding rails.solana to a node that serves one, even on its Algorand side, stops the config from loading.

NODE_RAILS_SOLANA_CHAIN_NETWORK, NODE_RAILS_SOLANA_CHAIN_RPC_URL and NODE_RAILS_SOLANA_CHAIN_PROGRAM_ID override the block's chain settings. A rails.solana block on a node that is itself Solana is refused. zs-node doctor checks both chains, zs-node init --from keeps the block, and on a node serving both rails the zs-node settlement commands read the Algorand ledger only.