Run a cranker
How to turn runs for the turn reward, with the cranker process or by hand.
Start the cranker
curta crank --keypair <file> --rpc <url>The command runs until it receives SIGINT or SIGTERM. It signs every turn with the keypair’s wallet, which pays each transaction’s fee and receives each turn reward. Quickstart lists the flags and environment variables every chain command takes.
curta crank --onceWith --once the cranker makes one pass through the queue and exits with its totals.
What the cranker does
- It reads the program’s run accounts and orders them by the slot each run opened in. It reads the list again whenever the program has new transactions.
- On each pass it lands one turn on every running run, one turn per transaction.
- It settles complete and cancelled runs, which moves their royalties and protocol share.
- When another cranker lands a turn or a settlement first, it moves on to the next run.
Between turns the cranker reads the first 384 bytes of a run account: the header with the state, the turn count and the budget, and the position in the forward pass. The turn planner in the SDK names the weight accounts the next turn reads. Runs and turns describes what one turn computes.
What it prints
The cranker prints one JSON object per confirmed transaction:
| Field | Value |
|---|---|
| kind | turn or settle |
| run | The run’s address. |
| signature | The transaction’s signature. |
| turnsLanded | The turns this cranker has landed since it started. |
| lamportsEarned | The turn rewards it has received since it started, in lamports. |
How rewards arrive
Rewards arrive per turn. The turn that lands pays its signer the turn reward from the run’s budget in the same transaction, so the cranker’s balance rises with every turn. The amount is on Fees.
/crank shows a connected wallet’s turns landed and SOL earned.
The cranker from code
The CLI runs the crank function that @curta/sdk exports.
import { Curta, crank } from '@curta/sdk'
const curta = new Curta({ connection, wallet })
const { turnsLanded, lamportsEarned } = await crank(curta, {
signal, // an AbortSignal stops the loop
once: true, // one pass through the queue
onProgress: console.log, // the object the CLI prints
})Turn by hand on /crank
- Open /crank and press Connect wallet.
- Read the queue: every running run, with its turns left and its reward per turn.
- Press Turn on a run and sign.
- The run advances and the turn reward arrives in your wallet.
The same Turn button is on every running run’s page.