Funding wallets for gas
Keep transactions from stalling on networks where gas is not free. Check gas readiness before you submit, fund the right wallet, and resolve a GAS_REQUIRED failure.
Use this guide when your integration runs on a network where gas is not free and a transaction stops because the signing wallet cannot pay for it. Gas is the fee a network charges to run a transaction, paid in the network's own token. On networks that charge it, every transaction spends that token, so the wallet that signs the transaction must hold a balance first. The steps below show how to check gas readiness before you submit, fund the wallet that actually pays, and recover from a GAS_REQUIRED failure using the data the platform hands back.
Advanced accounts can sponsor a transaction's gas from a shared treasury, so the user's wallet pays nothing. The steps here apply to the other path: a wallet that pays its own gas. For sponsored gas, see Gas treasury runway and fee split.
When a wallet needs its own gas
Two things decide whether a wallet must hold gas: the network, and whether the operation is sponsored.
- The network. Some networks charge no gas. On a zero-gas network, no wallet needs a balance, and
GAS_REQUIREDnever fires. On a network where gas is not free, every transaction costs the gas token, and the signing wallet must hold enough to cover it. - Sponsorship. With advanced accounts enabled, a paymaster can sponsor user operations from a funded treasury, so the user's own wallet spends no gas. Without sponsorship, or for a direct transaction that does not route through the paymaster, the signing wallet pays its own gas.
So a wallet needs its own funded balance when the network charges gas and the operation is not sponsored. Deployments and other direct on-chain writes from an unsponsored wallet are the common case.
Check gas readiness before you submit
Read a wallet's gas status before you queue a write, so you fund it ahead of time instead of after a failure.
curl --request GET \
"https://your-platform.example.com/api/v2/smart-wallets/0x1234567890abcdef1234567890abcdef12345678/gas-status" \
--header "X-Api-Key: sm_dalp_xxxxxxxxxxxxxxxx"{
"data": {
"hasPaymaster": false,
"walletBalance": "5000000000000000",
"chainZeroGas": false
},
"links": {
"self": "/v2/smart-wallets/0x1234567890abcdef1234567890abcdef12345678/gas-status"
}
}The response reports three signals:
| Field | What it tells you |
|---|---|
chainZeroGas | true when the network charges no gas. The wallet needs no balance, so you can stop here. |
hasPaymaster | true when the wallet's system has gas sponsorship available, so eligible operations spend no gas. |
walletBalance | The wallet's native gas-token balance, as a wei string. |
Read these together. If chainZeroGas is true, the wallet is ready. If the network charges gas and the operation is not sponsored, compare walletBalance against the cost of the operation you plan to submit and top up if it is short.
For a managed-custody wallet, read the native balance straight from the custody provider with GET /api/v2/smart-wallets/custody/gas-balance. It resolves the wallet from your authenticated session and reports balance, symbol, and decimals. This read works when the active signer is DFNS managed custody; for other signers it returns null.
Read a GAS_REQUIRED failure
When a wallet runs a transaction it cannot pay for, the platform returns a structured GAS_REQUIRED error (DALP-9087, status 422) instead of a generic failure string. The network rejects the transaction before it lands, so nothing executed and no gas was spent. The error carries everything you need to fund the wallet and try again.
{
"code": "GAS_REQUIRED",
"status": 422,
"message": "The wallet balance is too low to cover this transaction's gas",
"data": {
"id": "DALP-9087",
"shortfallWei": "3000000000000000",
"recommendedTotalWei": "23000000000000000",
"address": "0x1234567890abcdef1234567890abcdef12345678",
"chainId": 11155111,
"tokenSymbol": "ETH",
"walletRole": "transaction-signer",
"retryableByFunding": true
}
}| Field | Use it for |
|---|---|
shortfallWei | The smallest amount, in wei, to add to clear the wall. |
recommendedTotalWei | A buffered target balance that also covers the next few operations. |
address | The wallet to fund, always the caller's own signing wallet and never a shared operator wallet. |
chainId | The network the wallet must hold the balance on. |
tokenSymbol | The gas token to send, for example ETH. |
walletRole | The role the wallet plays in the rejected operation, for example transaction-signer. |
retryableByFunding | true when funding the wallet clears the failure. |
Fund the wallet and retry
- Send the gas token. Transfer at least
shortfallWeioftokenSymboltoaddresson the network identified bychainId. SendingrecommendedTotalWeiinstead leaves a buffer for the next few operations, so you fund less often. The amount is sized against the network's live fee, so a small over-send is normal and harmless. - Confirm the balance landed. Read
gas-statusagain and check thatwalletBalancenow covers the operation. - Resubmit the same request. Once the wallet holds enough, send the original request again.
Keep wallets funded over time
A wallet that pays its own gas drifts toward empty as it transacts. To avoid hitting GAS_REQUIRED mid-flow, read gas-status on the wallets your integration drives and top them up before they run low, the same way you would watch any operational balance. When the cost matters more than per-wallet control, enabling sponsorship through advanced accounts moves gas onto a shared treasury, so individual wallets stop needing their own balance.
Related guides
Track finality and status after you resubmit a funded transaction.
Monitor and refill the shared treasury that funds sponsored gas for advanced accounts.
Read gas status, custody gas balance, signers, and validator modules for a wallet.
The full structured-error contract, including the GAS_REQUIRED data payload.
How to track transaction status
Understand DALP transaction finality, indexer visibility, and safe retry behavior.
How to promote a DALP environment from testnet to mainnet
Move a validated DALP environment from a test EVM network to a production EVM network without treating testnet chain state as production state.