Transaction Preview API
Transaction Preview is an extension of our Simulation Platform for on-demand simulations of unsigned transactions against the current block height.

Overview

Transaction Preview lets you preview the outputs of any custom transaction that you submit to it. By harnessing the power of our network of Ethereum nodes, with our existing decoding and transaction lifecycle knowledge, we hope to give users of Transaction Preview even greater comfort when interacting in the Web3 space. Previewing a transaction is particularly useful for:
  • DEXs & Swaps: Report accurate slippage, Accurate tokens received, and accurate failing calls
  • Traders: Preview many iterations of the same trade and execute only the most profitable one
  • AMMs: Tell whether a Borrow / Repay / Claim transaction will go through and its effects
  • Auctions: Tell whether your bid or listing will go through and its accuracy & effects
  • NFTs: Tell whether your NFT mint, purchase, or transfer will go through
& much more without spending a single wei in gas!

How it works

Transaction Preview comes in the form of a REST endpoint, to which you can outline the basics of a transaction, and you will receive a payload detailing the execution of the transaction in the latest block height. We simulate the proposed transaction by executing it via one of our dedicated simulator nodes on the current block height. The returned payload includes:
  1. 1.
    Any EVM execution errors
  2. 2.
    A list of Decoded Internal Transactions
  3. 3.
    A collection of all balance changes of tokens across all involved addresses
  4. 4.
    End to end performance metrics of the simulation

Authentication

Include the header credentials with your apiKey:secretKey. Information on secret keys can be found here and here.

How-to

post
https://api.blocknative.com
/simulate
Simulate an unsigned transaction

Example cURL call

1
curl -X POST 'https://api.blocknative.com/simulate' \
2
-H 'credentials: <API key>:<secret key>' \
3
-H 'Content-Type: application/json' \
4
--data-raw '{
5
"system": "ethereum",
6
"network": "main",
7
"transaction": {
8
"from": "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B",
9
"to": "0x7a250d5630b4cf539739df2c5dacb4c659f2488d",
10
"gas": 400000,
11
"gasPrice": 0,
12
"input": "0xfb3bdb4100000000000000000000000000000000000000000000003635c9adc5dea000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000746dff22206ce4e3da6d7eb4d537398be8f236d600000000000000000000000000000000000000000000000000000000624FD77D0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000094d916873b22c9c1b53695f1c002f78537b9b3b2",
13
"value": 289816785998565039
14
}
15
}'
16
Copied!

JSON Response Fields

Name
Type
Description
internalTransactions
JSON object
A collection of internal transactions made by the activated contract. Supported calls are decoded. If you wish for your contract to be decoded, contact us on Discord.
netBalanceChanges
JSON object
Contains details of all the balance changes resulting from the internal transactions details in the internalTransactions array. The object is an array with an entry for each address involved in the internal transactions.
simDetails
JSON object
This object contains details about the simulation, such as blockHeight at the time of calculation, key action timestamps, and end-to-end latency value, in milliseconds.
contractCall
JSON object
This is the top level contract call decoded. If we do not support decoding for this contract, this field will be null.

Supported Networks

Transaction Preview is currently only supported for Ethereum: Main. Please stay tuned for its availability on other networks supported by Blocknative.

Rate Limits

Usage rate limit for the Transaction Preview API is 100 requests per 60-second window. Transaction Preview consumes the same daily limits on your Blocknative plan as pending simulated transactions in Simulation Platform. You can view your current consumption on your Blocknative Account Page.
Last modified 6d ago