Author

Topic: PHP Only Partially Reading Bitcoind (Read 774 times)

full member
Activity: 178
Merit: 100
April 09, 2014, 06:58:23 PM
#8
Thanks everyone. It was all helpful and am getting to understand it a little better now. Yes, the issue was that the blockchain hadn't finished loading yet. The next morning the transaction and balance were correct.

Gosh the documentation is sporadic. Maybe I'll attempt writing a how-to when I'm done (I've gotten enough practice :-)
sr. member
Activity: 336
Merit: 254
CEO of Privex Inc. (www.privex.io)
April 09, 2014, 06:03:05 PM
#7
As a general rule before you start messing around with custom applications just try executing the command from the command line
bitcoind
if you get nothing there then it isn't a PHP issue it means the bitcoind is broken or behind.

bitcoind getinfo

should give you some basic info like connections to the network and blockheight.
This ^^

Bitcoin and other coin daemons are VERY SLOW and can return odd results when they're behind on blocks. If you notice long load-times, that's one of the reasons most likely.
donator
Activity: 1218
Merit: 1079
Gerald Davis
April 08, 2014, 09:06:50 PM
#6
As a general rule before you start messing around with custom applications just try executing the command from the command line
bitcoind
if you get nothing there then it isn't a PHP issue it means the bitcoind is broken or behind.

bitcoind getinfo

should give you some basic info like connections to the network and blockheight.
legendary
Activity: 1498
Merit: 1000
April 08, 2014, 08:52:57 PM
#5
Code:
tail -f ~/.bitcoin/debug.log

That is going to be your friend in SSH. It will tell you what block and the progress of completion.
sr. member
Activity: 412
Merit: 287
April 08, 2014, 08:49:39 PM
#4
It was probably still reindexing when you ran this. You can check the progress of the reindex by doing bitcoind getinfo and checking the current height.
full member
Activity: 178
Merit: 100
April 08, 2014, 10:40:59 AM
#3
Hi,

Thanks for the reply and the help.

I haven't quite figured out what is all available from the command line. I can't tell when it has completed updating after I start bitcoind from the command line so what I do is I'll start the Bitcoin client from the GUI and let it update the blockchain. So I would guess that the blockchain is up to date because I updated for sure with the GUI client, then I shut it down and started bitcoind from the cl. Also I noticed that when I open the Bitcoin QT GUI it reports it is "rescanning". That seems odd to me. Is that an indication something is wrong and the two aren't compatible?

Also, it did see the transaction at the cl once, then the report disappeared. I also tried every command to find it recorded as a balance and it only reported a zero balance. It is only a small token test amount so that loss is not important. I'm trying to figure it all out and what I am doing wrong.

Here is what I have found out so far ...

At the CL I found I have two wallets in the account. The account's name is "TEST" and I didn't create it that I know of. I would assume it is somewhere created in that script or does bitcoind create TEST at install?

Of those two wallets I know I created one of them with the Gui client. That is the one I sent the transaction to and the GUI is reporting the correct balance.

So either I am misunderstanding the relationship between bitcoind and bitcoin qt (I thought they use the same accounts, wallets etc) or something is wrong with the scripts. Another possibility is that I'm entering the wrong commands on the CL but I've tried everything, I believe, and am using commands from what I think are reliable and up to date sources.


EDIT: I just had severe problem loading QT. It crashed 3 times without being able to load the wallet. I renamed the wallet.bak file and it is now loaded and updating. Am I messing it up going back and forth between QT and the Bitcoind CL?



newbie
Activity: 50
Merit: 0
April 08, 2014, 09:55:32 AM
#2
Is the blockchain on bitcoind up-to-date? i.e. on getinfo does it show the same number of blocks as blockchain.info .. a confirm is a block so if it hasn't caught up to all blocks then it wont show the confirms.
full member
Activity: 178
Merit: 100
April 07, 2014, 08:12:33 PM
#1
I've got two different PHP scripts (listed below) accessing Bitcoind via jsonRPC and neither one is working properly. And the command line reports are acting weird too.

I have both Bitcoind and Bitcoin-QT installed. I made a spend to one of its wallets and at Blockchain it reported 37 confirmations. I got the transaction id from the cl using bitcoind listtransactions but it reported NO confirmations there. Then, when I repeated the command a couple minutes later from the cl there was no longer any mention of the transaction.

The two php scripts never have shown the transaction at all.

One simple script -
 
Code:
require_once 'jsonRPCClient.php';
 
  $bitcoin = new jsonRPCClient('http://user:[email protected]:8332/');
 
  echo "
\n";
  print_r($bitcoin->getinfo()); echo "\n";
  echo "Received: ".$bitcoin->getreceivedbylabel("Your Address")."\n";
  echo "
";

While the second is a more elaborate class from http://www.phpclasses.org/package/6739-PHP-Manage-Bitcoin-virtual-currency-accounts.html. I've tried from both the test_bitcoin.php page and the test_bitcoin_rpc.php page. Apart from not reporting the proper balance everything appears ok in them.

So, in summary, the php pages don't report the proper balance (the script doesn't report confirmations) and the command line reports the proper balance but not the correct confirmations and then disappears altogether.  

Any help will be greatly appreciated.
Jump to: