Builder and Relayer Keys
Polygolem splits the V2 setup into three credential systems:
builder autocreates bootstrap CLOB L2 credentials atclob.polymarket.com/auth/api-key.auth loginperforms SIWE login and mintsRELAYER_API_KEY+RELAYER_API_KEY_ADDRESSfor deposit-wallet deploy and approval batches.clob create-builder-fee-keycreates the builder attribution value used in the V2 orderbuilderbytes32 field.
Pipeline
# Step 1: Generate a fresh EOAopenssl rand -hex 32 > key.txt
# Step 2: Sign in to Polymarket and mint relayer credentialsPOLYMARKET_PRIVATE_KEY="0x$(cat key.txt)" \ polygolem auth login
# Step 3: Create or derive CLOB L2 credentialsPOLYMARKET_PRIVATE_KEY="0x$(cat key.txt)" \ polygolem builder auto
# Step 4: Mint a builder fee key, then export its key as a bytes32 builder codePOLYMARKET_PRIVATE_KEY="0x$(cat key.txt)" \ polygolem clob create-builder-fee-keyexport POLYMARKET_BUILDER_CODE="0x..."
# Step 5: Deploy deposit wallet + approve + enable trading + fundPOLYMARKET_PRIVATE_KEY="0x$(cat key.txt)" \ polygolem deposit-wallet onboard --fund-amount 10 --json
# Step 6: Verify the deposit wallet address and authenticated CLOB pathDEPOSIT_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 tradePOLYMARKET_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
| Item | Cost |
|---|---|
| Generate EOA | Free |
| Polymarket SIWE login | Free |
| CLOB L2 creds | Free |
| V2 relayer key | Free |
| Builder fee key | Free |
| Wallet deploy | Free (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 SDKfinal client = await Polydart.live( reownProvider: walletConnectProvider, eoaAddress: '0x...',);
// CLOB L2 credentials created via ClobAuthawait client.builder.auto();
// Relayer key minted via SIWE + relayer authawait client.auth.login();
// Deploy wallet via server proxy → relayerawait 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
- Deposit Wallet Lifecycle — full deploy → approve → fund → trade walkthrough
- CLOB API — order creation and signing
- Secrets Management — credential handling
- Smart Contracts — factory addresses and relayer endpoints