Withdraw from Filecoin Pay
As clients store data with you, payments accrue in Filecoin Pay. This guide shows how to withdraw your available USDFC balance to your wallet and swap it to FIL.
Two tools can do this. filpay-cli is recommended: it is built on the Synapse SDK and handles pending nonces correctly even while your PDP nodes are actively sending transactions. Foundry (cast) works for reference, but has a known nonce bug on Filecoin that causes frequent failures on busy nodes.
Contract Addresses (Mainnet)
Section titled “Contract Addresses (Mainnet)”This guide covers Mainnet withdrawals. The addresses below, the default rpc.ankr.com/filecoin endpoint, and the SushiSwap swap all target Mainnet. The same commands work on Calibration with the Calibration contract addresses and an RPC such as https://api.calibration.node.glif.io/rpc/v1.
| Contract | Address |
|---|---|
| Payments | 0x23b1e018F08BB982348b15a86ee926eEBf7F4DAa |
| USDFC Token | 0x80B98d3aa09ffff255c3ba4A241111Ff1262F045 |
Withdraw
Section titled “Withdraw”Prerequisites
Section titled “Prerequisites”-
Node.js 18+
-
Your wallet private key
-
Some FIL for gas
-
filpay-cli installed:
Terminal window npm install -g filpay-cli
-
Check your available balance. Replace
<YOUR_WALLET_ADDRESS>with your address:Terminal window filpay balance --account <YOUR_WALLET_ADDRESS>For wallet balance and more detail, add
--detailed:Terminal window filpay balance --account <YOUR_WALLET_ADDRESS> --detailedThe command returns four values:
Field Description Current FundsTotal funds in your Filecoin Pay account AvailableWithdrawable amount, what you can take out now Lockup RateAmount locked in active payment rails Wallet BalanceUSDFC in your wallet (shown with --detailed) -
Withdraw funds to your wallet:
Terminal window filpay withdraw <AMOUNT> --key <YOUR_PRIVATE_KEY>Examples:
Terminal window filpay withdraw 10 --key $PRIVATE_KEY # withdraw 10 USDFCfilpay withdraw 0.5 --key $PRIVATE_KEY # withdraw 0.5 USDFCfilpay withdraw 10 --to 0xRecipientAddress --key $PRIVATE_KEY # to another addressThe default RPC is
https://rpc.ankr.com/filecoin. Use a different endpoint with--rpc:Terminal window filpay withdraw 10 --key $PRIVATE_KEY --rpc https://api.node.glif.io/rpc/v1
Manage Payment Rails
Section titled “Manage Payment Rails”filpay-cli also covers wallet and rail operations:
filpay wallet-balance --account <YOUR_WALLET_ADDRESS> # wallet USDFC balancefilpay wallet-balance --key $PRIVATE_KEY # include contract balancefilpay rails list --key $PRIVATE_KEY # list your payment railsfilpay rails info <RAIL_ID> --key $PRIVATE_KEY # detail for one railfilpay settle 0xPayerAddress --key $PRIVATE_KEY # settle a specific payerfilpay rails settle-all --key $PRIVATE_KEY --yes # settle all railsfilpay settlement-preview 0xPayerAddress --key $PRIVATE_KEY # preview before settlingfilpay deposit 100 --key $PRIVATE_KEY # deposit USDFC into Filecoin Payfilpay balance --account <YOUR_ADDRESS> --json # JSON output for scriptingTroubleshooting
Section titled “Troubleshooting”- “Insufficient funds”. You are withdrawing more than your available balance. Re-check it with
filpay balance. - “Nonce too low”. Unlike
cast, filpay-cli handles nonces correctly even with active PDP nodes. Wait a moment and retry. - Transaction reverts. Ensure your wallet has enough FIL for gas.
- Balance shows 0. Funds may still be locked in active payment rails. If this looks wrong, contact the FOC team.
- “filpay: not found”. Install it globally with
npm install -g filpay-cli, or run it withnpx filpay-cli balance --account <YOUR_ADDRESS>.
Resources
Section titled “Resources”- npm package: filpay-cli
- Source: FilOzone/filpay-cli
- Contract: FilOzone/filecoin-pay
Prerequisites
Section titled “Prerequisites”- Foundry installed (provides
cast) - Your wallet private key, or a hardware wallet (Ledger or Trezor)
- Some FIL for gas
-
Check your available balance. Replace
<YOUR_WALLET_ADDRESS>with your address:Terminal window cast call 0x23b1e018F08BB982348b15a86ee926eEBf7F4DAa \"getAccountInfoIfSettled(address,address)(uint256,uint256,uint256,uint256)" \0x80B98d3aa09ffff255c3ba4A241111Ff1262F045 \<YOUR_WALLET_ADDRESS> \--rpc-url https://rpc.ankr.com/filecoinThe command returns four values:
Position Field Description 1 fundedUntilEpochEpoch until which your account is funded 2 currentFundsTotal funds in your account 3 availableFundsWithdrawable amount (in wei) 4 currentLockupRateRate locked in active payment rails Only the third value,
availableFunds, can be withdrawn. USDFC uses 18 decimals, so divide by10^18to convert wei to USDFC. To print the available balance directly in USDFC:Terminal window cast call 0x23b1e018F08BB982348b15a86ee926eEBf7F4DAa \"getAccountInfoIfSettled(address,address)(uint256,uint256,uint256,uint256)" \0x80B98d3aa09ffff255c3ba4A241111Ff1262F045 \<YOUR_WALLET_ADDRESS> \--rpc-url https://rpc.ankr.com/filecoin | \awk 'NR==3 {printf "Available: %.6f USDFC\n", $1/1e18}' -
Withdraw funds. Replace
<AMOUNT_IN_WEI>with theavailableFundsvalue from step 1:Terminal window cast send 0x23b1e018F08BB982348b15a86ee926eEBf7F4DAa \"withdraw(address,uint256)" \0x80B98d3aa09ffff255c3ba4A241111Ff1262F045 \<AMOUNT_IN_WEI> \--rpc-url https://rpc.ankr.com/filecoin \--private-key <YOUR_PRIVATE_KEY>For example, to withdraw 10 USDFC use
10000000000000000000, and for 100 USDFC use100000000000000000000.Using a hardware wallet, swap
--private-keyfor--ledgeror--trezor:Terminal window cast send 0x23b1e018F08BB982348b15a86ee926eEBf7F4DAa \"withdraw(address,uint256)" \0x80B98d3aa09ffff255c3ba4A241111Ff1262F045 \<AMOUNT_IN_WEI> \--rpc-url https://rpc.ankr.com/filecoin \--ledger
Quick Reference: USDFC to Wei
Section titled “Quick Reference: USDFC to Wei”| USDFC | Wei |
|---|---|
| 1 | 1,000,000,000,000,000,000 |
| 10 | 10,000,000,000,000,000,000 |
| 100 | 100,000,000,000,000,000,000 |
| 1,000 | 1,000,000,000,000,000,000,000 |
You can also compute it directly: cast to-wei 50 returns 50000000000000000000.
Troubleshooting
Section titled “Troubleshooting”- “Insufficient funds”. You are withdrawing more than your available balance. Re-check step 1.
- Transaction reverts. Ensure your wallet has enough FIL for gas.
- Balance shows 0. Funds may still be locked in active payment rails. If this looks wrong, contact the FOC team.
Swap USDFC to FIL
Section titled “Swap USDFC to FIL”After withdrawing, the USDFC is in your wallet. To swap it to FIL, open SushiSwap, connect your wallet, enter the amount of USDFC to swap, then review and confirm the transaction.