Fund Your Account
Fund the account before you trade. Every trade and quote tutorial assumes "test USDC deposited into your general balance". This page is how that USDC gets there, and how it leaves. The faucet grants it, deposit posts it, a signed intent releases it.
NoteThis is the first mile, not the trade. Funding moves collateral between your wallet and your general balance. It opens no agreement and posts no margin to a trade. That is Trade: Get Started (~5 min).
How do I get test funds?
POST /api/faucet with your wallet address. The faucet hands a one-time grant, 100,000 test USDC plus 0.001 ETH of native gas, so you can deposit and trade without first holding gas. One claim per address; the contract enforces it.
curl -X POST https://app.crxfx.com/api/faucet \
-H "Content-Type: application/json" \
-d '{ "address": "0xYourWallet" }'{ "ok": true, "alreadyClaimed": false, "txHash": "0x…" }A repeat claim returns { "ok": true, "alreadyClaimed": true } with no txHash: the grant is not re-sent. The server route signs the register call for you, so you spend no gas to claim.
Verify the grant yourself. Don't trust the txHash alone. Read your balance on-chain. The venue is Base Sepolia; call balanceOf(yourWallet) on the test USDC token (expect 100,000) and check your native balance on the explorer (expect 0.001 ETH).
| Network | Base Sepolia: chain ID 84532 |
| RPC | https://sepolia.base.org |
| Explorer | https://sepolia.basescan.org |
| Test USDC token | 0x12B94aC496d2F7058f0ac72a32393CB515af8797 (18 decimals) |
| Faucet contract | 0x3F393534Eb58e6E07042026847F0e202622efEdf |
How do I deposit collateral?
Approve the settlement token, then call deposit(token, amount). The USDC lands in your general balance, your free, multi-token margin shared across every agreement you hold. USDC is 18 decimals on this venue, so amount is the native token unit.
// 1. Approve the core to pull your USDC.
await usdc.write.approve([CRX, amount]);
// 2. Deposit: credits your general balance.
await crx.write.deposit([USDC, amount]);deposit pulls the native amount into the core and credits your general balance. Nothing is allocated to a trade yet; the balance is free until you bind and post margin.
Read the balance back with generalBalance(party, token). See Read Your Data (~4 min).
How do I withdraw free collateral?
Take free collateral out the gasless way: sign an EIP-712 WithdrawIntent, then POST /collateral/withdraw. The relayer verifies the signature, pays the gas, and releases your free general balance to a whitelisted destination. You sign; you never send a transaction.
The signed intent. Field order is the on-chain typehash, exactly:
const intent = {
party, // your address
token, // USDC
amount, // native units, as a bigint
recipient, // a WHITELIST_ADMIN-approved route
nonce, // per-party, single-use
deadline, // unix seconds; expires after
};
const signature = await wallet.signTypedData({
domain: { name: "CRX", version: "1", chainId: 84532, verifyingContract: CRX },
types: WITHDRAW_INTENT_TYPES,
primaryType: "WithdrawIntent",
message: intent,
});The request body sends the same fields plus the signature (amounts and nonce as decimal strings):
await fetch(`${RELAYER}/collateral/withdraw`, {
method: "POST",
headers: { "Content-Type": "application/json", "X-CRX-Address": party },
body: JSON.stringify({
party, token,
amount: amount.toString(),
recipient,
nonce: nonce.toString(),
deadline,
signature,
}),
}).then((r) => r.json());
// → { tx_hash: "0x…" }WarningThe recipient must be a whitelisted route. A withdraw releases only to a destination already approved on-chain viaPOST /admin/withdraw-route, an operator-only,OPERATOR_TOKEN-gated action. An un-whitelisted recipient is rejected before any gas is spent.
Warning/collateral/withdrawreturns 500 if the relayer has no gas key. The gasless path needsWITHDRAW_GAS_KEYconfigured to pay the gas. It is environment-gated. On a deployment without that key, withdraw on-chain yourself.
The non-gasless alternative is the on-chain withdraw(token, amount), or withdrawSigned(party, token, amount, recipient, nonce, deadline, sig) submitted by any relayer. Both live on the second engine and release from your general balance; you pay your own gas on withdraw.
This is a withdraw from your general balance to your wallet. It is not deallocation: moving margin out of an agreement's SCA back into your general balance. Deallocation is the two-phase path in Quote: Get Started (~2 min).
What you have now, and the branch
- Funded general balance. Faucet USDC deposited, free and unallocated, shared across every agreement you will open.
- A way back out. Free collateral leaves through a signed
WithdrawIntentto a whitelisted route, or the on-chainwithdraw.
From here, bind your first hedge: Trade: Get Started (~5 min). To quote instead, see Quote: Get Started (~2 min).