Bitcoin Forum
December 12, 2024, 03:32:56 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: help on development: json-rpc, blockchain reorganization & transaction types  (Read 997 times)
cloudytoday (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
November 14, 2012, 03:54:08 PM
 #1

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:xxxx@127.0.0.1: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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!