Crypto (ERC-20)
Welcome to the documentation of the ERC-20 or crypto currencies as it is known worldwide! If you are not so familiar with the smart contract develop, or how you can interact with ERC-20 contract methods Vottun offer this specific interface to make easier this task. With this API, you can easily deploy ERC20 contracts, transfer and allow others to transfer tokens on your behalf, and retrieve all useful information about tokens (name, symbol, total supply, decimals, etc). Let's get started!
Endpoints​
Deploy​
This endpoint deploys an ERC-20 smart contract and mints the amount of tokens that you want to be created. The call that must be performed is:
POST https://api.vottun.tech/erc/v1/erc20/deploy
Request
The request must include a json body with the following fields:
name | type | required | description | example |
---|---|---|---|---|
name | string | yes | This field represents the name of the token. | VottunToken |
symbol | string | yes | This field represents the symbol the token. It is a shorter abbreviation used to identify the token in a more concise manner. | TKN |
alias | string | yes | This field represents an alias or a user-friendly nickname for the token. It's often used for display purposes and can provide additional information about the token. | my first token |
initualSupply | int | yes | This field represents the initial supply of the token. | 1000000000000000000000000000 |
network | int | yes | The chain id | 43113 |
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 |
Example
{
"name": "VottunToken",
"symbol": "TKN",
"alias": "my first token",
"initialSupply": 1000000000000000000000000000,
"network": 43113,
"gasLimit": 6000000
}
Response
It will return a json with the following fields:
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 | 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 |
Transfer​
This endpoint transfers amount
tokens to the given address. The operation is performed in the given contract and network and the sender of the application must be the owner of the tokens.
The call that must be performed is:
POST https://api.vottun.tech/erc/v1/erc20/transfer
Request
The request must include a json body with the following fields:
name | type | required | description | example |
---|---|---|---|---|
contractAddress | string | yes | This field represents represent the address of the contract. | 0x9b7127AfAE2cF200...65c5b03Ac9d291d9a90Dc |
recipient | string | yes | This field is the account where the tokens are going to be sent. | 0xfE463ce3BFda970...C15547D0425D1332A8994a |
network | int | yes | The chain id | 43113 |
amount | int | yes | The amount of tokens you want to transfer | 100 |
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 |
Example
{
"contractAddress": "0x9b7127AfAE2cF200...65c5b03Ac9d291d9a90Dc",
"recipient": "0xfE463ce3BFda970...C15547D0425D1332A8994a",
"network": 43113,
"amount": 100,
"gasLimit": 6000000
}
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 accounth | 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 | 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 |
Transfer from​
This endpoint transfers amount
tokens from the sender account to the receiver addresse. The operation is performed in the given contract and network. The main difference with the simple transfer is that the who executes the transaction can be different account than the one who owns the tokens. To be able to perform this transfer must receive before an allowance from the owner of the tokens. The call that must be performed is:
POST https://api.vottun.tech/erc/v1/erc20/transferFrom
Request
The request must include a json body with the following fields:
name | type | required | description | example |
---|---|---|---|---|
contractAddress | string | yes | This field represents represent the address of the contract. | 0x9b7127AfAE2cF200...65c5b03Ac9d291d9a90Dc |
sender | string | yes | This field represents the owner address of the tokens. | 0x9b7127AfAE2cF200...65c5b03Ac9d291d9a90Dc |
recipient | string | yes | This field is the account where the tokens are going to be sent. | 0xfE463ce3BFda970...C15547D0425D1332A8994a |
network | int | yes | The chain id | 43113 |
amount | int | yes | The amount of tokens you want to transfer | 100 |
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 |
With a body like this:
{
"contractAddress": "0x9b7127AfAE2cF200e36...5b03Ac9d291d9a90Dc",
"sender": "0xfE463ce3BFda970f3...5547D0425D1332A8994a",
"recipient": "0xD1Ff54cf0E82eE2A...c809Db3b1232B5496bC58",
"network": 43113,
"amount": 1000000000000,
"gasLimit": 6000000
}
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 accounth | 27 |
Example
{
"txHash": "0xb3ba0828ac232c48b69bb3..63ddfef73b5d6860a82a6",
"nonce": 27
}
Increase Allowance​
This endpoint give the right to manage the addedValue
amount of tokens to the spender
account. After execute this method the spender can transact with the tokens as if they owned them
POST https://api.vottun.tech/erc/v1/erc20/increaseAllowance
Request
The request must include a json body with the following fields:
name | type | required | description | example |
---|---|---|---|---|
contractAddress | string | yes | This field represents represent the address of the contract. | 0x9b7127AfAE2cF200...65c5b03Ac9d291d9a90Dc |
spender | string | yes | This field represents the address that will be able to manage the tokens. | 0x9b7127AfAE2cF200...65c5b03Ac9d291d9a90Dc |
network | int | yes | The chain id | 43113 |
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 |
addedValue | int | yes | The amount of tokens you want to give the right to manage | 100 |
With a body like this:
{
"contractAddress": "0xACF9A9678E3AD977E2c14eE230291004D2e37883",
"spender": "0xfE463ce3BFda970f33C15547D0425D1332A8994a",
"network": 43113,
"gasLimit": 6000000,
"addedValue": 1000000000000
}
Response
The increaseAllowance 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
}
Decrease Allowance​
This endpoint remove the right to manage the subtractedValue
amount of tokens to the spender
account. After execute this method the spender wont be able to make operation with the tokens at it was before.
POST https://api.vottun.tech/erc/v1/erc20/decreaseAllowance
Request
The request must include a json body with the following fields:
name | type | required | description | example |
---|---|---|---|---|
contractAddress | string | yes | This field represents represent the address of the contract. | 0x9b7127AfAE2cF200...65c5b03Ac9d291d9a90Dc |
spender | string | yes | This field represents the address that will be able to manage the tokens. | 0x9b7127AfAE2cF200...65c5b03Ac9d291d9a90Dc |
network | int | yes | The chain id | 43113 |
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 |
substractedValue | int | yes | The amount of tokens you want to remove the right to manage | 100 |
With a body like this:
{
"contractAddress": "0xACF9A9678E3AD977E2c14eE230291004D2e37883",
"spender": "0xfE463ce3BFda970f33C15547D0425D1332A8994a",
"network": 43113,
"gasLimit": 6000000,
"subtractedValue": 500000000
}
Response
The decreaseAllowance 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
}
Allowance​
This endpoint retrieves the total number of tokens that the owner has authorized the spender to transact.
GET|POST https://api.vottun.tech/erc/v1/erc20/allowance
Request
name | type | description | example |
---|---|---|---|
contractAddress | string | The contract address | 0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc |
network | int | the network id | 80001 |
owner | string | The account who owns the tokens | 0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc |
spender | string | The address who have right to manage a number of tokens the owner owns | 0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc |
Example
With a body like this:
{
"contractAddress": "0xACF9A9678E3AD977E2c14eE23...1004D2e37883",
"network": 43113,
"owner": "0x484d9b37697a94c6f...510855f438ea19be7e9",
"spender": "0xbd3aea19720b31d30d...17e998f8451f52b347c"
}
Response
The response will return a json object with the amount of tokens that the owner allow to manage to the spender
Example
{
"allowance": 998500000000
}
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 |
Name​
This endpoint retrieves the name of a smart contract. The call that must be performed is:
GET|POST https://api.vottun.tech/erc/v1/erc20/name
Request
name | type | description | example |
---|---|---|---|
contractAddress | string | The contract address | 0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc |
network | int | the network id | 80001 |
Example
With a body like this:
{
"contractAddress": "0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc",
"network": 80001
}
Response
The response will return a json object with the name of the contract
Example
{
"name": "VTN ERC20 EXAMPLE"
}
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 |
Symbol​
This endpoint retrieves the symbol of a smart contract. The call that must be performed is:
GET|POST https://api.vottun.tech/erc/v1/erc20/symbol
Request
name | type | description | example |
---|---|---|---|
contractAddress | string | The contract address | 0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc |
network | int | the network id | 80001 |
Example
With a body like this:
{
"contractAddress": "0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc",
"network": 80001
}
Response
The response will return a json object with the name of the contract
Example
{
"symbol": "VTN"
}
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 |
Total supply​
This endpoint retrieves the total supply of tokens that have been created in an ERC20 smart contract. The call that must be performed is:
GET|POST https://api.vottun.tech/erc/v1/erc20/totalSupply
Request
name | type | description | example |
---|---|---|---|
contractAddress | string | The contract address | 0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc |
network | int | the network id | 80001 |
Example
With a body like this:
{
"contractAddress": "0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc",
"network": 80001
}
Response
The response will return a json object with the total supply of the contract
Example
{
"totalSupply": 1e+27
}
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 |
Decimals​
This endpoint retrieves the decimals used for the tokens of an ERC20 smart contract. The call that must be performed is:
GET|POST https://api.vottun.tech/erc/v1/erc20/decimals
Request
name | type | description | example |
---|---|---|---|
contractAddress | string | The contract address | 0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc |
network | int | the network id | 80001 |
Example
With a body like this:
{
"contractAddress": "0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc",
"network": 80001
}
Response
The response will return a json object with the number of decimals that the contract manages
Example
{
"decimals": 18
}
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​
This endpoint retrieves the balance of tokens that an address holds. The call that must be performed is:
GET|POST https://api.vottun.tech/erc/v1/erc20/balanceOf
Request
name | type | description | example |
---|---|---|---|
contractAddress | string | The contract address | 0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc |
network | int | the network id | 80001 |
address | string | The account where we want to check the token balance | 0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc |
With a body like this:
{
"contractAddress": "0x9b7127AfAE2cF200e3665c5b03Ac9d291d9a90Dc",
"network": 43113,
"address": "0xfE463ce3BFda970f33C15547D0425D1332A8994a"
}
Response
The response will return a json object with the balance of the address we sent
Example
{
"balance": 9
}
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 |