Skip to main content

Estimate Gas Endpoints

This list consolidates the endpoints that allow you to make gas estimates for sending transactions, deploy a contract or perform a native crypto transfer on any network.

Estimate gas for smart contract deployment​

Thanks to this endpoint, you can estimate the gas required to deploy a smart contract on the blockchain of your choice. The smart contract must first be uploaded to the platform, as its identifier must be provided in the contractSpecsId field. Its execution will return the address of the contract and the hash transaction. The call to be executed is:

GET|POST https://api.vottun.tech/core/v1/evm/contract/deploy/estimategas

Request

The request must include a json body with the following fields:

nametyperequireddescriptionexample
contractSpecsIdintyesContract Specs ID. Is the id of the contract deployed in the Core Platform3
senderstringyessender address. It will be the contract owner.0xA9I99DF..7EB3CD
blockchainNetworkintyesThe chain id1
params[]anyyesIt is an array with all the parameters required for the smart contract constructor. The order is important["Vottun NFT","VTNFT"]

Example

{
"contractSpecsId":20,
"sender":"0xfFc2780b3f4C..09427D04bEc41C60A",
"blockchainNetwork": 1,
"params": [
"Token Name",
"Symbol",
1000000000000000000000000000,
"0xfFc2780b3f4C..407409427D04bEc41C60A"
]
}

Response

It will return a json with the following fields (the transaction is not still confirmed):

nametypedescriptionexample
estimatedGasintthe estimated gas for the transaction845034

Example

{
"estimatedGas": 845034
}

Http status

resulthttp status
Gas estimation request was successful200
Gas estimation failed, see error message400
The customer is not authorized401
There is an error with any of the vottun dependencies or with the customer (in this case contact with Vottun)503

Estimate gas to send transaction​

This endpoint allows us to estimate the required gas to call any public function implemented in the smart contract that changes its state. As discussed in the abstract, you need to know both the name of the function and its parameters in the right order.

The call to be executed is:

GET|POST https://api.vottun.tech/core/v1/evm/transact/mutable/estimategas

Request

The request must include a json body with the following fields:

nametyperequireddescriptionexample
contractAddressstringyesIt is the contract on which the transaction is to be executed.0xCC8b33F895F..6a4FfcFfD3C729Fd
senderstringyessender address. The addres that will send the transaction0xfFc2780b3f4C..D04bEc41C60A
blockchainNetworkintyesThe chain id1
valueintnoamount of native token to transfer from sender to recipient (denominated in WEI)1849367
methodstringyesthe smart contract function name written as it appears at the ABI file. That means, the name has to be the same that the one in the smart contract code."transfer"
params[]anyyesIt is an array with all the parameters required for the smart contract constructor. The order is important["Vottun NFT","VTNFT"]

Example

{
"contractAddress":"0x79E392dbb...093f01b8f35671677",
"sender":"0xD73bE155a68...09297746A23a08",
"blockchainNetwork":31,
"value": 10000000,
"method": "transfer",
"params": [
"0xBAacAdb05...0812A05BEad7ede01",
100000000000000000000
]
}

Response

It will return a json with the following fields (the transaction is not still confirmed):

nametypedescriptionexample
estimatedGasintthe estimated gas for the transaction23256

Example

{
"estimatedGas": 23256
}

Http status

resulthttp status
Gas estimation request was successful200
Gas estimation failed, see error message400
The customer is not authorized401
There is an error with any of the vottun dependencies or with the customer (in this case contact with Vottun)503

Estimate gas for native crypto transfer​

This endpoint allows you to estimate the required gas to transfer native assets (ETH, MATIC...)

The sending account must have sufficient funds to complete the transfer. If this is not the case, an insufficient funds error will be returned and the transfer will not be estimated.

The call that must be performed is:

GET|POST https://api.vottun.tech/core/v1/evm/chain/transfer/estimategas

Request

The request must include a json body with the following fields:

nametyperequireddescriptionexample
senderstringyessender address. The addres that transfers the native assets.0xfFc2780..D04bEc41C60A
recipientstringyesThis field is the account to which the native assets are transferred.0xfE463ce3..1332A8994a
blockchainNetworkintyesThe chain id1
valueintyesamount of native assets to transfer from sender to recipient (denominated in WEI)1849367

Example

{
"sender": "0xD73bE155a683...E09297746A23a08",
"recipient": "0xBAacAdb05...A05BEad7ede01",
"blockchainNetwork": 31,
"value": 100000
}

Response

It will return a json with the following fields (the transaction is not still confirmed):

nametypedescriptionexample
estimatedGasintthe estimated gas for the transaction23256

Example

{
"estimatedGas": 23256
}

Http status

resulthttp status
Gas estimation request was successful200
Gas estimation failed, see error message400
The customer is not authorized401
There is an error with any of the vottun dependencies or with the customer (in this case contact with Vottun)503