CURL and bitcoin-cli return different balances #13629

issue LaThortilla opened this issue on July 11, 2018
  1. LaThortilla commented at 2:42 AM on July 11, 2018: none

    I'm using bitcoin 0.16.1 on a centos7 server

    I'm trying to get the balance using rpc

    The bitcoin.conf file is as follows:

    testnet=1
    maxconnections=20
    server=1
    rest=1
    rpcauth=btxxxxxxxo:xxxxxxxxxxx
    rpcport=8332
    keypool=150
    prune=0
    

    The problem arises when I want to check the balance of an address with curl.

    curl -v -u bxxxxxo:TBcxxxxxxxxs --data-binary '{"jsonrpc": "2.0", "method":"getbalance","params":["2N1vKxxxxxxxxxasdasdasdasdgG"],"id":3}' -H 'content-type: text/plain;' http://192.168.100.25:8332/```
    
    result:
    
    • About to connect() to 192.168.100.25 port 8332 (#0)
    • Trying 192.168.100.25...
    • Connected to 192.168.100.25 (192.168.100.25) port 8332 (#0)
    • Server auth using Basic with user 'btxxxxxxdo'

    POST / HTTP/1.1 Authorization: Basic YnRjbxxxxxxxxxxGRKxxxxxQ== User-Agent: curl/7.29.0 Host: 192.168.100.25:8332 Accept: / content-type: text/plain; Content-Length: 105

    • upload completely sent off: 105 out of 105 bytes < HTTP/1.1 200 OK < Content-Type: application/json < Date: Wed, 11 Jul 2018 02:41:38 GMT < Content-Length: 42 < {"result":0.00000000,"error":null,"id":3}
    • Connection #0 to host 192.168.100.25 left intact
    but if I consult the same bitcoin address with bitcoin-cli I get the real balance of the account.
    
    what am I doing wrong?
    why do I get zero balance with rpc and with cli everything works fine?
    
  2. achow101 commented at 5:37 AM on July 11, 2018: member

    First of all, getbalance does not give you the balance of an address.

    What exactly is the bitcoin-cli command that you are using?

  3. LaThortilla closed this on Jul 11, 2018

  4. bitcoin locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:55 UTC