Gas
Understand gas pricing, limits, and optimization strategies for Paxeer Network transactions, with guides for sending transactions using paxd and EVM interfaces.
Gas measures the computational effort required to execute a transaction or contract on Paxeer Network. Gas fees are paid in PAX (denominated in uhpx on the Cosmos side).
Key terms and concepts
Gas
A unit representing the work done to execute a transaction. Gas varies based on operation complexity.
Gas price
The amount of PAX paid per unit of gas. Set by the user.
Gas limit
The maximum gas the transaction may consume. If too low, the transaction fails and the full gas limit is consumed.
Fee
Fee = Gas Price × Gas Used
The gas limit caps the maximum charge at Gas Price × Gas Limit. On Paxeer, excess gas may not be fully refunded, so avoid setting gas limits far above what a transaction needs.
Maximum gas
Query the maximum gas limit from the RPC node using the /consensus_params endpoint.
Minimum gas price
Paxeer enforces minimum gas prices to prevent spam.
Max bytes
Each transaction has a maximum size in bytes. Query via /consensus_params.
Max gas for queries
Queries consume gas. The maximum is RPC-specific.
Sending gas in transactions
Using paxd
With paxd, set the fee using the --fees flag. Gas limit and gas price use --gas and --gas-prices respectively.
paxd tx bank send <from_address> <to_address> <amount> --gas <gas_limit> --gas-prices <gas_price> --fees <fee>
Using EVM (wagmi)
import { parseEther, parseGwei } from 'viem';
import { sendTransaction } from '@wagmi/core';
import { config } from './config'; // your wagmi config
await sendTransaction(config, {
to: '0xRecipientAddress',
value: parseEther('1'), // 1 PAX
gasPrice: parseGwei('100'), // 100 gwei
gas: 21000n
});
Optimizing gas for smart contracts
- Minimize storage operations.
- Use fixed-size data structures where possible.
- Avoid unnecessary computations.
- Use events for data that doesn't need on-chain reads.
Estimating gas prices
Paxeer's EVM RPC exposes standard Ethereum JSON-RPC methods for gas estimation:
eth_gasPrice- current recommended gas price for legacy transactions.eth_maxPriorityFeePerGas- suggested priority fee for EIP-1559 transactions.eth_feeHistory- recent base fees and priority-fee percentiles.
Query the current gas price on mainnet:
curl -sS https://public-rpc.paxeer.app/evm/reference \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":1}'
With viem:
import { createPublicClient, http, defineChain } from 'viem';
const paxeer = defineChain({
id: 125,
name: 'Paxeer Network',
nativeCurrency: { name: 'PAX', symbol: 'PAX', decimals: 18 },
rpcUrls: {
default: { http: ['https://public-rpc.paxeer.app/evm/reference'] }
}
});
const client = createPublicClient({
chain: paxeer,
transport: http()
});
// Legacy gas price
const gasPrice = await client.getGasPrice();
// EIP-1559 fee suggestion
const { maxFeePerGas, maxPriorityFeePerGas } = await client.estimateFeesPerGas();