Vechain API Documentation

Vechain Contract API Documentation

This is a living document. Documentation on how to access the Vechain contract API will be updated every time new features come out.

Read Contract without inputs

Explanation

This endpoint can be used to read from an vechain contract, given the ABI. It will return the value(s) from the contract.

Endpoint

https://api.cinder.cloud/api/vechain/contract/read

Example Code

method: POST
{
    "abi": "put_abi_here",
    "address": "0x4df47b4969b2911c966506e3592c41389493953b",
    "method": "name"
}

The endpoint can also be used with inputs.

Endpoint

https://api.cinder.cloud/api/vechain/contract/read

Example Code

method: POST
{
    "abi": "put_abi_here",
    "address": "0x4df47b4969b2911c966506e3592c41389493953b",
    "method": "balanceOf",
    "inputs": ["0xc31Eb6E317054A79bb5E442D686CB9b225670c1D"]
}

Example Response

[
    {
        "value": 49000000000000000000,
        "typeAsString": "uint256"
    }
]

Write to an Vechain Contract

Explanation

This endpoint can be used to prepare your transaction for contract execution. It will return the data you have to provide in your transaction.

Endpoint

https://api.cinder.cloud/api/vechain/contract/execute/prepare

Example Code

method: POST
{
    "abi": "put_abi_here",
    "address": "0x4df47b4969b2911c966506e3592c41389493953b",
    "method": "approve",
    "inputs": ["0xc31Eb6E317054A79bb5E442D686CB9b225670c1D", "1"]
}

Example Response

{
    "data": "0x095ea7b3000000000000000000000000dc71b72db51e227e65a45004ab2798d31e8934c90000000000000000000000000000000000000000000000000000000000000001"
}

Get Balance for Account

Explanation

This endpoint can be used to fetch the balance for a vechain account

Endpoint

https://api.cinder.cloud/api/vechain/address/{address}/balance

Example Code

method: GET
https://api.cinder.cloud/api/vechain/address/0x79dca5229B6883861d37431B2E16F964158a86c4/balance

Example Response

{
    "balance": "69161857294910000000000"
}
2019 © Cindercloud.