Transaction Fees
Transactions on Liberty Chain cost a fraction of what they would on Ethereum mainnet. Typical transactions cost between $0.001 and $0.01, making on-chain operations economically viable for high-frequency use cases like trading, settlement, and compliance checks.
This page explains how fees are calculated, what drives costs, and how to estimate gas for your transactions.
Fee Structure
Every transaction on Liberty Chain pays two fees:
total_fee = l2_execution_fee + l1_data_fee
L2 Execution Fee
The L2 execution fee covers the cost of executing your transaction on Liberty Chain. It works the same way as gas on Ethereum: the fee is calculated as the gas used multiplied by the current gas price.
l2_execution_fee = gas_used * l2_gas_price
The L2 gas price on Liberty Chain is significantly lower than Ethereum because the chain has much higher throughput and lower contention. The gas used for a given operation is identical to Ethereum — a simple ETH transfer uses 21,000 gas, an ERC-20 transfer uses approximately 65,000 gas, and so on.
L1 Data Fee
The L1 data fee covers the cost of posting your transaction data to Ethereum L1 for data availability. This is typically the larger component of the total fee. The cost depends on the size of the transaction data (in bytes) and the current Ethereum L1 gas price.
l1_data_fee = l1_gas_used * l1_base_fee * dynamic_overhead
The L1 data fee fluctuates with Ethereum L1 gas prices. When L1 is congested, L2 fees increase slightly. With EIP-4844 blob data, L1 data costs are dramatically lower than using calldata, keeping Liberty Chain fees consistently low.
GasPriceOracle
0x420000000000000000000000000000000000000F. Your wallet and development tools handle this automatically — you do not need to query this contract directly for normal usage.Typical Costs
The following table shows approximate costs for common operations on Liberty Chain. Actual costs depend on L1 gas prices at the time of the transaction.
| Operation | Gas Used | Approx. Cost |
|---|---|---|
| ETH transfer | 21,000 | ~$0.001 |
| ERC-20 transfer | ~65,000 | ~$0.002 |
| ERC-20 approval | ~46,000 | ~$0.001 |
| Uniswap-style swap | ~150,000 | ~$0.005 |
| NFT mint | ~100,000 | ~$0.003 |
| Contract deployment (simple) | ~500,000 | ~$0.01 |
Testnet Costs
Estimating Gas
Use the eth_estimateGas RPC method to estimate how much gas a transaction will consume. This returns the L2 execution gas only — the L1 data fee is calculated separately and added automatically.
curl -X POST https://testnet-rpc.lcx.com \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [{
"from": "0xYOUR_ADDRESS",
"to": "0xRECIPIENT_ADDRESS",
"value": "0xde0b6b3a7640000"
}],
"id": 1
}'In JavaScript with ethers.js:
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider(
"https://testnet-rpc.lcx.com"
);
// Estimate gas for a simple transfer
const gasEstimate = await provider.estimateGas({
from: "0xYOUR_ADDRESS",
to: "0xRECIPIENT_ADDRESS",
value: ethers.parseEther("0.1"),
});
console.log("Estimated gas:", gasEstimate.toString());
// Get current fee data
const feeData = await provider.getFeeData();
console.log("Gas price:", ethers.formatUnits(feeData.gasPrice, "gwei"), "gwei");
// Calculate L2 execution cost
const l2Cost = gasEstimate * feeData.gasPrice;
console.log("L2 execution cost:", ethers.formatEther(l2Cost), "ETH");Total Fee
eth_estimateGas covers only the L2 execution portion. The actual transaction cost will be slightly higher because of the L1 data fee. Wallets like MetaMask account for both fees when displaying the estimated cost to the user.Querying the GasPriceOracle
For advanced use cases, you can query the GasPriceOracle system contract directly to read fee parameters:
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider(
"https://testnet-rpc.lcx.com"
);
const ORACLE_ADDRESS = "0x420000000000000000000000000000000000000F";
const ORACLE_ABI = [
"function l1BaseFee() view returns (uint256)",
"function baseFee() view returns (uint256)",
"function gasPrice() view returns (uint256)",
"function getL1Fee(bytes) view returns (uint256)",
];
const oracle = new ethers.Contract(ORACLE_ADDRESS, ORACLE_ABI, provider);
const l1BaseFee = await oracle.l1BaseFee();
console.log("L1 base fee:", ethers.formatUnits(l1BaseFee, "gwei"), "gwei");
// Estimate L1 data fee for a specific transaction
const txData = "0x..."; // raw transaction bytes
const l1Fee = await oracle.getL1Fee(txData);
console.log("L1 data fee:", ethers.formatEther(l1Fee), "ETH");Tips for Minimizing Fees
- Reduce calldata size — the L1 data fee scales with transaction data size. Use smaller function signatures, pack data efficiently, and avoid unnecessary bytes in your transactions.
- Batch operations — if your contract supports it, batch multiple operations into a single transaction to amortize the L1 data fee across more work.
- Use events for data — emit events instead of storing rarely-accessed data in contract storage. Events are much cheaper than storage writes.
- Monitor L1 gas prices — if your use case is not time-sensitive, submit transactions when L1 gas prices are lower (typically weekends and off-peak hours) for lower L1 data fees.
Related Pages
- Architecture — understand why the two-fee model exists and how data flows from L2 to L1.
- RPC API Reference — full reference for
eth_estimateGas,eth_gasPrice, and related methods. - Network Details — system contract addresses including the GasPriceOracle.