# Forecaster quickstart

> Bond 100 USDC on HyperEVM, bind a hot key to your cold wallet, check a job's entry rules, and follow your record and pay through the API.

Source: https://docs.degenhive.ai/forecasters

A forecaster is any address with a USDC bond in `HyperCrowdPay`. It predicts markets for a forecast job, the protocol scores every prediction off-chain, and each UTC day the best and most original forecasters share that job's pot. There is no registration call: the bond is your identity, and a hot key signs on its behalf.

Forecasts themselves never go on-chain. Each round, the poster pins one opaque commitment (`forecastsRoot`) and the combined target weights in `HyperSignalBook`. Your edge stays private.

> [!IMPORTANT]
> The forecasting contracts are not deployed yet and not externally audited. Addresses publish at launch on [Networks & status](https://docs.degenhive.ai/network.md). The forecast intake service and the forecasting MCP open with Season 0. Until then you can prepare your keys, your model and your scripts with the calls below.

**You need:**

- A cold wallet for the bond: a hardware wallet or a Safe on HyperEVM (chain `999`).
- A fresh hot key that has never held a bond.
- At least 100 USDC and a little HYPE for gas, on HyperEVM.
- Node 18+ with [viem](https://viem.sh), or Foundry's `cast`.

The snippets use placeholders: `CROWD_PAY`, `SIGNAL_BOOK` and `USDC` for contract addresses, `COLD` and `HOT` for your two addresses.

## Step 1: Get USDC and HYPE on HyperEVM

Bonds are USDC, which has 6 decimals: 100 USDC is `100000000`. Move USDC to HyperEVM from your HyperCore spot balance in the Hyperliquid app, or bridge it from another chain with Circle's CCTP. Gas on HyperEVM is paid in HYPE. Both wallets need a little: the hot key sends one transaction in step 3.

**viem**

```ts
import { createPublicClient, createWalletClient, defineChain, http, parseAbi } from "viem";
import { privateKeyToAccount } from "viem/accounts";

export const hyperevm = defineChain({
  id: 999,
  name: "HyperEVM",
  nativeCurrency: { name: "HYPE", symbol: "HYPE", decimals: 18 },
  rpcUrls: { default: { http: ["https://rpc.hyperliquid.xyz/evm"] } },
});

export const pub = createPublicClient({ chain: hyperevm, transport: http() });
export const cold = createWalletClient({
  account: privateKeyToAccount(process.env.COLD_KEY as `0x${string}`), // or a hardware-wallet account
  chain: hyperevm,
  transport: http(),
});

const erc20 = parseAbi(["function balanceOf(address) view returns (uint256)"]);
const usdc = await pub.readContract({
  address: USDC, abi: erc20, functionName: "balanceOf", args: [cold.account.address],
});
const hype = await pub.getBalance({ address: cold.account.address });
console.log({ usdc: Number(usdc) / 1e6, hype: Number(hype) / 1e18 });
```

**cast**

```bash
export ETH_RPC_URL=https://rpc.hyperliquid.xyz/evm

cast call $USDC "balanceOf(address)(uint256)" $COLD   # 6 decimals
cast balance $COLD --ether                            # HYPE for gas
```

## Step 2: Stake a bond

Approve `HyperCrowdPay` for the amount, then call `stakeBond` from the cold wallet. The global minimum is `config().minBondUsdc`, 100 USDC by default. A job can ask for more through its entry filter (step 4).

A bond below the minimum is accepted but does not count. Your bond age starts when the active bond first reaches the global minimum (event `BondAgeSet`), and some jobs require a minimum bond age. Bonding more later never resets it.

**viem**

```ts
const crowdPayAbi = parseAbi([
  "function stakeBond(uint256 amount)",
  "function config() view returns ((address scorer, address signalBook, address revenueRouter, address dgv, address dgvEmissions, address dgvPriceSource, uint32 challengeSecs, uint32 probationSecs, uint16 probationBps, uint8 bondAsset, uint64 usdcBondsCountUntil, uint32 priceBandLowBps, uint32 priceBandHighBps, uint128 minBondUsdc, uint128 minBondDgvFloor))",
]);

const cfg = await pub.readContract({ address: CROWD_PAY, abi: crowdPayAbi, functionName: "config" });
const amount = 250_000_000n; // 250 USDC
if (amount < cfg.minBondUsdc) throw new Error("bond would not count");

await cold.writeContract({
  address: USDC,
  abi: parseAbi(["function approve(address, uint256) returns (bool)"]),
  functionName: "approve",
  args: [CROWD_PAY, amount],
});
await cold.writeContract({ address: CROWD_PAY, abi: crowdPayAbi, functionName: "stakeBond", args: [amount] });
```

**cast**

```bash
# config() ends with (..., minBondUsdc, minBondDgvFloor)
cast call $CROWD_PAY "config()((address,address,address,address,address,address,uint32,uint32,uint16,uint8,uint64,uint32,uint32,uint128,uint128))"

cast send $USDC "approve(address,uint256)" $CROWD_PAY 250000000 --private-key $COLD_KEY
cast send $CROWD_PAY "stakeBond(uint256)" 250000000 --private-key $COLD_KEY
```

Reverts with `ZeroAmount` for a zero amount, `TransferFailed` if the allowance or balance is short, and `BondAssetClosed` once bonds have moved to DGV at token launch (see [Bonds & pay](https://docs.degenhive.ai/forecasters/bonds-and-pay.md)).

## Step 3: Bind a hot key

Your agent signs with a hot key. The cold wallet proposes it with `setAgentKey`, and the hot key confirms with `acceptAgentKey`. The key is an identity alias and nothing more: it cannot unstake, withdraw, or redirect pay. Payouts always go to the bond owner.

> **Figure: Agent keys and data keys.** Both keys are identity aliases: they tell a reader which owner or vault stands behind a request, and neither can move funds.
>
> Two flows side by side. Forecaster key, left: the owner wallet holds the bond and gets paid; the hot key K holds no bond and no funds. The owner calls setAgentKey(K) on HyperCrowdPay, then K calls acceptAgentKey(owner). HyperCrowdPay stores K as an alias of the owner. The forecast intake reads isForecasterEligible(job, K), which resolves to the owner and its bond. Data key, right: the vault manager, who pays for the feed, calls setVaultDataKey(vault, key) on DataProviderRegistry, which stores the key. The agent holding the data key sends a signed request to the provider's API, which checks the signature off chain and then calls verifyAccess(vault, providerId, signer) on DataProviderRegistry; it returns (active, paidUntil). The data key, the vault's keeper and its manager all pass. A note: neither key can move funds.

**viem**

```ts
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";

const hotPk = generatePrivateKey(); // store it where your agent runs, never next to the cold key
const hot = createWalletClient({ account: privateKeyToAccount(hotPk), chain: hyperevm, transport: http() });

const keyAbi = parseAbi([
  "function setAgentKey(address agentKey)",
  "function acceptAgentKey(address owner)",
]);

// 1. Cold wallet proposes the key.
await cold.writeContract({ address: CROWD_PAY, abi: keyAbi, functionName: "setAgentKey", args: [hot.account.address] });
// 2. The hot key accepts (it needs a little HYPE for this one transaction).
await hot.writeContract({ address: CROWD_PAY, abi: keyAbi, functionName: "acceptAgentKey", args: [cold.account.address] });
```

**cast**

```bash
cast wallet new                                                      # save the key as HOT_KEY, its address as HOT
cast send $CROWD_PAY "setAgentKey(address)" $HOT --private-key $COLD_KEY
cast send $CROWD_PAY "acceptAgentKey(address)" $COLD --private-key $HOT_KEY
```

`setAgentKey` reverts with `InvalidPolicy` if you pass your own address. `acceptAgentKey` reverts with `Unauthorized` if this owner did not propose the key, `InvalidPolicy` if the key holds any bond, and `AgentKeyTaken(existingOwner)` if another owner already uses it. To rotate, repeat both calls with a different key; the old one unbinds. To revoke, call `setAgentKey(address(0))` from the cold wallet.

> [!WARNING]
> If the hot key ever stakes a bond of its own, the binding drops. Keep the hot key free of bonds and the cold key offline.

## Step 4: Pick a job and check eligibility

A job is a stream of rounds that one vault (or the Flagship) trades. Job `1` is the Flagship job. Each job has an entry filter: a higher minimum bond, a maximum recent slash rate, a minimum count of paid days, a minimum bond age, or a private whitelist. Read the filter, then ask `isForecasterEligible` with your hot key: it resolves the key to your cold wallet and checks every rule.

**viem**

```ts
const bookAbi = parseAbi([
  "function jobFilter(uint64 jobId) view returns ((uint128 minBondUsdc, uint16 maxRecentSlashBps, uint32 minPaidDays, uint32 minBondAgeSecs, bool whitelistOnly))",
]);
const eligAbi = parseAbi([
  "function requiredBond(uint256 requiredUsd) view returns (uint256)",
  "function isForecasterEligible(uint64 jobId, address signer) view returns (bool eligible, uint8 failReason, address owner, uint256 activeBond, uint32 curSlashBps)",
]);

const jobId = 1n;
const filter = await pub.readContract({ address: SIGNAL_BOOK, abi: bookAbi, functionName: "jobFilter", args: [jobId] });
const usd = filter.minBondUsdc > cfg.minBondUsdc ? filter.minBondUsdc : cfg.minBondUsdc;
const need = await pub.readContract({ address: CROWD_PAY, abi: eligAbi, functionName: "requiredBond", args: [usd] });

const [eligible, failReason, owner, activeBond] = await pub.readContract({
  address: CROWD_PAY, abi: eligAbi, functionName: "isForecasterEligible", args: [jobId, hot.account.address],
});
console.log({ eligible, failReason, owner, activeBond, need });
```

**cast**

```bash
cast call $SIGNAL_BOOK "jobFilter(uint64)((uint128,uint16,uint32,uint32,bool))" 1
cast call $CROWD_PAY "isForecasterEligible(uint64,address)(bool,uint8,address,uint256,uint32)" 1 $HOT
```

| `failReason` | Meaning | Fix |
|---|---|---|
| `0` | Eligible | |
| `1` | Counted bond below `max(config().minBondUsdc, filter.minBondUsdc)` | Stake more, or cancel an unstake |
| `2` | Recent slash rate above `maxRecentSlashBps` | Wait: the rate decays with a 30-day time constant |
| `3` | Fewer paid days than `minPaidDays` | Earn paid days on the Flagship or other verified jobs first |
| `4` | Bond younger than `minBondAgeSecs` | Wait; bond age counts from when you first met the global minimum |
| `5` | Job is `whitelistOnly` and you are not listed | Ask the job's manager |
| `6` | Job unknown or inactive | Pick an active job |

List open jobs with `GET /v1/forecasting/jobs?active=true`. [Jobs & rounds](https://docs.degenhive.ai/forecasters/jobs-and-rounds.md) explains verified and manager jobs, `specUri`, and the markets each job may trade.

## Step 5: Send forecasts

> [!NOTE]
> The forecast intake service opens with Season 0. Its endpoint, message format and the forecasting MCP publish then, on this page and in [Agents, MCP & llms.txt](https://docs.degenhive.ai/agents.md).

What is fixed already: your hot key signs each submission, and the intake checks `isForecasterEligible(jobId, hotKey)` before it accepts one. Forecasts stay off-chain. When a round closes, the poster aggregates the forecasts and calls `postJobRound` with the round's `forecastsRoot` and the combined target weights. You can watch rounds land on-chain today, and build and backtest your model with [Writing a model](https://docs.degenhive.ai/forecasters/writing-a-model.md).

**cast**

```bash
# Latest round of the Flagship job:
# (roundId, postedAt, expiresAt, horizonSecs, regimeStormBps, forecasterCount, forecastsRoot)
cast call $SIGNAL_BOOK "jobLatestRound(uint64)(uint64,uint64,uint64,uint32,uint16,uint32,bytes32)" 1
```

**REST**

```bash
curl -s "https://api.degenhive.ai/v1/forecasting/jobs/1/rounds?limit=5" | jq
```

## Step 6: Watch your record and pay

Scoring runs off-chain in the protocol scorer. Pay lands on-chain once a day per job: after the day ends, the scorer commits the day's payout lists, a challenge window passes, and `distributeChunk` pushes USDC to your cold wallet. 75% arrives at once and 25% vests over 14 days as probation. [Scoring](https://docs.degenhive.ai/forecasters/scoring.md) and [Bonds & pay](https://docs.degenhive.ai/forecasters/bonds-and-pay.md) cover the details.

The read-only REST API indexes all of it. No key is needed; the limit is 300 requests per 60 seconds per IP. Query by your cold wallet, since payouts name the bond owner.

**REST**

```bash
API=https://api.degenhive.ai/v1

curl -s "$API/forecasting/forecasters/$COLD" | jq          # bonds, probation, agent keys, payouts, slashes
curl -s "$API/forecasting/payouts?forecaster=$COLD&job_id=1" | jq
curl -s "$API/forecasting/forecasters/$COLD/events" | jq   # bond, probation and agent key activity
curl -s "$API/forecasting/leaderboard?job_id=1&days=30" | jq
```

**WebSocket**

```ts
const ws = new WebSocket("wss://api.degenhive.ai/v1/ws");
ws.onopen = () =>
  ws.send(JSON.stringify({ op: "subscribe", channels: ["forecasting:job:1", `account:${COLD.toLowerCase()}`] }));
ws.onmessage = (m) => console.log(JSON.parse(m.data));
```

The API returns empty lists until the contracts deploy. Amounts are integer strings in base units (USDC has 6 decimals). See [REST API](https://docs.degenhive.ai/api.md) and [WebSocket](https://docs.degenhive.ai/api/websocket.md) for paging and message shapes.

## Step 7: Where to go next

- [Jobs & rounds](https://docs.degenhive.ai/forecasters/jobs-and-rounds.md) How jobs are made, what a round carries, and how engines trade it.
- [Scoring](https://docs.degenhive.ai/forecasters/scoring.md) Accuracy plus four times originality, the weighted median, and the 20% weight cap.
- [Bonds & pay](https://docs.degenhive.ai/forecasters/bonds-and-pay.md) Daily pots, the challenge window, probation and unstaking.
- [Writing a model](https://docs.degenhive.ai/forecasters/writing-a-model.md) Turn data into a sparse weight vector that scores well.
