Skip to content

Mainnet quickstart

This walkthrough uses the deployed ExampleConsumer on Arc mainnet. No source checkout is required. Read-only steps work without a wallet; submitting a request spends native USDC for the service fee and transaction gas.

  • Foundry’s cast command.
  • Node 22 or later for the ruff-hub CLI.
  • For a new request, a funded Arc wallet imported into a local encrypted Foundry keystore. Use --account so no private key appears in a command.
Terminal window
RPC=https://rpc.blockdaemon.mainnet.arc.io
HUB=0x398F839B85DA2945D26EBBD1B3a4784A2F1389AB
EXAMPLE=0x4A57d8B3648Dbe7C6a6Ce16Ca58E9f16E8dCDdbD
cast chain-id --rpc-url "$RPC"

The chain ID must be 5042. All contract calls below use the hub proxy.

Terminal window
cast call "$HUB" 'quote(address,uint32)(uint128,uint32)' \
"$EXAMPLE" 0 --rpc-url "$RPC"

With the launch tariff, the result is 13330000000000000 native base units and 100000 callback gas: 0.01333 USDC. A gas argument of 0 selects the tariff default. Arc native fee amounts use 18 decimals.

Read a fresh quote before each request. The consumer checks the exact fee, so a stale quote reverts instead of silently overpaying.

Set the fee to the first value from the quote and replace my-arc-wallet with the name of an existing encrypted keystore:

Terminal window
FEE=13330000000000000
cast send "$EXAMPLE" 'request(uint32,bytes32)' 0 \
0x0000000000000000000000000000000000000000000000000000000000000000 \
--value "$FEE" --rpc-url "$RPC" --account my-arc-wallet

The consumer records the returned sequence and receives the callback. Open the transaction in RUFF Explorer to find its sequence and delivery status. The Requested event also contains that sequence.

The example below inspects the already delivered sequence 106. Replace it with the sequence from a new request when applicable:

Terminal window
SEQUENCE=106
RNG_RPC_URL="$RPC" npx ruff-hub status \
--hub "$HUB" --sequence "$SEQUENCE"
cast call "$HUB" 'randomOf(uint64)(bytes32)' \
"$SEQUENCE" --rpc-url "$RPC"

Use the random value only when the status is Fulfilled. A zero value alone cannot distinguish a pending request from a valid all-zero result. If the callback failed, the hub still stores the delivered number.

Terminal window
RNG_RPC_URL="$RPC" npx ruff-hub verify \
--hub "$HUB" --sequence "$SEQUENCE" --from-block 23355234

A complete verification reports historical.ok: true, historical.complete: true, and currentState.status: "match". The verification guide explains the other outcomes and the explorer’s saved reports.

Next: integrate a consumer contract or use ruff-hub from TypeScript.