This page explains how the IBX token billing system works for Builders who sponsor their users' onchain transactions.
Within a given Builder's rpId (dApp domain name - e.g. app.ibexwallet.org), end-user onchain transactions are sponsored by the Builder's wallet using IBX tokens. This sponsorship covers gas and execution fees for permitted operations, ensuring a smooth user experience without requiring users to hold native gas tokens.
The Builder funds and manages the IBX balance that backs these sponsored operations. Each operation type has a configurable price in EUR, which is automatically converted to IBX tokens and charged to the Builder's billing wallet.
The billing process is triggered automatically after a Safe operation is successfully executed:
PENDINGSENT, then CONFIRMED after blockchain confirmationEach Builder must configure a billing wallet address. This wallet will be charged IBX tokens for sponsored operations.
PENDING but no token transfer will occur. The operation will still succeed, but billing will be skipped.
The IBX/EUR exchange rate is configured globally via the BILLING_IBX_PRICE environment variable. This rate is used to convert EUR prices to IBX amounts.
Formula: ibxAmount = priceEur / eurPerIbx
Each operation type can have a custom price in EUR, configured per Builder:
If no pricing is configured for an operation type, the billing amount defaults to 0 (free operation).
Each billing transaction progresses through the following statuses:
| Status | Description |
|---|---|
PENDING |
Billing transaction created, awaiting token transfer. This occurs when:
|
SENT |
Token transfer transaction has been submitted to the blockchain, awaiting confirmation |
CONFIRMED |
Token transfer transaction has been confirmed on the blockchain. Billing is complete. |
FAILED |
Billing transaction failed. Common reasons:
|
The billing system uses ERC20 transferFrom to move IBX tokens:
BILLING_DESTINATION environment variable)BILLING_EXECUTOR private key)BILLING_TOKEN environment variable)Common operation types that can be billed include:
TRANSFER_TOKEN : Token transfer operationsSWAP_FROM_QUOTE : Token swap operationsENABLE_RECOVERY : Wallet recovery setupCANCEL_RECOVERY : Wallet recovery cancellationMONERIUM_CREATE_IBAN : IBAN creationSIGN_MESSAGE : Message signing operationsEach Builder can configure custom prices for each operation type, allowing for flexible pricing models.
If billing fails, the following diagnostics are performed:
Failed billing transactions do not prevent the user's operation from succeeding. The operation is executed on-chain, but billing is marked as FAILED for later resolution.
The billing mechanism is implemented in src/services/billingService.ts:
BillingService.triggerBilling() : Main entry point, called after operation executionBillingService.executeBillingTransaction() : Executes the ERC20 transferFrom transactionBillingService.waitAndFinalizeBilling() : Waits for blockchain confirmation and updates statusBillingService.getBillingDiagnostics() : Provides balance and allowance diagnosticsBilling is triggered automatically in src/routes/v1/safesOperations.ts after a Safe operation is successfully executed via the bundler.