Transaction Fees
Learn how transaction fees work on Paxeer Network
Overview
Paxeer Network is designed to be EVM equivalent, which means it reuses the same Ethereum code and behaves as much like Ethereum as possible. Transaction fees on Paxeer Network follow the standard Ethereum EIP-1559 fee mechanism with significantly lower costs due to Layer 2 optimization.
Fee Structure
Transaction fees on Paxeer Network consist of a single component:
totalFee = gasUsed × (baseFee + priorityFee)Unlike some Layer 2 solutions, Paxeer Network does not have an L1 data fee component, making fee estimation simpler and more predictable.
Execution Gas Fee
A transaction's execution gas fee on Paxeer Network is calculated the same way as on Ethereum. This fee is equal to the amount of gas used by the transaction multiplied by the gas price attached to the transaction.
How It Works
Paxeer Network uses the EIP-1559 mechanism to set the base fee for transactions. The total price per unit gas that a transaction pays is the sum of:
- Base Fee - Minimum price per unit of gas
- Priority Fee - Optional tip to incentivize faster inclusion
gasPrice = baseFee + priorityFee
totalFee = gasUsed × gasPriceBecause Paxeer Network is EVM equivalent, the gas used by a transaction on Paxeer is exactly the same as the gas used by the same transaction on Ethereum. If a transaction costs 100,000 gas on Ethereum, it will cost 100,000 gas on Paxeer Network. The only difference is that the gas price on Paxeer is much lower.
Base Fee
The base fee is the minimum price per unit of gas that a transaction must pay to be included in a block.
Key Points:
- Transactions must specify a maximum base fee higher than the block base fee
- The actual fee charged is the block base fee (even if you specify higher)
- Base fee adjusts automatically based on network demand
- Increases when blocks are full, decreases when blocks are empty
The Paxeer Network base fee behaves exactly like the Ethereum base fee, optimized for fast block times.
// Get current base fee
uint256 baseFee = block.basefee;Priority Fee
Just like on Ethereum, Paxeer Network transactions can specify a priority fee (also called a tip). This is a price per unit of gas paid on top of the base fee.
Example:
- Block base fee: 1 gwei
- Transaction priority fee: 1 gwei
- Total price per gas: 2 gwei
Tip
The Paxeer Network sequencer will prioritize transactions with a higher priority fee and execute them before transactions with a lower priority fee. If transaction speed is important to your application, set a higher priority fee to ensure quick inclusion.
The priority fee is optional and can be set to 0, but some wallets may enforce a minimum value (typically 1 gwei).
Getting Recommended Fees
Use the eth_maxPriorityFeePerGas RPC method to estimate a priority fee for quick inclusion:
// Get recommended priority fee
const priorityFee = await provider.send('eth_maxPriorityFeePerGas', []);
console.log('Recommended priority fee:', priorityFee);from web3 import Web3
w3 = Web3(Web3.HTTPProvider('https://public-rpc.paxeer.app/rpc'))
# Get recommended priority fee
priority_fee = w3.eth.max_priority_fee
print(f'Recommended priority fee: {priority_fee}')curl -X POST https://public-rpc.paxeer.app/rpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_maxPriorityFeePerGas",
"params": [],
"id": 1
}'Fee Calculation Examples
Example 1: Simple Transfer
const gasUsed = 21000; // Standard ETH transfer
const baseFee = 1000000000; // 1 gwei
const priorityFee = 1000000000; // 1 gwei
const totalFee = gasUsed * (baseFee + priorityFee);
// = 21000 × 2 gwei = 42,000 gwei = 0.000042 PAXExample 2: Contract Interaction
const gasUsed = 150000; // Contract call
const baseFee = 1000000000; // 1 gwei
const priorityFee = 2000000000; // 2 gwei (higher priority)
const totalFee = gasUsed * (baseFee + priorityFee);
// = 150000 × 3 gwei = 450,000 gwei = 0.00045 PAXEstimating Transaction Costs
import { ethers } from 'ethers';
const provider = new ethers.JsonRpcProvider('https://public-rpc.paxeer.app/rpc');
async function estimateTransactionCost(tx) {
// Estimate gas
const gasEstimate = await provider.estimateGas(tx);
// Get fee data
const feeData = await provider.getFeeData();
// Calculate total cost
const maxFee = feeData.maxFeePerGas;
const estimatedCost = gasEstimate * maxFee;
console.log('Estimated gas:', gasEstimate.toString());
console.log('Max fee per gas:', ethers.formatUnits(maxFee, 'gwei'), 'gwei');
console.log('Estimated cost:', ethers.formatEther(estimatedCost), 'PAX');
return estimatedCost;
}
// Usage
const tx = {
to: '0x...',
value: ethers.parseEther('1.0'),
};
await estimateTransactionCost(tx);import { createPublicClient, http, parseEther } from 'viem';
import { paxeer } from './chains';
const client = createPublicClient({
chain: paxeer,
transport: http(),
});
async function estimateTransactionCost(tx) {
// Estimate gas
const gasEstimate = await client.estimateGas(tx);
// Get fee data
const gasPrice = await client.getGasPrice();
// Calculate total cost
const estimatedCost = gasEstimate * gasPrice;
console.log('Estimated gas:', gasEstimate);
console.log('Gas price:', gasPrice);
console.log('Estimated cost:', estimatedCost);
return estimatedCost;
}
// Usage
await estimateTransactionCost({
to: '0x...',
value: parseEther('1'),
});import { useEstimateGas, useGasPrice } from 'wagmi';
import { parseEther, formatEther } from 'viem';
function TransactionCostEstimator() {
const { data: gasEstimate } = useEstimateGas({
to: '0x...',
value: parseEther('1'),
});
const { data: gasPrice } = useGasPrice();
const estimatedCost = gasEstimate && gasPrice
? gasEstimate * gasPrice
: 0n;
return (
<div>
<p>Estimated Gas: {gasEstimate?.toString()}</p>
<p>Gas Price: {gasPrice?.toString()}</p>
<p>Estimated Cost: {formatEther(estimatedCost)} PAX</p>
</div>
);
}Gas Price Monitoring
Monitor current gas prices on Paxeer Network:
import { ethers } from 'ethers';
const provider = new ethers.JsonRpcProvider('https://public-rpc.paxeer.app/rpc');
async function monitorGasPrices() {
const feeData = await provider.getFeeData();
console.log({
baseFee: ethers.formatUnits(feeData.maxFeePerGas, 'gwei'),
priorityFee: ethers.formatUnits(feeData.maxPriorityFeePerGas, 'gwei'),
});
}
// Check gas prices every 10 seconds
setInterval(monitorGasPrices, 10000);Best Practices
Fee Vault
The Sequencer Fee Vault collects and holds transaction fees paid to the sequencer during block production on Paxeer Network.
Vault Address: 0x4200000000000000000000000000000000000011
How It Works
- Fee Collection: During transaction processing, the sequencer collects fees from users
- Storage: Collected fees are deposited into the Sequencer Fee Vault contract
- Distribution: Fees are distributed to cover operational costs and network maintenance
Comparing Costs
Paxeer Network vs Ethereum
| Operation | Ethereum | Paxeer Network | Savings |
|---|---|---|---|
| ETH Transfer (21,000 gas) | ~$5-20 | ~$0.01-0.05 | 99%+ |
| Token Swap (150,000 gas) | ~$30-100 | ~$0.05-0.20 | 99%+ |
| NFT Mint (200,000 gas) | ~$40-150 | ~$0.10-0.30 | 99%+ |
Actual costs vary based on current gas prices. Paxeer Network typically offers 99%+ cost savings compared to Ethereum mainnet.
Advanced Topics
EIP-1559 Parameters
Paxeer Network uses EIP-1559 with these parameters:
| Parameter | Value | Description |
|---|---|---|
| Block Gas Limit | 30,000,000 | Maximum gas per block |
| Block Time | ~2 seconds | Target block production time |
| Base Fee Max Change | 12.5% | Maximum base fee change per block |
| Elasticity Multiplier | 2 | Block gas target multiplier |
Gas Price Oracle
Query the Gas Price Oracle for current fee data:
// Gas Price Oracle address
address constant GAS_PRICE_ORACLE = 0x420000000000000000000000000000000000000F;
interface IGasPriceOracle {
function gasPrice() external view returns (uint256);
function baseFee() external view returns (uint256);
}
// Usage
IGasPriceOracle oracle = IGasPriceOracle(GAS_PRICE_ORACLE);
uint256 currentBaseFee = oracle.baseFee();Troubleshooting
Next Steps
How is this guide?