Skip to content

Builder and Relayer Keys

Polygolem splits the V2 setup into three credential systems:

  • builder auto creates bootstrap CLOB L2 credentials at clob.polymarket.com/auth/api-key.
  • auth login performs SIWE login and mints RELAYER_API_KEY + RELAYER_API_KEY_ADDRESS for deposit-wallet deploy and approval batches.
  • clob create-builder-fee-key creates the builder attribution value used in the V2 order builder bytes32 field.

Pipeline

Terminal window
# Step 1: Generate a fresh EOA
openssl rand -hex 32 > key.txt
# Step 2: Sign in to Polymarket and mint relayer credentials
POLYMARKET_PRIVATE_KEY="0x$(cat key.txt)" \
polygolem auth login
# Step 3: Create or derive CLOB L2 credentials
POLYMARKET_PRIVATE_KEY="0x$(cat key.txt)" \
polygolem builder auto
# Step 4: Mint a builder fee key, then export its key as a bytes32 builder code
POLYMARKET_PRIVATE_KEY="0x$(cat key.txt)" \
polygolem clob create-builder-fee-key
export POLYMARKET_BUILDER_CODE="0x..."
# Step 5: Deploy deposit wallet + approve + enable trading + fund
POLYMARKET_PRIVATE_KEY="0x$(cat key.txt)" \
polygolem deposit-wallet onboard --fund-amount 10 --json
# Step 6: Verify the deposit wallet address and authenticated CLOB path
DEPOSIT_WALLET=$(POLYMARKET_PRIVATE_KEY="0x$(cat key.txt)" \
polygolem --json deposit-wallet derive | jq -r '.data.depositWallet')
POLYMARKET_PRIVATE_KEY="0x$(cat key.txt)" \
polygolem auth status --check-deposit-key
# Step 7: Sync balance and trade
POLYMARKET_PRIVATE_KEY="0x$(cat key.txt)" \
polygolem clob update-balance --asset-type collateral
POLYMARKET_PRIVATE_KEY="0x$(cat key.txt)" \
polygolem clob create-order --token <id> --side buy --price 0.5 --size 10 \
--builder-code "$POLYMARKET_BUILDER_CODE"

CLOB L2 Credentials

builder auto signs a ClobAuth EIP-712 typed data message locally and posts it to clob.polymarket.com/auth/api-key for bootstrap credentials:

POST https://clob.polymarket.com/auth/api-key
Headers:
POLY_ADDRESS = EOA address
POLY_TIMESTAMP = Unix seconds
POLY_NONCE = "0"
POLY_SIGNATURE = raw EOA ClobAuth signature
EIP-712 typed data:
domain: { name: "ClobAuthDomain", version: "1", chainId: 137 }
type: ClobAuth(address address, string timestamp, uint256 nonce, string message)
message: "This message attests that I control the given wallet"

The endpoint returns the CLOB L2 HMAC triple: { apiKey, secret, passphrase }. The CLOB HTTP layer is EOA-authenticated. Deposit-wallet identity is carried by the POLY_1271 order payload and by signature_type=3 on CLOB balance/order reads.

Idempotent

Re-running builder auto for the same EOA returns the same credentials. The endpoint is idempotent — one EOA, one set of keys. Use --force to re-fetch and overwrite the local env file.

Relayer Keys

Relayer writes use a different key. auth login signs a SIWE message with the EOA, exchanges it for a Gamma session, and mints the V2 relayer key at relayer-v2.polymarket.com/relayer/api/auth.

auth headless-onboard is the older compatibility command name for this same flow. New automation should use polygolem auth login.

deposit-wallet deploy, deposit-wallet approve, and deposit-wallet onboard prefer RELAYER_API_KEY + RELAYER_API_KEY_ADDRESS when present. If no relayer key is configured, live wallet commands run SIWE login, profile registration, relayer key minting, and env-file persistence automatically before submitting the WALLET batch.

Cost to the User

ItemCost
Generate EOAFree
Polymarket SIWE loginFree
CLOB L2 credsFree
V2 relayer keyFree
Builder fee keyFree
Wallet deployFree (gas sponsored)
Approvals (6 contracts)Free (gas sponsored)
Fund wallet (one tx)~$0.01 POL

Total: ~$0.01 POL + whatever pUSD you want to trade. Gas-sponsored relayer steps remain free.

With Reown/WalletConnect (Flutter/Arenaton)

The same flow works through Reown in Flutter:

// Polydart SDK
final client = await Polydart.live(
reownProvider: walletConnectProvider,
eoaAddress: '0x...',
);
// CLOB L2 credentials created via ClobAuth
await client.builder.auto();
// Relayer key minted via SIWE + relayer auth
await client.auth.login();
// Deploy wallet via server proxy → relayer
await client.wallet.deploy();
// Fund (EOA signs via Reown/MetaMask)
await client.wallet.fund(amount: 10.0);
// Trade (POLY_1271 signed via Reown)
await client.orders.buy(tokenId: '...').atPrice(0.5).forSize(10).submit();

See Also