LogoLogo
ProductsCommunityGitHubShare Feedback
NFT Kit
NFT Kit
  • What is the NFT KIT?
    • Introduction
    • Non-Fungible Tokens (NFTs)
      • NFT | Basics
      • Technologies & Concepts
    • NFT Kit
      • NFT Kit | Basics
        • Overview
        • Functionality
      • NFT Flavors & Ecosystems
      • Architecture
        • Low-Level Service Abstraction
        • Ecosystem Abstraction
        • High-Level Interfaces / APIs
      • Use Cases
  • Getting started
    • Quick Start
  • Ecosystems
    • Ethereum | Polygon | Shimmer
      • Setup
      • NFT | Creation & Management
        • Smart Contract Deployment
        • Minting NFTs
        • Get NFT Metadata
        • Get Account Balance
        • Get Token Owner
        • Get Collection Info
        • Get NFTs by Account
      • NFT | Ownership Verification
        • Ownership Verification
        • Ownership Verification With Traits
      • Smart Contract | Extensions
        • Pausable
        • Burnable
      • Smart Contract | Access Control
        • Ownership
        • Role-Based Access Control
    • Ocean Protocol
      • Setup
      • NFT | Verification
      • NFT | Wallet
      • Architecture
    • Tezos
      • Architecture
      • NFT | Creation & Management
        • Smart Contract
        • Add Minter
        • NFT Minting
        • Fetch NFT metadata
        • Get account NFTs
        • Get contract metadata
      • NFT | Ownership Verification
        • NFT Ownership Verification
        • NFT Ownership Verification Within A Collection
        • NFT Ownership Verification With Traits
      • NFT | Wallet
      • Tutorials
        • Minting NFTs on Tezos
          • Setup
          • New Collection
          • First NFT
          • Verification
          • Wallet
    • Near Protocol
      • Architecture
        • Smart Contract
        • Blockchain NFTs operations
        • NFTs Queries
      • NFT | Creation & Management
        • NEAR Sub-Account
        • Deploy NFT Contract
        • NFT | Minting
      • Querying NFT information controller
        • Get NFTs for account
        • Get NFT By Token Id
        • Get NFT contract metadata
      • NFT | Wallet
      • Tutorials
        • Minting NFT on Near Protocol
          • Near Wallet Creation
          • Setup NFT-Kit
          • Create Sub-account
          • Smart Contract ( Collection )
          • Minting your first NFT
        • NFT Ownership Verification
        • Wallet
    • Polkadot
      • Architecture
      • Query NFTs
        • Unique network
          • Fetching Token id & Collection id
          • Fetching NFT metadata
        • Parachain Networks
          • Fetching Tokens by subscan
          • Fetching EVM ERC721 Collectibles by subscan
      • NFT | Ownership Verification
        • NFT ownership verification
        • NFT ownership verification within a collection
        • NFT ownership verification with traits
      • NFT | Wallet
        • Polkadot parachains
        • Polkadot EVM compatible parachains
    • Flow
      • Architecture
        • Cadence Scripts
        • NFT Operations (FCL)
      • Querying NFT information Controller
        • Get NFTs for an account
        • Get NFTs in Collection
        • Get NFT by Token Id
      • NFT | Ownership Verification
        • NFT ownership verification on Flow
        • NFT ownership verification in collection on Flow
      • NFT | Wallet
        • Flow Blockchain
    • Algorand
      • Architecture
        • Algorand Standard Assets (ASAs)
      • NFT | Creation & Management
        • Account Creation
        • NFT Creation (ARC3)
      • Querying Asset information
        • Get Assets for account
        • Get Asset Details
        • Get NFT Metadata by asset id
        • Get NFT by Asset id
      • NFT | Ownership Verification
        • NFT ownership verification
        • NFT ownership verification with traits
        • NFT ownership verification Based on Creator
        • NFT Metadata verification against a dynamic policy
      • NFT | Wallet
        • Algorand Blockchain
    • IPFS
  • Concepts
    • Soulbound Tokens (SBTs)
    • NFT verification with OPA
  • Configurations
    • Configuration Files
    • Gas Provider
  • Community
    • Discord
    • Twitter
    • Newsletter
    • GitHub Discussions
  • DEVELOPER RELATIONS
    • Roadmap
    • Contribute
    • Share Feedback
    • Contact
  • Product Editions
    • Open Source | Always Free
    • Enterprise | Self-Managed
    • Cloud Platform | Managed
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Configurations

Gas Provider

Configuration of gasPrice and gasLimit for Ethereum and Polygon transactions

PreviousConfiguration FilesNextOpen Source | Always Free

Last updated 1 month ago

Was this helpful?

The execution of blockchain transactions requires configuration of the gas provider, using WaltIdGasProvider class. This allows you to set the gas price and limit for Ethereum and Polygon transactions, optimizing based on current market conditions and transaction complexity.

What is WaltIdGasProvider?

WaltIdGasProvider allows you to set a static gasPrice and gasLimit for Ethereum and Polygon transactions. These parameters are expressed in Wei (the smallest unit of Ether).

  • gasPrice refers to the fee you pay for computation performed as part of the transaction.

  • gasLimit is the maximum total fee that you are willing to pay for a transaction.

How to Adjust WaltIdGasProvider?

It's essential to remember that Ethereum and Polygon gas prices are not static and can fluctuate based on network demand.

To update, open the WaltIdGasProvider.kt file under src/main/kotlin/id/walt/nftkit/utilis and update the parameters gasPrice (1) and gasLimit (2) accordingly.

StaticGasProvider(BigInteger.valueOf(19_000_000_000L), BigInteger.valueOf(2_498_868))

To check the current gas prices, refer to the following resources:

Example: Calculating gasPrice and gasLimit

Let's say you find that the current average gas price is 20 Gwei and you're making a contract deployment transaction, where it makes sense to have the gasLimit at around 2_498_868. Here's how you would calculate the Wei values:

  1. Convert Gwei to Wei for gasPrice. Since 1 Gwei is 1,000,000,000 Wei, 20 Gwei is 20,000,000,000 Wei.

  2. The gasLimit remains constant, so you don't need to convert it. It will be 2,498,868.

So, to update the WaltIdGasProvider.kt with these values, you would write:

StaticGasProvider(BigInteger.valueOf(20_000_000_000L), BigInteger.valueOf(2_498_868))

Why is it Important?

Setting appropriate gas prices and limits is essential for two reasons:

  • Transaction Speed: If you set your gas price too low, your transaction could be ignored by miners, resulting in slow or failed transactions.

  • Cost Optimization: If your gas price is set too high, you might end up paying more than necessary for your transactions.

Remember, the gasLimit is the maximum gas you're willing to use for a transaction. If a transaction exceeds this limit, it will fail, but you will still be charged. As such, setting an appropriate gasLimit can help avoid unnecessary expenses.

Cointool's Gas Price Checker
Etherscan Gas Tracker