Gas Management
Gas in cryptocurrency is a unit measuring the computational effort needed for blockchain operations. Each transaction requires resources and incurs a fee, known as gas, proportional to the work involved.
Understanding gas
Gas fees
A gas fee is a blockchain transaction fee, paid to network validators to the blockchain. It is most commonly used on blockchain. A transaction costs a certain amount on the network. This amount is used to pay for the computation on the Blockchain. The price of this computation is set by the amount of Gas specified in the transaction.
Gas limit
Gas limit refers to the maximum amount of gas you are willing to consume on a transaction. More complicated transactions involving smart contracts require more computational work, so they require a higher gas limit than a simple payment. A basic ETH transaction will set you off a gas limit of 21,000 units of gas.
Gas speed
Starton lets you configure the priority of your transaction by selecting speed. By choosing between low, average, fast and fastest, you determine if you're willing to increase incentive for your transaction to be mined, by paying more gas to the miner. On the contrary, if your transaction can wait, set low to save on gas. Your transaction won't be picked first, since it's not the most rewarding but can be mined at a calmer time for the mempool.
Defining gas prices
Specifying gas using transaction speed
In blockchain transactions, 'speed' refers to the gas limit set for processing a transaction. It impacts the transaction's processing time and fee. Options include 'low', 'average', 'fast', 'fastest', and 'custom'.
Speed Option | Gas Limit | Use Case | Advantage | Trade-off |
---|---|---|---|---|
Low | Reduced | Non-urgent transactions | Lower fee | Slower processing |
Average | Moderate | Standard transactions | Balanced cost and speed | Average processing time |
Fast | Elevated | Time-sensitive transactions | Quick processing | Higher fee |
Fastest | Maximum | Urgent transactions | Highest priority processing | Highest fee |
Custom | User-defined | Specific requirements | Customization | Recommended for experienced users |
Customizing Gas with Starton
When using Starton's API, you have the flexibility to configure custom gas settings for your transactions. This is particularly useful for executing transactions when network conditions, such as GWEI (the unit of gas price in Ethereum), are favorable.
Setting Custom Gas Parameters
You can use custom parameters everytime you are called to specify the speed of a transaction.
For example:
{
"speed": "custom",
"customGas": {
"maxFeePerGas": "5000000", // For EIP 1159 compliance
"maxPriorityFeePerGas": "1000000", // For EIP 1159 compliance
"gasPrice": "10000" // For older EIP standards
}
}
-
maxFeePerGas
: The maximum total fee per unit of gas you're willing to pay for a transaction, including the base fee and priority fee. Used in EIP-1559 transactions. -
maxPriorityFeePerGas
: The maximum tip per unit of gas to incentivize miners to include your transaction in a block. It's paid over and above the base fee in EIP-1559 transactions. -
gasPrice
: The fee per unit of gas for transactions, used for networks which haven't adopted EIP-1559.
You can use these settings when creating new transactions through the Starton API, either manually or via smart contract management functions.
Updating Relayer Settings in Starton
You can further customize your transaction strategies at project-level for each network by updating the Relayer settings. Our Relayer will follow your rules and increase the gas speed to avoid stuck transactions.
For more detailed instructions, go to Setting a transaction management strategy.