Overview of Gas and Fees on CosVM Blockchain
Last updated
Last updated
Similar to various blockchain networks, transactions on the CosVM blockchain incur fees, but these fees are lower compared to other blockchains. They serve to ensure network security, prevent spam attacks, and maintain efficient network operation. Without fees, malevolent actors could flood the network with fraudulent transactions, potentially disrupting normal network functionality.
Gas represents the computational intensity of a transaction on the blockchain. It quantifies the computational work required to process a transaction. Complex transactions demand more gas compared to simpler ones but these fees are lower compared to other blockchains, similar to how multifaceted tasks require more energy or fuel to complete.
The exact gas cost of a transaction is not known in advance and is usually determined during execution. The Cosmos SDK allows the simulation of transactions to estimate gas usage. For EVM (Ethereum Virtual Machine) transactions, each bytecode operation incurs a specific amount of gas.
While gas reflects the computational workload, fees are the actual tokens spent to execute a transaction. The total fees incurred for a transaction are calculated by multiplying the gas used by the gas price, like the relationship between electricity consumed and the corresponding bill.
On the blockchain, users specify GasLimit (GasWanted) to cap execution gas and either Fees or GasPrice to determine or calculate transaction fees. Transactions with insufficient gas will fail without refunds, and validators enforce minimum gas prices, causing delays or transaction failures for insufficient fees.
Gas Estimation: A specific query API Estimate Gas is implemented, performing a binary search to find the optimal gas value for a transaction.
Cross-Chain Gas and Fees: The Cosmos SDK's Tip mechanism enables users to cover transaction fees using different tokens, aiding in scenarios like cross-chain transactions.
As is built on the Cosmos SDK and incorporates EVM compatibility, it aligns fee management across different execution layers. handles fees using a combination of Cosmos SDK and Ethereum logic while introducing certain customizations.
Fee Market Module: Implements EIP-1559 for fee calculation and transaction prioritization. Unlike Ethereum, the BaseFee on is distributed to validators and delegators instead of being burned.
EVM Gas Refunds: refunds a portion (default: at least 50%) of unused gas for EVM transactions, mimicking Ethereum's behavior.
Detailed Mechanics: gas mechanisms align with Cosmos SDK principles, using GasMeter and BlockGasMeter to track gas usage and enforce limits. To match EVM gas consumption, disregards SDK gas consumption logic and calculates gas usage based on EVM computations.
Zero-Fee Transactions: allows for zero-fee transactions for transaction types not defined by the EVM module, with validators setting minimum fees.
CosVM CLI Transaction Handling: Users can leverage various flags like --fees, --gas, and --gas-prices to control transaction parameters while broadcasting transactions using the CLI client.
The blockchain intricately balances gas usage, fee management, and compatibility with both Cosmos SDK and Ethereum principles to ensure efficient transaction processing while rewarding developers for innovative smart contract development