LogoLogo
  • Welcome
    • About ENI
  • Getting Started
    • Quickstart
      • Account Structure
      • Token Standards
      • Gas
    • Divergence from Ethereum
    • Transactions
      • Creating Transaction
    • Governance
      • Proposals
    • Oracles
  • Build
    • Setup and Installation
    • Smart Contracts
      • EVM (General)
      • EVM (CLI)
      • Querying State
    • Frontend Development
      • Overview
      • How to Deploy Your First dApp
    • Ecosystem
      • Tools and Resources
      • Resources
  • Node
    • Getting Started
    • Node Operators Guide
    • Validator Operations Guide
    • Advanced Configuration & Monitoring
    • Technical Reference
  • Reference
    • Overview
    • enid
    • CLI
      • enid add-genesis-account
      • enid blocktest
      • enid collect-gentxs
      • enid compact
      • enid config
      • enid debug
      • enid export
      • enid gentx
      • enid help
      • enid init
      • enid keys
        • enid keys delete
        • enid keys add
        • enid keys export
        • enid keys import
        • enid keys list
        • enid keys mnemonic
        • enid keys parse
        • enid keys show
      • enid latest_version
      • enid migrate
      • enid prune
      • enid query
        • enid query accesscontrol
        • enid query upgrade
        • enid query account
        • enid query auth
        • enid query bank
        • enid query block
        • enid query authz
        • enid query distribution
        • enid query epoch
        • enid query evidence
        • enid query evm
        • enid query feegrant
        • enid query ibc-transfer
        • enid query gov
        • enid query ibc
        • enid query mint
        • enid query oracle
        • enid query params
        • enid query slashing
        • enid query staking
        • enid query tendermint-validator-set
        • enid query tokenfactory
        • enid query tx
        • enid query txs
      • enid rollback
      • enid start
      • enid status
      • enid tendermint
      • enid tools
      • enid tx
      • enid validate-genesis
      • enid version
Powered by GitBook
On this page
  • Key Terms and Concepts
  • Optimizing Gas Prices for Smart Contracts
  1. Getting Started
  2. Quickstart

Gas

Gas is the unit that measures the computational workload required to execute transactions or contracts on the ENI network.


Key Terms and Concepts

Gas

Gas is a measure of the amount of work required to execute a transaction, and its value varies according to the complexity of the transaction being executed.


Gas Price

Gas Price refers to the amount of $ENI a user is willing to pay per unit of gas.

Users can set the gas price to influence transaction fees.


Gas Limit

Gas limit is the maximum amount of gas a user wants to use for a transaction. If the gas limit is set too low, a node attempting to execute the transaction will run out of gas, fail to complete the transaction, and consume the entire specified gas limit.


Fees

Fees = Gas Price * Gas Limit.

  • curl -H "Authorization: your-apikey-here" https://api.blocknative.com/gasprices/blockprices?chainid=$CHAIN_ID

Maximum Gas


Minimum Gas Price


Maximum Byte Size

Each transaction has a maximum byte limit, defined by each chain. This limit can be retrieved by querying the /consensus_params endpoint of an RPC node.


Maximum Gas Limit for Queries

Since queries also consume gas, they have a maximum gas limit. This limit is specific to each RPC provider, so check with your provider to determine the maximum gas limit for your query.


Sending Gas in Transactions

When submitting a transaction for broadcast, the user needs to specify the gas price and the gas limit to determine the fee.


Using enid

When using enid, fees are set via the --fees flag, and gas limits and gas prices can be set via the --gas and --gas-prices flags, respectively.

enid tx bank send <from_address> <to_address> <amount> --gas <gas_limit> --gas-prices <gas_price> --fees <fee>

Using CosmJS

In any CosmJS transaction, the gas fee must be specified using the StdFee object.

const fee = {
  amount: [{ denom: 'ueni', amount: '5000' }],
  gas: '200000'
};
const result = await client.signAndBroadcast(address, [msg], fee, memo);

Using EVM (wagmi)

import { sendTransaction } from 'wagmi/actions';

sendTransaction({
  request: {
    to: '0xRecipientAddress',
    value: '1000000000000000000',   // 1 ENI
    gasPrice: '100000000000',       // 100 Gwei
    gasLimit: '21000'
  }
});

Optimizing Gas Prices for Smart Contracts

Best Practices for Efficient Gas Usage:

  • Minimize storage operations: Storage is expensive in terms of gas.

  • Use fixed-size data structures: They are more gas-efficient.

  • Avoid unnecessary computations: Streamline your smart contract logic.

Optimizing gas usage ensures lower costs and faster execution for smart contracts on the ENI network.

PreviousToken StandardsNextDivergence from Ethereum

Last updated 2 months ago

The maximum gas limit for transactions ensures that complex transactions do not consume excessive resources. You can check or query an RPC node using /consensus_params (i.e., https://rpc.eniac.network/consensus_params) to find the maximum gas limit for each chain.

ENI enforces a minimum gas price to prevent junk transactions. These prices are set by chain and

the ENI registry
detailed in the chain registry.