Retrieve a balance from the blockchain
Last updated
Last updated
For illustration purposes, we’ll request the wallet balance using the cURL tool information on cURL:
The following code will check the balance of a SWT wallet formatted in Base58 with the given public key “QTRbkssQSGLdKs94khX7i858YcBAhjg6wj48F7FTr8H” used on SWT MainNet.
We are using the “GetBalance” function which is explained here: .
-X POST - type of HTTP request, in this case we use POST. More info here:
-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”: “MainNet” - We specify the network, where the request should be executed. Either TestNet or MainNet.
“PublicKey”: “QTRbkssQSGLdKs94khX7i858YcBAhjg6wj48F7FTr8H” - We specify wallet address (public key) in Base58. More on
"methodApi": "GetBalance"
Let's try it out with the following code !
We get the following response from the REST API in JSON.
Here we see the wallet balance to be 78986512.126207759516370000 SWT which matches the monitor data