Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: danystatic on September 24, 2013, 08:49:07 PM



Title: How to Verify and Validate Bitcoin Transactions of Other Users ??
Post by: danystatic on September 24, 2013, 08:49:07 PM
Pedro sends from [Pedro's Btc Address] X amount of Bitcoins to Carmen with [Y Btc Address]
 

Carmen says she did not received the Bitcoins.

I can review Pedro's and Carmen Addresses in Blockexplorer.com

Is there an API or  an API Call  from bitcoin so that I can verify this information without blockexplorer.com ??


Title: Re: How to Verify and Validate Bitcoin Transactions of Other Users ??
Post by: DannyHamilton on September 25, 2013, 06:41:06 PM
Code:
getrawtransaction

and

Code:
decoderawtransaction

come to mind.


Title: Re: How to Verify and Validate Bitcoin Transactions of Other Users ??
Post by: dudeami on September 26, 2013, 03:18:43 AM
As Danny said, getrawtransaction and decoderawtransaction is the easiest way to go.

If you checking transactions not related to your wallet, you need to enable the transaction index. Bitcoin uses another method since some version (forget which), due to the tx index being more resource intensive.

To do this, just add:

Code:
txindex=1

to your config, shut down bitcoin-qt or bitcoind (if already up), and run

Code:
bitcoind -reindex

This will take some time, as it has to go through all 10GB of data to make the tx index. In a production environment this can be seen as unacceptable, but easy enough to get around.


Title: Re: How to Verify and Validate Bitcoin Transactions of Other Users ??
Post by: danystatic on September 27, 2013, 05:57:36 AM
thanks for the answer

txindex = 1    ; is running

------------------------
however I'm still missing something very important

I have not been able to understand this, here I describe :

decoderawtransaction <hex string>    <<------- I only know the address of the user, I do not know how to obtain the <hex string> needed
getrawtransaction <txid> [verbose=0]  <<----- How can I get the <txid> of the transaction if I only know both of the user's address ?

I have not been able to figure this out


Title: Re: How to Verify and Validate Bitcoin Transactions of Other Users ??
Post by: DannyHamilton on September 27, 2013, 06:05:12 AM
thanks for the answer

txindex = 1    ; is running

------------------------
however I'm still missing something very important

I have not been able to understand this, here I describe :

decoderawtransaction <hex string>    <<------- I only know the address of the user, I do not know how to obtain the <hex string> needed
getrawtransaction <txid> [verbose=0]  <<----- How can I get the <txid> of the transaction if I only know both of the user's address ?

I have not been able to figure this out

I assumed that when Carmen claimed that she didn't receive the bitcoins, Pedro provided you with the transaction ID.


Title: Re: How to Verify and Validate Bitcoin Transactions of Other Users ??
Post by: danystatic on September 27, 2013, 06:10:31 AM
Oh I see,
So I have to ask Pedro for the transaction ID ?

Because as of today I am using Blockexplorer.com 
example: http://blockexplorer.com/address/1CdBBMyK9jdBP9jqCRpgBWB5uyMdx3L3Ci

From here I can see, but if I do it with an application I would have to get the page source and with code search for the corresponding string to find the senders or receivers address and verify and validate with regular expressions  or string functions. But if done this way the transaction ID is not needed.

The code returned from Blockexplorer didn't needed the txid


Title: Re: How to Verify and Validate Bitcoin Transactions of Other Users ??
Post by: DannyHamilton on September 27, 2013, 02:59:01 PM
Oh I see,
So I have to ask Pedro for the transaction ID ?

Because as of today I am using Blockexplorer.com  
example: http://blockexplorer.com/address/1CdBBMyK9jdBP9jqCRpgBWB5uyMdx3L3Ci

From here I can see, but if I do it with an application I would have to get the page source and with code search for the corresponding string to find the senders or receivers address and verify and validate with regular expressions  or string functions. But if done this way the transaction ID is not needed.

The code returned from Blockexplorer didn't needed the txid

Pedro shouldn't be providing a bitcoin address.  A transaction can have multiple inputs coming from multiple addresses, and there could potentially be multiple transactions between Carmen and Pedro.  Pedro should be providing a transaction ID.

Carmen could provide a bitcoin address, but I don't think monitoring a bitcoin address that doesn't belong to the Bitcoin-Qt wallet is a feature in Bitcoin-Qt.  You'd probably have to dump the entire blockchain and search through all of its contents for all transactions that use Carmen's address as an output.  Then you'd have to look at the inputs of each of those transactions and see how many of them refer to transactions that had Pedro's address as an output.  Then you'd have to figure out if any of those possibly multiple transactions are the specific one you are concerned about.


Title: Re: How to Verify and Validate Bitcoin Transactions of Other Users ??
Post by: Abdussamad on September 28, 2013, 11:17:01 AM
Oh I see,
So I have to ask Pedro for the transaction ID ?

Because as of today I am using Blockexplorer.com 
example: http://blockexplorer.com/address/1CdBBMyK9jdBP9jqCRpgBWB5uyMdx3L3Ci

From here I can see, but if I do it with an application I would have to get the page source and with code search for the corresponding string to find the senders or receivers address and verify and validate with regular expressions  or string functions. But if done this way the transaction ID is not needed.

The code returned from Blockexplorer didn't needed the txid

blockchain.info( bci) provides an API to look up this sort of stuff in a machine friendly format:

http://blockchain.info/q
http://blockchain.info/api/blockchain_api

They have a bunch of different APIs and you would do well to bookmark this page on their site for future reference:

http://blockchain.info/api/


Title: Re: How to Verify and Validate Bitcoin Transactions of Other Users ??
Post by: danystatic on November 24, 2013, 06:32:40 PM
I was relying on Blockchain but its time to improve this.

Note: This is using my own wallet in my system

I am receiving BTC from couple of friends now !! :) looking to do a  btc-startup

please some advice or help...

Note: using jsonRPCClient and PHP (the basic process could be similar to others lang..  I believe)

The website asks them to POST their address before sending, because I am not able to extract automatically the Senders Address.

1.  Create a new address for each sender, using ->getnewaddress('payments');

2.  Then I listen for payment with -->getreceivedbyaddress()
     This way I do not obtain any information about the Tx

3. Find the txid  ?? how?

4. While a better method is found, using ->listtransactions() to read a received tx

5. I can see the senders address is inside this array, How can I be sure I extract the "correct" senders address without comparing it with the one POSTed via the website?


Title: Re: How to Verify and Validate Bitcoin Transactions of Other Users ??
Post by: Abdussamad on November 24, 2013, 09:07:56 PM
danystatic take a closer look at the documentation of bitcoind. IT is possible to configure it so that it runs a command when it sees a transaction. So you can have it GET your script each time that happens. Of course you need to put it some authentication system in place to ensure your script is not being called by an outside user pretending to be bitcoind.