Gas
Gas refers to the fee required to execute a transaction. Think of it as the fuel on which the network runs. Gas powers the XDC network.

Prerequisites

We recommend you first read transactions to understand this page better.

What is Gas?

Gas is a unit measuring the amount of computational power required to execute operations on the XDC network. Since every operation uses computational resources, there is an associated "gas" fee. Gas fees are always paid in the network's native currency, XDC. They are denoted in gwei, a denomination of XDC.
Let's say Ana pays Ben 1 XDC. For doing so, the gas price is 30 gwei.
The total fee is calculated as follows: Gas units * Gas price per unit, i.e., 35,000 * 30 = 1,050,000 gwei or 0.00105 XDC
Thus, when Ana sends the funds, 1.00105 XDC is deducted from Ana's account, and Ben's account is credited with 1.0000 XDC. The validator receives the remaining 0.00105 XDC.

Why Do Gas Fees Exist?

Gas fees keep the XDC network safe and secure. Since operations incur a cost, bad actors lose the incentive they would otherwise have to spam the network. Moreover, transactions can only execute so many computational code steps, which prevents infinite loops and various other kinds of computational code wastage. Any gas left unused after a successful transaction is automatically returned to the user.

How to Reduce Gas Costs

To decrease gas costs, set your gas fee and choose the priority level of your transaction wisely. Since the gas fee represents the amount you are willing to pay per unit for a given transaction, the higher the gas fee, the more incentive validators have to execute the transaction promptly. Set your gas fee too low, however, and validators will have little to no incentive to execute your transaction, in which case you may be forced to resubmit the transaction and pay even more gas fees.
Copy link
On this page
Prerequisites
What is Gas?
Why Do Gas Fees Exist?
How to Reduce Gas Costs