Search code examples
phpbitcoinbitcoind

How to use Bitcoind's getreceivedbyaddress function


I have the Bitcoin Core version v0.9.0.0-g92d25e4-beta (64-bit) software installed on my computer and the config file is also setted up, and Bitcoind running in background. I have a small PHP script(run over localhost), this script communicate with bitcoind via RPCClient json. I created 2 request payment in my Bitcoin Core wallet and i sent the money to generated address from my blockchain BTC wallet, the money was sent successfully and it has 3 confirmations too.

Now, i would like to check the transactions status in php with Bitcoind's Getreveivedbyaddress('generated address here') function.I would like to now when the money is received. I tried to call many times that function but it return always 0.(destination addresses are internal adresses becouse it were generated via BitCoin Core )

  print $bitcoind->getreceivedbyaddress('13hHHBcaccPM5XSSiihhbrzRChbyvP49QQ');

I am sorry for my English;


Solution

  • Try running the command in the console.

    bitcoind getreceivedbyaddress bitcoinaddresshere
    

    And see what is returned.

    ========

    Have you initialised your connection with bitcoind in PHP?

    ========

    Have you setup your bitcoin.conf file to allow RPC connections?

    server=0
    
    rpcuser=user
    
    rpcpassword=password