Tezos RPC
Archive Method
Only on the full archive nodes. Complex queries might take longer and incur additional cost
How to use it
// Import required libraries and modules from Tatum SDK
import { TatumSDK, Tezos, Network } from '@tatumio/tatum'
// Initialize the Tatum SDK for Tezos
const tatum = await TatumSDK.init<Tezos>({ network: Network.TEZOS })
// Define the operation parameters
const operationParams = {
blocks_before_activation: 1,
operation: {
// ... (operation details)
},
chain_id: 'YOUR_CHAIN_ID',
latency: 0,
}
// Simulate the Tezos operation
const simulatedResult = await tatum.rpc.simulateOperation(operationParams)
// Log the simulated operation result
console.log(`Simulated Operation Result:`, simulatedResult)
// Always destroy the Tatum SDK instance when done to stop any background processes
await tatum.destroy()
Overview
The simulateOperation
method allows you to simulate a Tezos operation, such as a smart contract call or transaction, without actually broadcasting it to the blockchain. This is useful for testing and verifying the outcome of an operation before committing it to the network.
Request Parameters
The simulateOperation
method requires the following parameters in the request body:
-
blocks_before_activation
(integer, optional): An integer representing the number of blocks before the operation's activation. It should fall within the range from -2147483648 to 2147483647. -
operation
(object, required): The operation object to simulate. This typically includes details such as the contract method call, parameters, and gas limits. -
chain_id
(string, required): The network identifier (Base58Check-encoded) that specifies the Tezos network to use for the simulation. -
latency
(integer, optional): An integer representing the latency of the operation simulation. It should fall within the range from -32768 to 32767.
Response Parameters
The method returns an object representing the result of simulating the Tezos operation. The exact structure of this object may vary based on the operation being simulated, but it typically includes the following:
Operation_with_metadata (object):
-
contents
(array): An array of operation contents. -
signature
(string): A signature, which can be Ed25519, Secp256k1, P256, or BLS (Base58Check-encoded).
Operation_without_metadata (object):
-
contents
(array): An array of operation contents. -
signature
(string): A signature, which can be Ed25519, Secp256k1, P256, or BLS (Base58Check-encoded).
Users can use the simulated result to validate the operation's behavior and make informed decisions before proceeding with the actual operation on the Tezos blockchain.
(Note: The exact fields in the return object might vary based on the Tezos blockchain's implementation and version.)