Skip to main content
cbBTC stays in the associated token account (ATA) of the Phoenix trader’s wallet PDA. Phoenix credits the accounted cbBTC balance and values it at the BTC index price. PnL, funding, and trading fees settle in USDC. Use a registered trader, the trader authority’s signing wallet, and API and RPC endpoints for the same deployment. Check that the cbBTC asset is active using client.api.collateral().getAssets() in TypeScript or http.collateral().get_assets() in Rust.

Available instructions

Deposit cbBTC

Send ReallocTrader, create the custody ATA if needed, transfer the SPL tokens into it, and call SyncSpot in that order in one transaction. Each asset uses a separate trader map entry. SyncSpot credits the balance up to the per-trader and exchange-wide caps. If some tokens remain in custody above those limits, they carry no margin value until a later sync credits them. Read the accounted balance again after confirmation. The Solana cbBTC mint is cbbtcf3aa214zXHbiAZQwf4122FBYbraNdFqgw4iMij. It uses 8 decimals, so 0.01 cbBTC is 1,000,000 base units.
TypeScript
The helper returns unsigned instructions for the wallet to sign and send. For a sponsored deposit, prepare trader capacity in a separate wallet-paid transaction and pass traderCapacityPrepared: true to buildSpotDepositFlow. In Rust, build the same sequence with create_realloc_trader_ix, the SPL associated token account and transfer instructions, and create_sync_spot_ix with the cbBTC mint. Use the custody ATA for the trader’s wallet PDA as the token transfer destination.

Compute margin using API data

Use the SDK margin calculation. In TypeScript, pass resource.marginInputs() to the calculator returned by MarginMarketParamsStore.getCalculator(). In Rust, load exchange metadata and market prices before calling to_trader_portfolio_with_metadata(&metadata) and compute_margin(&metadata). Both paths use discounted cbBTC value for effective collateral and the full index-price value for portfolio value.

View trader margin with Hawkeye

Use Hawkeye simulation to check the on-chain margin calculation after the deposit confirms. Hawkeye includes the discounted cbBTC balance alongside any other collateral on that subaccount. For the balance itself, read the cbBTC entry in the trader state described in Accounts.