Operators
Run a node
Register, bond, set an offer and start laplace serve.
This guide goes from an empty machine to a node that answers requests: a key, SOL behind it, an operator account, a bond, an offer per model, and laplace serve running as a service. An operator is one key. The same key registers, holds the bond, sets the offers and signs every answer.
What the node needs
| The CLI | Node 22 and the laplace command: Install and invoke. |
| The native step function | The laplace-vm binary, built once: The native laplace-vm binary. |
| The network's addresses | The RPC endpoint and the API, as LAPLACE_RPC and LAPLACE_API or --rpc and --api: Addresses. |
| SOL | The bond, the rent of one Operator account and one Offer account per model, and the fee of each transaction the node sends. |
| Disk | Each served model's program and weights files, and one roots file per answer it holds for the game, 32 bytes per step: about 42 MB for one answer of the market model's 1,318,668 steps. The file sizes and step counts are on each model's page, /models/<slug>. |
From a key to an answering node
Registering, bonding and setting an offer can be done from the terminal or on Operate with a browser wallet. Both act on the same accounts, so the wallet connected on Operate must hold the same key the node runs with.
Make or import the key
Shell laplace key newIt asks for a new password, writes the encrypted key file and prints the public key. To run the node with a keypair that already exists, for example the one in the wallet used on Operate, import its file:
Shell laplace key import ./operator-keypair.jsonlaplace key showprints the public key again at any time. The key file covers its location and encryption.Fund the key
Send SOL to the public key: the bond you will deposit, plus rent and fees. The bond a model needs behind each answer is
bondLamportsofGET /v1/models/:slug, shown on the model's page as its bond per answer.Register as an operator
Shell laplace operator registerPrints the transaction's signature.
Open Operate and connect the wallet. The page reads "This wallet is not an operator yet". Press Register as operator and sign.
This creates the Operator account at seeds
["operator", authority]. It is done once per key.Deposit the bond
Shell laplace operator bond 5The amount is in SOL.
On Operate, in the Bond panel, enter the amount in SOL under Deposit and press Deposit bond.
The SOL moves into the program's vault and the operator's free bond rises by the amount. Each answer locks the model's bond from the free balance, so the free bond divided by the model's bond is how many answers the node can have open at once. Bond and offers has the arithmetic.
Set an offer for each model
Shell laplace operator offer judge 20000 --mint <mint> laplace operator offer market 10000 --mint <mint>The price is a whole number of the mint's base units:
20000of a 6-decimal mint is 0.02 of the token.On Operate, in the Offers panel, each model has a row. Enter the Price, pick the Mint, leave Taking requests on On and press Set offer.
A requester can name this operator for a model once its offer is active.
Start the node
Shell laplace serve --models judge,marketIt asks for the key's password once, then:
- prints a
serveline, - fetches each model's
program.binandweights.binfrom the API's store into its data folder, and checks each file's SHA-256 against the hash thatGET /v1/models/:slug/fileslists. The files come gzip-compressed, which takes the market model's 42.2 MB program file down to about 5.6 MB on the wire, and are checked after decompression. Files already on disk with the right hash are kept, - prints
models_ready, - starts answering: every 1.5 seconds it reads the requests that name its key and answers each one.
While the files cannot be fetched it prints
models_waitingand tries again every 3 seconds.- prints a
See it answering
Ask the node for an answer, naming its offer:
Shell laplace ask judge --claim "The bridge opened in 1932." --evidence "The bridge opened to traffic in March 1932." --offer <offer address>The offer's address is the
addressfield of its entry inGET /v1/offers?model=judge. On Ask the same request is made by picking the model and this operator's offer.The node prints an
answeredline with the receipt, the model, the output's first tokens and the signature. From then on:/operators/<key>shows the operator's record: bond free and locked, receipts answered, the Last answer tile, its receipts and its offers, each marked "live" while it is.- Operate shows the "Your node" panel: "Answering" while the last answer is less than 10 minutes old, with the line "Last answer" and its time in UTC.
GET /v1/operators/:keyreturns the same record, withlastAnswerAt.
Keeping it running as a service
A service has no terminal to type the password into, so the password is given as LAPLACE_PASSWORD. Everything else the node takes is a variable too:
export LAPLACE_RPC="$rpcUrl"
export LAPLACE_API="$apiUrl"
export LAPLACE_KEY=/var/lib/laplace/key.json
export LAPLACE_PASSWORD="$password"
export LAPLACE_DATA=/var/lib/laplace/serve
export LAPLACE_VM_BIN=/usr/local/bin/laplace-vm
node dist/src/cli/main.js serve --models judge,market| Variable | Holds |
|---|---|
LAPLACE_RPC, LAPLACE_API | The network's addresses. |
LAPLACE_KEY | The path of the encrypted key file. |
LAPLACE_KEY_SEALED | In place of LAPLACE_KEY: the contents of the key file, for a host that takes secrets as variables and has no disk to keep the file on. |
LAPLACE_PASSWORD | The key file's password. |
LAPLACE_DATA | The data folder. On a host whose disk is not kept between starts, the node downloads the model files again at each start. |
LAPLACE_VM_BIN | The path of the laplace-vm binary. |
The node writes one JSON line per event to standard output and nothing else, so its log is the service's log. It ends its loop on SIGINT or SIGTERM after the current pass. A failed pass prints an error line and the next pass runs 1.5 seconds later, so the service manager only has to start the process and start it again if it exits.
On start the node reads every request that names its key and is still requested, so a request that arrived while the process was down is answered if its answer deadline has not passed. An answer the node posted before a restart is defended after it: when a dispute needs the run, the node runs the receipt's input again.
Leaving
Turn the offers off so no new request names the operator, wait until its receipts are final and the locked bond is free again, then withdraw: Bond and offers.