Welcome to CosVM
  • 🕧What is CosVM?
  • 🚧Technical structure
  • ⛓️User Guide
    • CVM Wallet Configuration
    • CVM Wallet App
    • MetaMask Configuration
    • Keplr Wallet Configuration
    • Trust Wallet
  • 🔯Developer Docs
    • 🉑Concepts
      • Accounts
      • Chain ID
      • Overview of Gas and Fees on CosVM Blockchain
      • Tokenomics of CosVM Blockchain
      • Token
      • Transactions
      • Tokens Transfer
      • Gas and Fees
    • Getting Started
    • Smart Contracts
      • Evm Extension
        • Authorization
        • Types
        • Staking
        • Distribution
        • IBC Transfer
    • 🔍CosVM Block Explorer
    • Mainnet
    • Wallet Integration
    • Other Tools
      • Contract Verification
      • Smart Contract Development Tools:
    • API
      • Network
      • Ethereum JSON-RPC
        • API Method
      • Cosmos gRPC & REST
      • Tendermint RPC
    • Cosvm using Docker
    • DAPPS
      • Getting Started
      • 🫂CVM dApps
  • 🈳Validator Docs
    • Validator Overview
    • Installation Reqirement
    • Run a Validator
    • Launch a CVM Node
    • Launch Multi CVM Node
    • Disk Optimization
    • State Sync
    • Mempool
    • ❄️IBC
      • IBC
      • IBC Relaying Guide
  • ❓Why Use CosVM
  • 🔐Safety & Security
  • ⁉️FAQs
Powered by GitBook
On this page
  • Prerequisite Readings
  • Terminology
  • Basics:
  • What is Gas?:
  • Gas Calculations:
  • Gas vs. Fees:
  • Handling Fees on Cosmos:
  • Handling Fees on Ethereum:
  • Implementation
  • Handling Gas and Fees on cosVM:
  • Gas Mechanics on Cosmos and cosVM:
  • Gas Estimation and Cross-Chain Fees:
  • Handling Gas and Fees via cosVM CLI:
  1. Developer Docs
  2. Concepts

Gas and Fees

PreviousTokens TransferNextGetting Started

Last updated 1 year ago

The network introduces a fee structure that requires users to pay fees when submitting transactions. These fees are an essential part of the network's functioning and are implemented differently compared to other blockchain platforms like and . Understanding how handles fees, particularly in an Ethereum-like fee calculation manner, is crucial given its compatibility with the .

Prerequisite Readings

  • Gas Calculation Basics: Gas calculation is fundamental in determining the fees associated with transactions on the . Gas refers to the computational cost required to execute operations or smart contracts within the network. Each operation consumes a specific amount of gas, and the total fee for a transaction is calculated based on the gas used and the gas price.

  • Fee Provision for Transactions: Users must provide fees alongside their transactions on . These fees cover the computational resources utilized during transaction execution. Unlike traditional transaction fees, adopts a gas-based fee system where the gas price determines the cost per unit of gas consumed.

  • Ethereum-Type Fee Calculation and EIP1559: The blockchain implements an Ethereum-type fee calculation method, particularly leveraging EIP1559. This fee model aims to create a more predictable fee structure and efficient use of block space by introducing a base fee that adjusts dynamically based on network demand. Users can set a "tip" to prioritize their transactions in the fee market.

  • Smart Contract Interaction Fees on : Interacting with smart contracts on incurs fees. These fees, when paid for interacting with smart contracts, can generate revenue for the individuals or entities deploying these smart contracts. It's worth noting that this revenue aspect provides an incentive for smart contract deployment on the platform

Terminology

Basics:

Transactions require fees to prevent network abuse. If transactions were free, malicious actors could flood the network with fraudulent transactions, causing congestion and disruptions. The concept of "gas" addresses this by charging a small amount of gas for each computational step during transaction execution, preventing malicious actors from halting the network.

What is Gas?:

Gas measures the computational intensity of transactions, with complex transactions requiring more gas than simpler ones. It's akin to electricity or fuel, representing the cost of network usage.

Gas Calculations:

Gas calculation varies based on transaction details, and estimating gas usage can be complex. For Cosmos SDK transactions, simulation helps calculate gas. In the Ethereum Virtual Machine (EVM), each bytecode operation incurs a specific gas cost.

Gas vs. Fees:

While gas represents computational work, fees are the tokens spent for transaction execution. Fees are calculated as the product of gas used and gas price, similar to an energy bill based on consumption and rate.

Handling Fees on Cosmos:

On Cosmos, users set GasLimit and either Fees or GasPrice. Transactions failing to meet GasLimit result in execution failures without fee refunds. Validators can enforce minimum gas prices.

Handling Fees on Ethereum:

Ethereum evolved its fee implementation. EIP-1559 introduced BaseFee and PriorityFee, replacing GasPrice. The BaseFee is burned, while the PriorityFee rewards block proposers.

Implementation

How are Gas and Fees Handled on cosVM?

Handling Gas and Fees on cosVM:

cosVM integrates EVM compatibility into the Cosmos SDK, using fee logic from Cosmos SDK, Ethereum, and custom cosVM. It implements a fee market module to calculate dynamic fees based on EIP-1559. Unused gas is refunded, and developers receive a portion of transaction fees through the Revenue Module.

Gas Mechanics on Cosmos and cosVM:

Cosmos tracks gas consumption through GasMeter and BlockGasMeter. cosVM matches EVM gas consumption, resets gas meters, and ensures accurate gas refunds.

Gas Estimation and Cross-Chain Fees:

cosVM provides APIs for gas estimation, aligning with Ethereum's eth_estimateGas. Cross-chain transactions can utilize tips to cover fees on different networks.

Handling Gas and Fees via cosVM CLI:

cosVM CLI flags allow users to define fees, gas limits, and gas prices for transactions, with options for automatic estimation. Users should consider adjusting gas values based on network traffic to avoid transaction failures due to insufficient gas.

🔯
🉑
CosVM
Ethereum
Cosmos
CosVM
Cosmos SDK
Ethereum Gas
CosVM
network
CosVM
CosVM
CosVM
CosVM
CosVM
CosVM