Achieve cheaper gas costs when sending transactions through Alchemy's Gas Optimized endpoints
Optimizing gas values for transactions is one of the most complex and costly areas for developers. This document explains how Alchemy makes this process easier and how you can save money spent on transaction gas.
Gas-optimized transactions are available for any Alchemy user via the alchemy_sendGasOptimizedTransaction endpoint. With this endpoint, developers are able to get rid of the headache of finding optimal gas values when creating transactions and leave the hard work to Alchemy.
Developers and consumers alike spend more than necessary on transaction requests due to:
- Incorrect/inaccurate gas price estimation
- Network congestion
- Much more...
How Gas Optimized Transactions can help
Instead of sending a single transaction directly to a node, developers can send Alchemy a list of signed transactions via the alchemy_sendGasOptimizedTransaction endpoint. In the background, Alchemy will:
- Submit the cheapest transaction
- Check to see if the transaction gets mined
- Work its way through the list of signed transactions until it hits the most expensive transaction submitted
Ultimately, Gas Optimized Transactions mean that developers can try a wide range of gas values for a single transaction, removing the guesswork and estimation currently involved in the write process.
Help! Why are my transactions failing?
In order for transactions sent via alchemy_sendGasOptimizedTransaction to propagate, you must keep all parameters of the transaction list exactly the same except for the gas values used! Please check that this is correct.
Can I adjust the gas escalation pattern?
For each bundle of transactions sent via the alchemy_sendGasOptimizedTransaction endpoint, Alchemy will attempt each individual transaction up to 3 times on different nodes with ~4-second intervals between each attempt. If the transaction has still not been mined and there's no nonce issues preventing it from being propagated, Alchemy will attempt to broadcast the next highest transaction in a recursive manner. We'd love to understand what other gas escalation patterns you'd like to see! Feel free to drop us a line and share feedback!
How can I see progress for my transaction bundle?
Alchemy also gives developers the ability to understand how a transaction bundle is progressing by using the alchemy_getGasOptimizedTransactionStatus endpoint, allowing builders to gain visibility into the entire lifecycle of a transaction from inception to on-chain confirmation.