Retrieve a balance from the blockchain.
Introduction
For illustration purposes, we’ll request the wallet balance using the cURL tool information on cURL: Wikipedia
The following code will check the balance of a Credits wallet formatted in Base58 with the given public key “7CAbMzgimfoHTQy32bJhB3wCx1j3XfZp5TARGMcgp4Fe” used on Credits TestNet.
We are using the “GetBalance” function which is explained here: Getbalance.
Description of cURL parameters
-X POST - type of HTTP request, in this case we use POST. More info here: Wikipedia
-H “accept: application/json”
-H “Content-Type: application/json” - Specification for the transferred parameters and response to be in JSON format
-d {parameters} - With this key, we specify the data transferred with the request. Let’s look at them in more detail:
“authKey”: “” - Authorization key. Not used at present, should be passed “”
“networkAlias”: “TestNet” - We specify the network, where the request should be executed. Either TestNet or MainNet.
“PublicKey”: “7CAbMzgimfoHTQy32bJhB3wCx1j3XfZp5TARGMcgp4Fe” - We specify wallet address (public key) in Base58. More on Base58
"methodApi": "GetBalance"
For CMD to overlook quotation marks “ inside the request body since those are special characters, they should be escaped with the backward slash .
Code
Let's try it out with the following code !
curl -X POST "http://apinode.credits.com/api/Monitor/GetBalance" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"authKey\":\"\",\"networkAlias\":\"TestNet\", \"PublicKey\":\"7CAbMzgimfoHTQy32bJhB3wCx1j3XfZp5TARGMcgp4Fe\",\"methodApi\":\"GetBalance\"}"
Response
We get the following response from the REST API in JSON.
{
"balance":1075.195149659138000000,
"tokens":[
{
"publicKey":"5JfW5CKDLLVg4TKxLqxfDVkr5YpWq7NaUiDk84MSgyHe",
"name":"TESTCOIN",
"alias":"TC",
"amount":17
},
{
"publicKey":"DYEqBVuaW8Bvj7wUZtZSRPyxoFwsoyQK6zdqdAPGLJty",
"name":"TikTak",
"alias":"TT",
"amount":1200
},
{
"publicKey":"GNvi5JrXCj6ifXGeH5s4z6Ep82n4ZsEDSwmnNWj6fWFf",
"name":"Hooli nada token",
"alias":"HULI",
"amount":3256
}
],
"delegatedOut":0,
"delegatedIn":0,
"success":true,
"message":null
}
In this example, we executed the simplest REST request to the Credits blockchain without any specialized development environment or additional tools.
Here we see the wallet balance to be 1075.195149659138000000 CS which matches the monitor data

Great job ! Now you found out how easy it was to interact with the Credits blockchain.