Author

Topic: help on development: json-rpc, blockchain reorganization & transaction types (Read 985 times)

newbie
Activity: 9
Merit: 0
Hi, I am trying to develop a service for bitcoins, but there are some problems.  I use PHP and JSON-RPC and bitcoind.

1. If there is an error in a call to bitcoid/json-rpc, it throws an exception. For example if I try:
$bitcoin->getrawtransaction("abcd");
gives:
Code:
Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to http://xxxx:[email protected]:8332/' in /.../jsonRPCClient.php:140
Stack trace:
#0 check.php(181): jsonRPCClient->__call('getrawtransacti...', Array)
#1 check.php(181): jsonRPCClient->getrawtransaction('abcd', 1)
#2 {main}
  thrown in /.../jsonRPCClient.php on line 140
The same call in the debug window of bitcoin-qt gives:
Code:
No information available about transaction (code -5)
Is it possible to get these errors instead of exceptions?

2. What is a good way to handle blockchain reorganization? If I accept a transaction from user, then the blockchain is reorganized? What info can I get from "bitcoind -blocknotify "cmd""? Does it tell me which blocks are now rejected, or just the hash of the newly accepted block?

3. How can I verify that transactions I receive are "normal" transactions, and reject any "non-normal". I mean, I don't want to accept transaction with locktime, or sequence. I only want normal transaction that I can freely redeem at any time. Is it enough to accept (I mean store in database) only locktime=0 and sequence=2^32-1? Or do I have to check the details of scriptPubKey too?

Thanks.
Jump to: