Web3 core
Abstract​
Thanks to Core API, a developer who is starting his way in blockchain and has already seen some Solidity, can make calls to smart contracts simply by knowing the name of the function and its parameters. Vottun deploys the smart contract to the platform and, from there, allows you to deploy it to any of the supported protocols and interact with it using this simple API Rest.
The API provides the developer with seveall calls, but there are 3 of them to interact with the smart contract in any way:
- Deploy Smart Contract: Allows to deploy a smart contract on the selected blockchain.
- Send Transaction: Makes a call to the smart contract in which there is a change of contract status (mint, transfer...).
- Query Smart Contract Information: Performs a call to the smart contract in which there is no change of state of the smart contract (balanceOf, ownerOf...).
All calls to be made to core api require some knowledge of the smart contract we will be working with. In all the calls we will have a field inside the json called params that must include the parameters required by the function we will call. In the case of deploy, depending on how the constructor has been implemented, these parameters will have to be passed in the same order. In the case of the rest of the functions, in addition, the name of the function as implemented in the smart contract must be passed and, subsequently, the parameters, following the same rules as the deploy.
Endpoints​
Deploy Smart Contract​
Thanks to this endpoint you can deploy a smart contract on the blockchain of your choice. The smart contract must be previously uploaded to the platform as its identifier must be informed in the contractSpecsId
field. Its execution will return the address of the contract and the hash transaction.
The call to be executed is:
POST https://api.vottun.tech/core/v1/evm/contract/deploy
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 |
myReference | string | no | customer reference. It is used to retrieve information about the request if a problem occurs during the request. It is better to use different one for each request but if it is repeated there will not raise any error | REF0008A5F |
sender | string | yes | sender address. It will be the contract owner. | 0xA9I99DF..7EB3CD |
blockchainNetwork | int | yes | The chain id | 1 |
gasLimit | int | no | the maximum amount of work you estimate a validator will do for the transaction. It this field is not set, the platform will estimate the gas in background before sending the transaction. | 4000000 |
useGasEstimation | bool | no | if this field is set to false, the platform will not check gas estimation with the chain. By default is set to true | false |
gasPrice | int | no | the gas price to use in the transaction measured in GWEI. If it is not informed, it is requested to the chain. Required to accelerate a transaction | 25000 |
priorityFee | float | no | The priority fee (tip) measured in GWEI incentivizes validators to include a transaction in the block. | 0.1 |
nonce | int | no | The nonce to use in this transaction. If it is not informed, it is requested to the chain. Required to accelerate a transaction | 47 |
alias | string | no | A name for the smart contract deployed, for your use to recognize easily the contract. If it is not informed, the contract address is used. | NFT Cartoons |
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,
"gasLimit": 4000000,
"alias": "By Core",
"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 |
---|---|---|---|
contractAddress | string | The contract Address | 0x62F0E381Cd7f3e856176abb2b9cB7Eb02856C511 |
txHash | string | The transaction Hash | 0x72f9f35c4fe92b6580..6db6719e903 |
Example
{
"contractAddress": "0x62F0E381Cd7f3e..b2b9cB7Eb02856C511",
"txHash": "0x72f9f35c4fe92b658..c5608c31df06807fc9f5e7243e6db6719e903"
}
Http status
result | http status |
---|---|
The smart contract transaction has been inserted succesfully | 201 |
The request does not include the correct information as per format or content or the gas limit informed is under the one estimated by the blockchain | 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 |
Send Transaction​
This endpoint allows us to call any public function implemented in the smart contract and change its state. As discussed in the abstract, you need to know both the name of the function and its parameters in the right order.
If the smart contract has not been deployed by Vottun platform, then the ABI of the contract must be uploaded to the platform and get the contractSpecsId
identifier to be used instead of the smart contract address.
The call to be executed is:
POST https://api.vottun.tech/core/v1/evm/transact/mutable
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 |
myReference | string | no | customer reference. It is used to retrieve information about the request if a problem occurs during the request. It is better to use different one for each request but if it is repeated there will not raise any error | REF0008A5F |
contractSpecsId | int | no | Contract Specs ID. If the transaction mast be executed on an external smart contract (not deployed by Vottun Platform), you need to inform this field in order to set what ABI must the execution use. | 3 |
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 |
gasLimit | int | no | the maximum amount of work you estimate a validator will do for the transaction | 250000 |
useGasEstimation | bool | no | if this field is set to false, the platform will not check gas estimation with the chain. By default is set to true | false |
gasPrice | int | no | the gas price to use in the transaction measured in GWEI . If it is not informed, it is requested to the chain. Required to accelerate a transaction | 25000 |
priorityFee | float | no | The priority fee (tip) measured in GWEI incentivizes validators to include a transaction in the block. | 0.1 |
nonce | int | no | The nonce to use in this transaction. If it is not informed, it is requested to the chain. Required to accelerate a transaction | 47 |
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": "0xCC8b33F895F..0f0F6a4FfcFfD3C729Fd",
"sender": "0xfFc2780b3f4C..07409427D04bEc41C60A",
"blockchainNetwork": 1,
"gasLimit": 250000,
"method": "transfer",
"params": [
"0x05447f753a75c16..56d18558b81DcF6B78",
100000000000000
]
}
Response
The mutable transaction request will return a json with the following information:
name | type | description | example |
---|---|---|---|
txHash | string | The transaction Hash | 0xb3ba0828ac232..63ddfef73b5d6860a82a6 |
nonce | int | the transaction number from the account | 27 |
Example
{
"txHash": "0xb3ba0828ac232c48b69bb3..63ddfef73b5d6860a82a6",
"nonce": 27
}
Http status
result | http status |
---|---|
The transaction has been inserted succesfully | 201 |
The request does not include the correct information as per format or content or the gas limit informed is under the one estimated by the blockchain | 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 |
Query Smart Contract information​
This endpoint allows us to call any public function implemented in the smart contract aht not changes its state, only view functions. As discussed in the abstract, you need to know both the name of the function and its parameters in the right order.
If the smart contract has not been deployed by Vottun platform, then the ABI of the contract must be uploaded to the platform and get the contractSpecsId
identifier to be used instead of the smart contract address.
The call to be executed is:
GET|POST https://api.vottun.tech/core/v1/evm/transact/view
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 |
contractSpecsId | int | no | Contract Specs ID. If the transaction mast be executed on an external smart contract (not deployed by Vottun Platform), you need to inform this field in order to set what ABI must the execution use. | 3 |
blockchainNetwork | int | yes | The chain id | 1 |
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":"0x0A212363e559D..BA20e5A3Aa0C",
"blockchainNetwork":43113,
"method": "carModelByPlate",
"params": [
"0000AAA"
]
}
Response
The response will return a json with an array with the values that solidity function returns.
Example
In this case, the carModelByPlate, returns an array with only a value that contains the model of the vehicle that has that plate number assigned.
[
"Berlingo"
]
Http status
result | http status |
---|---|
Information request is successful | 200 |
The request does not include the correct information as per format or content | 400 |
The customer is not authorized | 401 |
Get Available Blockchain Networks​
This endpoint allows you to request the available list of blockchain networks (chains). If your plan is the free one, you will receive only the Tesnet Ones
The call to be executed is:
GET https://api.vottun.tech/core/v1/evm/info/chains
Path Params
This request does not require path params
Query Params
this request does not require query params
Response
The call will return one array with mainnet and another array with testnet networks with the following information:
name | type | description | example |
---|---|---|---|
id | int | the id of EVM networks | 1 |
name | string | the name of the network | Polygon Mainnet |
symbol | string | the short name of the native token of the network | ETH |
isMainnet | boolean | a flag for indentificate if the network is mainet or testnet | false |
explorer | string | the url of the site where you can look for all the transactions of the network | https://etherscan.io |
testnetFaucet | string | the url of the site where you can obtain tokens for testing | https://faucet.avax-test.network |
typeId | int | the internal indentificator of the blockchain type | 1 |
typeName | string | the interal name of the nework type | EVM |
Example
{
"mainnetNetworks": [
{
"id": 1,
"name": "Ethereum Mainnet",
"symbol": "ETH",
"isMainnet": true,
"explorer": "https://etherscan.io",
"testnetFaucet": null,
"typeId": 1,
"typeName": "EVM"
}, ...
],
"testnetNetworks": [
{
"id": 43113,
"name": "Avalanche Fuji",
"symbol": "AVAX",
"isMainnet": false,
"explorer": "https://testnet.snowtrace.io/",
"testnetFaucet": "https://faucet.avax-test.network/",
"typeId": 1,
"typeName": "EVM"
}, ...
]
}
Http status
result | http status |
---|---|
Information request is successful | 200 |
The request does not include the correct information as per format or content | 400 |
The customer is not authorized | 401 |
Get Available Contract Specs​
The smart contract of your application is the most important part to consider when developing decentralized solutions. It is where the rules to interact with the network you have selected are written. Some of these contracts are Ethereum standards, such ERC-721 or ERC-1155 for NFTs or ERC-20 for cryptocurrencies. But in the case you are an advanced developer it is possible to develop and deploy your own contract. Currently using the Vottun Blockchain API it is only possible to deploy standard contracts but in the future it will be possible to deploy any type of contract.
This endpoint allows you to request the available list of contract specifications. Those are the available contracts in the platform. With this endpoint you will receive the shared contracts (everyone can use them) and your owned smart contracts (in premium plans uploading your implemented smart contracts)
The call to be executed is:
GET https://api.vottun.tech/core/v1/evm/info/specs
Path Params
This request does not require path params
Query Params
this request does not require query params
Response
The call will return one array all the contract types that the Vottun Blockchain Platform supports:
name | type | description | example |
---|---|---|---|
id | int | The internal id of the contract | 2 |
name | string | The name of the contract | NFT721Audited |
description | string | The contract description | This smart contract goal is to create a... |
owned | boolean | If this flag is ture, then the smart contract belongs to you | false |
shared | boolean | If the contract is shared and can be used by everybody, this flag is set to true | true |
audited | boolean | If the contract is audited this flag is set to true. If the contract is not audited it can pose various risks and potential problems. Use it in mainnet networks at your own risk. | false |
Example
{
[
{
"id": 2,
"name": "Nfv2MetadData",
"description": "",
"owned": false,
"shared": true,
"audited": false
},
{
"id": 4,
"name": "VottunPoapNoWallet",
"description": "",
"owned": false,
"shared": true,
"audited": false
},...
]
}
Http status
result | http status |
---|---|
Information request is successful | 200 |
The request does not include the correct information as per format or content | 400 |
The customer is not authorized | 401 |
Query Address to Know if it is an Smart Contract​
(Added on April 9th, 2024)
This endpoint allows you to interrogate the blockchain for an address and find out if it represents a smart contract.
This call can be used, for example, when we receive a transaction from a transfer but we do not know if it is native or from an ERC20 token. If we execute this call with the address we receive in the "to" we will know if it represents a Smart Contract, which would indicate that it is an ERC20 or not, which would indicate a possible native transfer.
The call to be executed is:
GET https://api.vottun.tech/core/v1/evm/info/address/{address}/iscontract?network=<networkId>
Path Params
name | type | required | description | example |
---|---|---|---|---|
address | string | yes | The address we wish to query. | 0xCC8b33F895F..6a4FfcFfD3C729Fd |
Query Params
name | type | required | description | example |
---|---|---|---|---|
network | int | yes | It identifies the blockchain network where address exists. | 1 |
Response
The call will return the following json object:
name | type | description | example |
---|---|---|---|
isContract | bool | If the answer is true, then the address represents an smart contract | true |
Example
{
"isContract": true
}
Http status
result | http status |
---|---|
Information request is successful | 200 |
The request does not include the correct information as per format or content | 400 |
The customer is not authorized | 401 |
Get Transaction Information​
(Updated on April 9th, 2024)
This endpoint allows to query a transaction information from the blockchain. That means, get all the information about the status of the transaction, the function invoked in the smart contract, the value, the gas as well as other information you can see at the json at response example
The call to be executed is:
GET https://api.vottun.tech/core/v1/evm/info/transaction/{txHash}?network=<networkId>
Path Params
name | type | required | description | example |
---|---|---|---|---|
txHash | string | yes | The transaction Hash | 0x72f9f35c4fe92b6580..6db6719e903 |
Query Params
name | type | required | description | example |
---|---|---|---|---|
network | int | yes | It identifies the blockchain network where the transaction was inserted. | 1 |
contractSpecsId | int | no | Contract Specs ID. Is the id of the contract compatible with the transaction contract. If this field is informed the input data and logs will be decoded if possible | 20 |
Response
The call will return the following json object with the blockchain transaction information.
name | type | description | example |
---|---|---|---|
network | int | The network identifier (chain id) | 1 |
transaction.hash | string | The hash of the transaction | "0xcc4ebabe3c579..d27bea06b4e0" |
transaction.value | int | The value of the transaction | 0 |
transaction.gas | int | The gas limit for the transaction | 250000 |
transaction.gasPrice | int | The gas price for the transaction | 25000000000 |
transaction.gasTipCap | int | The gas tip cap for the transaction | 25000000000 |
transaction.nonce | int | The nonce of the transaction | 65 |
transaction.from | string | The sender's address. | "0xfFc2780b3f4C2b..09427D04bEc41C60A" |
transaction.to | string | The recipient's address. | "0x8936fD0B578fA7..56AbBF2c7AF9F3952" |
transaction.pending | bool | Whether the transaction is pending | false |
transaction.inputData.function | string | The function called in the transaction | "transfer(address recipient, uint256 amount)" |
transaction.inputData.functionId | string | The function ID | "0xa9059cbb" |
transaction.inputData.inputs | []interface | Inputs for the function | ["0xbaacadb05b97a..12ad7ede01", 1000000000000000000] |
receipt.hash | string | The hash of the receipt | "0xcc4ebaf59f4..9bd27be4013a06b4e0" |
receipt.blockHash | string | The block hash of the receipt | "0x840f4910b5e6f..435b79e8cea52382c8" |
receipt.gasPrice | int | The gas price for the transaction | 25000000000 |
receipt.gasUsed | int | The gas used by the transaction | 34441 |
receipt.cumulativeGasUsed | int | The cumulative gas used by the transaction | 34441 |
receipt.tokenId deprecated | int | The token ID | null |
receipt.from deprecated | string | The sender's address | "" |
receipt.to deprecated | string | The recipient's address | "" |
receipt.blockTime | string | The block time of the receipt | "2023-08-31T14:54:51Z" |
receipt.status | int | The status of the transaction | 1 |
receipt.logs new | array | An array of transaction logs | See below |
receipt.logs.address new | string | The receiving party of the transaction (could be an smart contract) | "0x8936fD0B578fA7..56AbBF2c7AF9F3952" |
receipt.logs.name new | string | The event name | "Transfer" |
receipt.logs.topics new | array | An array of log record topics | See below |
receipt.logs.topics.name new | string | The topic name if it can be decoded | "from" |
receipt.logs.topics.value new | string | The topic value in hex encoding | "from" |
receipt.logs.data new | array | An array of log record topics | See below |
receipt.logs.data.name new | string | The data name if it can be decoded | "value" |
receipt.logs.data.value new | string | The data value in hex encoding | "from" |
receipt.errorMessage | string | Error message | "An error was thrown deploying contract. insufficient funds for gas * price + value" |
error | bool | Indicates if there was an error | true |
errorInfo.code | string | Error code | "ERROR_INSUFICIENT_FUNDS" |
errorInfo.message | string | Error message | "Insuficient funds" |
Example
{
"network": 43113,
"transaction": {
"hash": "0xcc4ebaf53ff0be3c579f44..1c8ba39bd27be4015123a06b4e0",
"value": 0,
"gas": 250000,
"gasPrice": 25000000000,
"gasTipCap": 25000000000,
"nonce": 65,
"from": "0xfFc2780b3f4..427D04bEc41C60A",
"to": "0x8936fD0B578f..F2c7AF9F3952",
"pending": false,
"inputData": {
"function": "transfer(address recipient, uint256 amount)",
"functionId": "0xa9059cbb",
"inputs": [
"0xbaacadb05b97a..a0812a05bead7ede01",
1000000000000000000
]
}
},
"receipt": {
"hash": "0xcc4ebaf53ff0be3c579f445..8ba39bd27be4015123a06b4e0",
"blockHash": "0x840f47401cbbea9910b5e6..9193c435b79e89ecea52382c8",
"gasPrice": 25000000000,
"gasUsed": 34441,
"cumulativeGasUsed": 34441,
"tokenId": null,
"from": "",
"to": "",
"blockTime": "2023-08-31T14:54:51Z",
"status": 1,
"errorMessage": ""
},
"error": false,
"errorInfo": {
"code": "",
"message": ""
}
}
Http status
result | http status |
---|---|
Information request is successful | 200 |
The request does not include the correct information as per format or content | 400 |
The customer is not authorized | 401 |
Get Transaction Status​
This endpoint allows to query a transaction status from API platform. Returns information from database in order to check if the transaction has finished or is in other state.
The call to be executed is:
GET https://api.vottun.tech/core/v1/evm/info/transaction/{txHash}/status?network=<networkId>
Path Params
name | type | required | description | example |
---|---|---|---|---|
txHash | string | yes | The transaction Hash | 0x72f9f35c4fe92b6580..6db6719e903 |
Query Params
name | type | required | description | example |
---|---|---|---|---|
network | int | yes | It identifies the blockchain network where the transaction was inserted. | 1 |
Response
The call will return one array all the contract types that the Vottun Blockchain Platform supports:
name | type | description | example |
---|---|---|---|
id | string | The unique identifier | "162194aa-0351-4979-bcf7-a4f98f1eb468" |
txHash | string | The transaction hash | "0x7bc51b04eca..48a9f6b85543c" |
blockchainNetwork | int | The blockchain network identifier | 97 |
status | string | The status of the transaction (inserted, processing, confirmed, error, evmError) | "confirmed" |
error | bool | Indicates if there was an error | null |
creationTimestamp | int | Timestamp of creation (Unix milliseconds) | 1694024542000 |
confirmationTimestamp | int | Timestamp of confirmation (Unix milliseconds) | 1694024565000 |
For status
field these are the possible values:
ìnserted
: The transaction has been inserted in the blockchain but is still pendingprocessing
: Our platform is checking if the transaction has been processed and confirmed. The transaction will remain with this status until it is confirmed.confirmed
: The transaction has been confirmed succesfully.error
: An off-chain error has raised. This should be an error that raises before sending the transaction to the blockchain.evmError
: An on-chain error has raised. The transaction has been sent to the blockchain and an error has raised.
Example
{
"id": "162194aa-0351-4979-bcf7-a4f98f1eb468",
"txHash": "0x7bc51b04eca06b8b8ca..ada60d9809148a9f6b85543c",
"blockchainNetwork": 97,
"status": "confirmed",
"error": null,
"creationTimestamp": 1694024542000,
"confirmationTimestamp": 1694024565000
}
Http status
result | http status |
---|---|
Information request is successful | 200 |
The request does not include the correct information as per format or content | 400 |
The customer is not authorized | 401 |
Get Transaction Status by Reference​
This endpoint allows to query a transaction status from API platform using the customer reference. Returns information from database in order to check if the transaction has finished or is in other state. It is useful if the Deploy Contract or Send Transaction requests end without any response.
The call to be executed is:
GET https://api.vottun.tech/core/v1/evm/info/transaction/reference/{reference}
Path Params
name | type | required | description | example |
---|---|---|---|---|
reference | string | yes | The Customer reference added to Deploy Contract and Send Transaction requests | Any Alphanumeric value of maximum length 128 characters |
Query Params
this request does not require query params
Response
The call will return one a json including the reference and an array of all the transactions that meet the reference. If the reference does not exist, returns the reference with an empty array:
name | type | description | example |
---|---|---|---|
reference | string | The unique reference | "CustRef00001A" |
info | array | An array of Transaction Status meeting the reference | See below |
info.id | string | The unique identifier | "162194aa-0351-4979-bcf7-a4f98f1eb468" |
info.txHash | string | The transaction hash | "0x7bc51b04eca..48a9f6b85543c" |
info.blockchainNetwork | int | The blockchain network identifier | 97 |
info.status | string | The status of the transaction (inserted, processing, confirmed, error, evmError) | "confirmed" |
info.error | bool | Indicates if there was an error | null |
info.creationTimestamp | int | Timestamp of creation (Unix milliseconds) | 1694024542000 |
cinfo.onfirmationTimestamp | int | Timestamp of confirmation (Unix milliseconds) | 1694024565000 |
For info.status
field these are the possible values:
ìnserted
: The transaction has been inserted in the blockchain but is still pendingprocessing
: Our platform is checking if the transaction has been processed and confirmed. The transaction will remain with this status until it is confirmed.confirmed
: The transaction has been confirmed succesfully.error
: An off-chain error has raised. This should be an error that raises before sending the transaction to the blockchain.evmError
: An on-chain error has raised. The transaction has been sent to the blockchain and an error has raised.
Example
{
"reference": "CustRef00001A",
"info": [
{
"id": "481846d9-31a0-48c4-a0ba-753b44a45b59",
"txHash": "0xab0456aec6fe6856bf34091433048bfb3dfebe23ff9791fb7beaed6da82d9f11",
"blockchainNetwork": 43113,
"status": "confirmed",
"error": null,
"creationTimestamp": 1695990398000
},
{
"id": "481846d9-31a0-48c4-a0ba-72cb44a45b59",
"txHash": "0xab0456aec6fe6856ba45091433048bfb3dfebe23ff9791fb7beaed6da82d9f11",
"blockchainNetwork": 43113,
"status": "evmError",
"error": "Insuficient funds",
"creationTimestamp": 1695990395000
}
]
}
Http status
result | http status |
---|---|
Information request is successful | 200 |
The request does not include the correct information as per format or content | 400 |
The customer is not authorized | 401 |
Get Gas Price​
This endpoint allows to you to get the current gas price for the blockchain network. The price is returned in GWEIs (10-9 ETH)
The call to be executed is:
GET https://api.vottun.tech/core/v1/evm/network/gasprice?network=<networkId>
Path Params
This request does not require path params
Query Params
name | type | required | description | example |
---|---|---|---|---|
network | int | yes | It identifies the blockchain for which you want to know the gas price. | 1 |
Example
GET https://api.vottun.tech/core/v1/evm/network/gasprice?network=97
Response
It will return a json with the following fields:
name | type | description | example |
---|---|---|---|
gasPriceGwei | int | the gas price in GWEIs 1,000,000,000 Weis | 90.8 |
Example
{
"gasPriceGwei": 90.8
}
Http status
result | http status |
---|---|
Information request is successful | 200 |
The request does not include the correct information as per format or content | 400 |
The customer is not authorized | 401 |
Balance of Native Crypto​
This endpoint allows you to request the balance of native crypto for a given account. Native crypto is the crypto that we use on each blockchain to pay for the gas from operations.
The call to be executed is:
GET https://api.vottun.tech/core/v1/evm/chain/{account}/balance?network=<networkId>
Path Params
name | type | required | description | example |
---|---|---|---|---|
account | string | yes | It identifies the account to get the balance | 0xA9I99DF..7EB3CD |
Query Params
name | type | required | description | example |
---|---|---|---|---|
network | int | yes | It identifies the blockchain for which you want to know the account balance. | 1 |
Example
GET https://api.vottun.tech/core/v1/evm/chain/0xA9I99DF..7EB3CD/balance?network=43113
Response
It will return a json with the following fields:
name | type | description | example |
---|---|---|---|
balance | int | The native crypto account balance at the given chain | 48.71336216034074 |
Example
{
"balance": 48.71336216034074
}
Http status
result | http status |
---|---|
Information request is successful | 200 |
The request does not include the correct information as per format or content | 400 |
The customer is not authorized | 401 |
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 |