Bitcoin Forum
November 16, 2024, 05:27:05 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: monitoring incoming txId  (Read 1323 times)
init1 (OP)
Jr. Member
*
Offline Offline

Activity: 43
Merit: 7


View Profile
July 18, 2015, 03:19:43 PM
Merited by ABCbits (1)
 #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 !
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
July 18, 2015, 03:53:49 PM
 #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.

InceptionCoin
Member
**
Offline Offline

Activity: 108
Merit: 10


View Profile
July 18, 2015, 06: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

Skilled C++ and Python programmer. Looking around to create solid longterm coin by myself. Do you have any ideas? Feel free to PM me.
fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 287


View Profile
July 19, 2015, 12:59:10 AM
Merited by ABCbits (3)
 #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)

Bitwasp Developer.
init1 (OP)
Jr. Member
*
Offline Offline

Activity: 43
Merit: 7


View Profile
July 19, 2015, 03:40:33 PM
 #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 ?
init1 (OP)
Jr. Member
*
Offline Offline

Activity: 43
Merit: 7


View Profile
July 19, 2015, 03:48:40 PM
 #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 ?
fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 287


View Profile
July 19, 2015, 04:01:04 PM
 #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.

Bitwasp Developer.
arnuschky
Hero Member
*****
Offline Offline

Activity: 518
Merit: 502


View Profile
July 20, 2015, 04:02:49 PM
 #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.
nuno12345
Sr. Member
****
Offline Offline

Activity: 276
Merit: 284


View Profile
July 23, 2015, 03:27:55 PM
 #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:
<?php
        
include "jsonRPCClient.php";
        
$rpc = new jsonRPCClient("http://bitcoinrpc:rpcpass@127.0.0.1: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>=0<minConfirms
4-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
fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 287


View Profile
July 25, 2015, 01:12:40 PM
 #10

nuno12345: init1 is working on multisig, and won't have the keys in his wallet.

Bitwasp Developer.
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!