Fees
A $0.10 fee per tx on Polygon, and a dynamic fee per tx is added on Optimism, is added to each transaction* and paid with existing USDC tokens. You DO NOT need any native (MATIC/ETH) tokens to deposit, transfer, or withdraw from zkBob.
Fees cover the cost of transactions in most situations (see below) and can result in a surplus depending on gas and token prices. USDC (or other pool token) accumulates with the fee receiver and is periodically withdrawn, swapped for native tokens, and sent to the relayer to subsidize future transaction costs. Relayers do not keep any profits from extra fees - all collected fees are used to support the protocol.
*In special cases, transactions may incur additional fees when many notes need to be processed at the same time. Learn more.
Transaction costs
Exact tx fees are calculated as the cost of the calldata
for an operation (deposit, transfer, withdrawal) multiplied by the gas price and the token price. Tx gas examples:
zkBob deposit 783,638 gas
zkBob transfer 601,357 gas
zkBob withdrawal 620,679 gas
To calculate a baseline for any operation, we take the highest gas cost (deposit) + 15% buffer = 902,000 gas.
Max Fee baseline = 902,000 * gas price * token price
Polygon Example
Fees can vary significantly based on the gas price and token price at the time of a transaction. In this table, the top row shows example USD equivalent token prices ($0.35 to $1.05) and the left column shows varying gas costs ranging from 30 to 100 Gwei. These are multiplied with 902,000 to calculate the cost for a max transaction.
30 Gwei
$0.009
$0.02
$0.03
75 Gwei
$0.02
$0.05
$0.07
100 Gwei
$0.03
$0.07
$0.1
Fee Collection
Fees are currently collected internally within the pool contract and the accumulatedFee
method. They can be manually withdrawn by a separate operator account (a specified account called the fee recipient) rather than a primary relayer account. This maintains safety in the protocol as a primary relayer is responsible for sending transactions and should not have the ability to call the withdrawFee
function.
Once enough USDC has accumulated, it can be withdrawn and swapped for native (MATIC/ETH) tokens. These are then sent to the primary relayer to cover gas fees for future operations.
View Accumulated Fees
Anyone can view current fees accumulated by the protocol. This does not represent all fees collected, but only those accumulated since the previous withdrawal.
Polygon Example
1) Go to the pool proxy contract on Polyscan and click the Read as Proxy tab.
2) Query the accumulatedFee
method using the Relayer (Operator) Address 0xc2c4ad59b78f4a0afd0cdb8133e640db08fa5b90.
3) Convert the result (in Gwei) to USD using Ethereum Unit Converter. The Ether amount will be USD equivalent (in the case below $13.70 is currently accumulated in the contract).
Last updated