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:
name | type | required | description | example |
---|---|---|---|---|
contractSpecsId | int | yes | Contract Specs ID. Is the id of the contract deployed in the Core Platform | 3 |
sender | string | yes | sender address. It will be the contract owner. | 0xA9I99DF..7EB3CD |
blockchainNetwork | int | yes | The chain id | 1 |
params | []any | yes | It 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):
name | type | description | example |
---|---|---|---|
estimatedGas | int | the estimated gas for the transaction | 845034 |
Example
{
"estimatedGas": 845034
}
Http status
result | http status |
---|---|
Gas estimation request was successful | 200 |
Gas estimation failed, see error message | 400 |
The customer is not authorized | 401 |
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:
name | type | required | description | example |
---|---|---|---|---|
contractAddress | string | yes | It is the contract on which the transaction is to be executed. | 0xCC8b33F895F..6a4FfcFfD3C729Fd |
sender | string | yes | sender address. The addres that will send the transaction | 0xfFc2780b3f4C..D04bEc41C60A |
blockchainNetwork | int | yes | The chain id | 1 |
value | int | no | amount of native token to transfer from sender to recipient (denominated in WEI) | 1849367 |
method | string | yes | the 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 | []any | yes | It 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):
name | type | description | example |
---|---|---|---|
estimatedGas | int | the estimated gas for the transaction | 23256 |
Example
{
"estimatedGas": 23256
}
Http status
result | http status |
---|---|
Gas estimation request was successful | 200 |
Gas estimation failed, see error message | 400 |
The customer is not authorized | 401 |
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:
name | type | required | description | example |
---|---|---|---|---|
sender | string | yes | sender address. The addres that transfers the native assets. | 0xfFc2780..D04bEc41C60A |
recipient | string | yes | This field is the account to which the native assets are transferred. | 0xfE463ce3..1332A8994a |
blockchainNetwork | int | yes | The chain id | 1 |
value | int | yes | amount 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):
name | type | description | example |
---|---|---|---|
estimatedGas | int | the estimated gas for the transaction | 23256 |
Example
{
"estimatedGas": 23256
}
Http status
result | http status |
---|---|
Gas estimation request was successful | 200 |
Gas estimation failed, see error message | 400 |
The customer is not authorized | 401 |
There is an error with any of the vottun dependencies or with the customer (in this case contact with Vottun) | 503 |