Author

Topic: monitoring incoming txId (Read 1324 times)

sr. member
Activity: 412
Merit: 287
July 25, 2015, 08:12:40 AM
#10
nuno12345: init1 is working on multisig, and won't have the keys in his wallet.
sr. member
Activity: 276
Merit: 284
July 23, 2015, 10:27:55 AM
#9
From my understanding you want to monitor incoming, your own wallet/addresses, transactions right?

There are a couple of way of doing this, assuming you can run a full server (bitcoin, php, sql)

The first is using wallet_notify in bitcoin.conf.

Code:
walletnotify=wget "http://yourdomain/newTX.php?coin=bitcoin&tx=%s"

You can also call a script or any command actually, %s holds the tx received.

You may want to see who is the sender of that tx, you can do it with the following:

newTX.php
Code:
        include "jsonRPCClient.php";
        
$rpc = new jsonRPCClient("http://bitcoinrpc:[email protected]:24000/");

        
$tx $_GET["tx"];
$txidJson $rpc->gettransaction($txtrue);

if(isset($txidJson))
{
$address $txidJson["details"][0]["address"];
$type $txidJson["details"][0]["category"];
$amount $txidJson["details"][0]["amount"];

echo $address ":" $type;

                
//add to sql or anything else
        
}
?>


If you know when you are supposed to get a new transaction and know the address where the client is going to pay you can:
1-At sql make confirms field default=-1
2-When a tx is about to happen set confirms=0
3-Run a cron to loop thru every confirms>=04-With the above use RPC and do getbalance on the address
5-If balance is greater or less than balance field at SQL update balance field and confirms++
6-If needed keep increasing it until you achieve the minConfirms

I think you can also use blockchain which allows something like push notifications when a transaction happens.

Hope this helps
hero member
Activity: 518
Merit: 502
July 20, 2015, 11:02:49 AM
#8
Bitcoind with the addrindex patch is very close to what you want - just to look up txids on addresses. Some of the other chain explorers build their own database as well as bitcoind, so keeping it to bitcoind would be better.

Insight isn't bad - it syncs against bitcoind, and exposes an API to look up addresses.

Insight is awefuly slow - so slow, that it's barely usable. Haven't tested it's successor bitcore-node yet.

As an alternative, btcd has support for a full address index out of the box. I have made quite good experiences with btcd, and it allows you to connect to it via websocket which can be quite convenient as well.
sr. member
Activity: 412
Merit: 287
July 19, 2015, 11:01:04 AM
#7
Bitcoind with the addrindex patch is very close to what you want - just to look up txids on addresses. Some of the other chain explorers build their own database as well as bitcoind, so keeping it to bitcoind would be better.

Insight isn't bad - it syncs against bitcoind, and exposes an API to look up addresses.
jr. member
Activity: 43
Merit: 7
July 19, 2015, 10:48:40 AM
#6
There are a few ways, but they differ greatly in the amount of effort required.

You could use an API - blocktrail at least supports webhooks so you can receive notifications on any payments. It lets you specify the number of confirmations, which is neat.

Otherwise you could use stratum, like the electrum client. There are public stratum servers you can query for transactions on an address, and even set up subscriptions (like blocktrail, but using a public resource).

You could actually look into using https://github.com/btcdrak/bitcoin/tree/addrindex - with the -addrindex flag it lets you look up transactions on any address at all (its bitcoin core patched with a few additional RPC commands).

You could write this purely using bitcoind. blocknotify, and parse every tx in every block.. Look for an output script that belongs to an address you are awaiting payment on. It's not ideal, since you need to be able to handle reorgs (reshuffling the blockchain, and possibly invalidating your transaction temporarily, and potentially changing the txid...which means your reorg handling needs to be excellent, to avoid what appears to be double payments).

(PS, oops, only saw your post in the other thread)

Thank you for advices. How about some local block chain explorers with RCP. Do you know some ?
jr. member
Activity: 43
Merit: 7
July 19, 2015, 10:40:33 AM
#5
What do you mean by monitoring? Do you want a command that checks to see if there are any new transactions for a bitcoin address? If so, there isn't.

I mean, get all txId for the incoming transaction, like https://www.blocktrail.com/tBTC/address/2NEV6KKpFiWb3HKb75TqEupePDXaznTqGaC/transactions
also can I get balance by address ?
sr. member
Activity: 412
Merit: 287
July 18, 2015, 07:59:10 PM
#4
There are a few ways, but they differ greatly in the amount of effort required.

You could use an API - blocktrail at least supports webhooks so you can receive notifications on any payments. It lets you specify the number of confirmations, which is neat.

Otherwise you could use stratum, like the electrum client. There are public stratum servers you can query for transactions on an address, and even set up subscriptions (like blocktrail, but using a public resource).

You could actually look into using https://github.com/btcdrak/bitcoin/tree/addrindex - with the -addrindex flag it lets you look up transactions on any address at all (its bitcoin core patched with a few additional RPC commands).

You could write this purely using bitcoind. blocknotify, and parse every tx in every block.. Look for an output script that belongs to an address you are awaiting payment on. It's not ideal, since you need to be able to handle reorgs (reshuffling the blockchain, and possibly invalidating your transaction temporarily, and potentially changing the txid...which means your reorg handling needs to be excellent, to avoid what appears to be double payments).

(PS, oops, only saw your post in the other thread)
member
Activity: 108
Merit: 10
July 18, 2015, 01:09:37 PM
#3
Hello!

Can I monitoring incoming  txId by bitcoind ?

like https://www.blocktrail.com/tBTC/address/2NEV6KKpFiWb3HKb75TqEupePDXaznTqGaC/transactions

For example

Quote
1) createmultisig 2
2) addmultisigaddress 2
3) monitoringincommingTX id and get List:
49c585907b71d849aec3fbfbc105bb398b8bd320d885f1a6f32bd065056e86d5
9d523eedf1130867f298c8a17d835590387d3e269928ebc7b41b1c206946094d
47f3d689a9acdf29f5c7963bb8272b141d21490b012804de4e468f6e9aa1326d
...

BR !

https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list
listreceivedbyaddress 0 true
staff
Activity: 3458
Merit: 6793
Just writing some code
July 18, 2015, 10:53:49 AM
#2
What do you mean by monitoring? Do you want a command that checks to see if there are any new transactions for a bitcoin address? If so, there isn't.
jr. member
Activity: 43
Merit: 7
July 18, 2015, 10:19:43 AM
#1
Hello!

Can I monitoring incoming  txId by bitcoind ?

like https://www.blocktrail.com/tBTC/address/2NEV6KKpFiWb3HKb75TqEupePDXaznTqGaC/transactions

For example

Quote
1) createmultisig 2
2) addmultisigaddress 2
3) monitoringincommingTX id and get List:
49c585907b71d849aec3fbfbc105bb398b8bd320d885f1a6f32bd065056e86d5
9d523eedf1130867f298c8a17d835590387d3e269928ebc7b41b1c206946094d
47f3d689a9acdf29f5c7963bb8272b141d21490b012804de4e468f6e9aa1326d
...

BR !
Jump to: