Skip to main content

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:

nametyperequireddescriptionexample
namestringyesThis field represents the name of the token.VottunToken
symbolstringyesThis field represents the symbol the token. It is a shorter abbreviation used to identify the token in a more concise manner.TKN
aliasstringyesThis 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
initualSupplyintyesThis field represents the initial supply of the token.1000000000000000000000000000
networkintyesThe chain id43113
gasLimitintnothe 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 transaction25000

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:

nametypedescriptionexample
contractAddressstringThe contract Address0x62F0E381Cd7f3e856176abb2b9cB7Eb02856C511
txHashstringThe transaction Hash0x72f9f35c4fe92b6580..6db6719e903

Example

{
"contractAddress": "0x62F0E381Cd7f3e..b2b9cB7Eb02856C511",
"txHash": "0x72f9f35c4fe92b658..c5608c31df06807fc9f5e7243e6db6719e903"
}

Http status

resulthttp status
The smart contract transaction has been inserted succesfully201
The request does not include the correct information as per format or content400
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

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:

nametyperequireddescriptionexample
contractAddressstringyesThis field represents represent the address of the contract.0x9b7127AfAE2cF200...65c5b03Ac9d291d9a90Dc
recipientstringyesThis field is the account where the tokens are going to be sent.0xfE463ce3BFda970...C15547D0425D1332A8994a
networkintyesThe chain id43113
amountintyesThe amount of tokens you want to transfer100
gasLimitintnothe gas price to use in the transaction measured in WEI. If it is not informed, it is requested to the chain. Required to accelerate a transaction25000

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:

nametypedescriptionexample
txHashstringThe transaction Hash0xb3ba0828ac232..63ddfef73b5d6860a82a6
nonceintthe transaction number from the accounth27

Example

{
"txHash": "0xb3ba0828ac232c48b69bb3..63ddfef73b5d6860a82a6",
"nonce": 27
}

Http status

resulthttp status
The transaction has been inserted succesfully201
The request does not include the correct information as per format or content400
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

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:

nametyperequireddescriptionexample
contractAddressstringyesThis field represents represent the address of the contract.0x9b7127AfAE2cF200...65c5b03Ac9d291d9a90Dc
senderstringyesThis field represents the owner address of the tokens.0x9b7127AfAE2cF200...65c5b03Ac9d291d9a90Dc
recipientstringyesThis field is the account where the tokens are going to be sent.0xfE463ce3BFda970...C15547D0425D1332A8994a
networkintyesThe chain id43113
amountintyesThe amount of tokens you want to transfer100
gasLimitintnothe 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 transaction25000

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:

nametypedescriptionexample
txHashstringThe transaction Hash0xb3ba0828ac232..63ddfef73b5d6860a82a6
nonceintthe transaction number from the accounth27

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:

nametyperequireddescriptionexample
contractAddressstringyesThis field represents represent the address of the contract.0x9b7127AfAE2cF200...65c5b03Ac9d291d9a90Dc
spenderstringyesThis field represents the address that will be able to manage the tokens.0x9b7127AfAE2cF200...65c5b03Ac9d291d9a90Dc
networkintyesThe chain id43113
gasLimitintnothe 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 transaction25000
addedValueintyesThe amount of tokens you want to give the right to manage100

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:

nametypedescriptionexample
txHashstringThe transaction Hash0xb3ba0828ac232..63ddfef73b5d6860a82a6
nonceintthe transaction number from the account27

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:

nametyperequireddescriptionexample
contractAddressstringyesThis field represents represent the address of the contract.0x9b7127AfAE2cF200...65c5b03Ac9d291d9a90Dc
spenderstringyesThis field represents the address that will be able to manage the tokens.0x9b7127AfAE2cF200...65c5b03Ac9d291d9a90Dc
networkintyesThe chain id43113
gasLimitintnothe 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 transaction25000
substractedValueintyesThe amount of tokens you want to remove the right to manage100

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:

nametypedescriptionexample
txHashstringThe transaction Hash0xb3ba0828ac232..63ddfef73b5d6860a82a6
nonceintthe transaction number from the account27

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 https://api.vottun.tech/erc/v1/erc20/allowance

Request

nametypedescriptionexample
contractAddressstringThe contract address0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc
networkintthe network id80001
ownerstringThe account who owns the tokens0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc
spenderstringThe address who have right to manage a number of tokens the owner owns0x9b7127AfAE2cF20...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

resulthttp status
Information request is successful200
The request does not include the correct information as per format or content400
The customer is not authorized401

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

nametypedescriptionexample
contractAddressstringThe contract address0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc
networkintthe network id80001

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

resulthttp status
Information request is successful200
The request does not include the correct information as per format or content400
The customer is not authorized401

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

nametypedescriptionexample
contractAddressstringThe contract address0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc
networkintthe network id80001

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

resulthttp status
Information request is successful200
The request does not include the correct information as per format or content400
The customer is not authorized401

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

nametypedescriptionexample
contractAddressstringThe contract address0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc
networkintthe network id80001

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

resulthttp status
Information request is successful200
The request does not include the correct information as per format or content400
The customer is not authorized401

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

nametypedescriptionexample
contractAddressstringThe contract address0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc
networkintthe network id80001

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

resulthttp status
Information request is successful200
The request does not include the correct information as per format or content400
The customer is not authorized401

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

nametypedescriptionexample
contractAddressstringThe contract address0x9b7127AfAE2cF20...665c5b03Ac9d291d9a90Dc
networkintthe network id80001
addressstringThe account where we want to check the token balance0x9b7127AfAE2cF20...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

resulthttp status
Information request is successful200
The request does not include the correct information as per format or content400
The customer is not authorized401