Sending a transaction on Ethereum is not exactly like doing an
INSERT statement in an RDBMS — things can fail in multiple ways, and often minutes later, when you’re not watching any more. You get certainty only when your transaction is mined; and with potential forks, you better be ready to revise what you thought was true.
On the flip side, INSERT statements do not always transfer valuable assets and data, which is the case on Ethereum.
For those reasons, it’s often useful to know how an Ethereum transaction will behave, even before submitting it to the network.
Today, we’re excited to announce our first beta of dfuse Speculative Execution for Ethereum.
If any of the following apply to you, you’ll want to take a closer look:
- You use
eth_estimateGas, or other estimation services to predict the gas cost of a transaction. If you are trying to optimize your calls, this will give you precise sub-call consumption as well.
- You interact with contracts and you care about the ERC-20 transfers they could produce.
- You’re building a user interface or a wallet, and your users would be really happy to be notified of incoming transfers before they are mined.
- You run trading operations and you’d like to know the potential effect of a transaction before it’s even submitted to the chain.
- Would you really sign that transaction if you knew you already lost that arbitrage opportunity?
dfuse Speculative Execution for Ethereum is a new GraphQL endpoint, to which you can submit an unsigned transaction payload and get back:
- A granular view of the gas estimate, with cumulative gas per call tree, including a final count.
- A full tree of the calls, with inputs, return values, failed calls and log events.
- State changes, as well as Keccak hashes leading up to those changes.
- Only the data you need, using GraphQL.
From there, you can see exactly what would happen with your transaction, whether you would win or lose, whether it would fail, all swaps, transfers, liquidations and their amounts. All of it in real-time, and in the wild. That is the GPS you need if you are to enter the proverbial Dark Forest of Ethereum.
Eager to try it? Check out our pre-filled example and simply change the defined variables.
Need further details or assistance? Let’s jump on a quick chat!
We’ve surely missed some ways you will use this new API. Join our Telegram channel and let us know about the biggest challenges you solved (or still face) with Ethereum APIs today.