6

When i run the curl command:

curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"getbalance"}' -H 'Content-Type: application/json'

It gives me a balance like so:

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "balance": 140000000000,
    "unlocked_balance": 50000000000
  }
}

It's just one big integer, how do i convert it into the real balance?

It impossible to just add a decimal place because i don't what the actual balance is.

HashTables
  • 456
  • 1
  • 4
  • 11

3 Answers3

5

The "human friendly" amounts have a decimal place at 12 digits, so in this case, 140000000000 atomic units would be 0.140000000000 monero.

user36303
  • 34,858
  • 2
  • 57
  • 123
1

To simplify user36303's answer, divide the reported amount by 1,000,000,000,000 (one trillion).

Quentin Skousen
  • 911
  • 5
  • 19
0

The amount is given in piconero. From Moneropedia:

Atomic Units refer to the smallest fraction of 1 XMR. One atomic unit is currently 1e-12 XMR (0.000000000001 XMR, or one piconero). It may be changed in the future.

alexg
  • 207
  • 1
  • 2
  • 6