Skip to main content
Predict.fun runs on BNB Chain and supports two wallet models: a Predict Account (a Kernel-based smart wallet, the default for users who signed up via Privy) and a direct EOA. Most users will use the Predict Account flow.

At a glance

Prerequisites

  • A Predict.fun account
  • Your Predict.fun API key
  • The Privy wallet private key that controls your Predict Account
  • Your Predict Account address (the deposit/trading address shown in the Predict.fun UI)
  • USDT on BNB Chain in your Predict Account
The Privy private key is the EOA that owns your Kernel smart wallet (Predict Account). The Predict Account is the address that holds positions and pays fees; the Privy EOA is what signs.

One-time setup

1. Approve exchange contracts

The Predict Account must approve the right CTF Exchange contract to spend USDT and Conditional Tokens. There are four exchange contract variants depending on the market type, so the approval needs to match the market you’re trading.
You only need to approve each of the four variants once — if you trade in different market types, repeat this with the matching marketFlags.

2. Register credentials with Delphi

The Privy key is stored encrypted server-side. The server uses it to perform Predict.fun’s JWT challenge-response auth flow (which is separate from the EIP-712 signing of orders).

Build and place an order

Build parameters

The combination of isNegRisk, isYieldBearing, and feeRateBps must match the on-chain market exactly. The signature is bound to the specific exchange contract address, which is selected by these flags. A mismatch produces a valid signature for the wrong contract, and the order will fail validation.Always pull these three values fresh from the Predict.fun market data API before building an order.

EOA vs Predict Account flow

If your Predict.fun account is an EOA (no smart wallet), omit predictAccount from buildPredictFunOrder and use a different env var:
The SDK switches to direct EOA signing automatically when predictAccount is omitted.

Query and cancel

Common pitfalls

Almost always a mismatch between the market flags you passed (isNegRisk, isYieldBearing) and the actual market. There are four exchange contracts; the signature is only valid against one. Re-fetch the market and copy the flags directly:
USDT on BNB Chain uses 18 decimals. The SDK takes size in base units (1e18 = 1 share). 50 shares = (50n * 10n ** 18n).toString(). Don’t confuse this with the 6-decimal USDT on Ethereum.
The CTF approval is an ERC-1155 setApprovalForAll from your Predict Account to the right exchange contract. If your Predict Account has zero ETH/BNB to pay gas (it’s a smart wallet, so it sponsors its own gas via Kernel), the approval transaction will fail. Top up the Predict Account with a small amount of BNB (~0.001) for gas before approving.
  • 0 (EOA) — used when predictAccount is omitted
  • 2 (POLY_GNOSIS_SAFE) — used when predictAccount is set, even though Predict.fun uses a Kernel wallet rather than a Gnosis Safe. The signature wrapping is Kernel-specific (uses the ECDSA validator at 0x845ADb2C711129d4f3966735eD98a9F09fC4cE57) but reuses the 2 signatureType slot.
The SDK picks the right one based on whether you passed predictAccount.
Predict.fun’s JWT tokens expire after a short window. The Delphi server handles refreshes automatically using your stored Privy private key. If you keep getting 401s on Predict.fun specifically, your registered api_secret (Privy key) might be wrong — re-register it.

API reference