Author

Topic: Best way to track a transaction? (Read 555 times)

legendary
Activity: 947
Merit: 1042
Hamster ate my bitcoin
February 13, 2014, 11:20:38 AM
#6
I'm interested in tracking sent transactions, not received.

Just to be clear (Sorry if this is obvious...) a sent transaction uses both inputs and outputs to create the transaction. If you want to track the sent transaction you need to track the TxIns and TxOuts.

See - https://en.bitcoin.it/wiki/Transactions

By sending I mean I'm the creator of the transaction.

Costamonger has posted a workable solution, but this still seems a little convoluted.

1.) When a customer withdraws bitcoin from your service, include an extra output in the transaction to spend a portion of your own BTC back to a new address you control.  
2.) Track the presence of that output at your new address.  (Through a callback for instance)
3.) Did the bitcoin arrive?  
  • If yes, then congratulations, you can be sure that the funds involved were delivered
  • If no, then neither your funds or the customers withdrawal were successfully sent out to begin with.

If for whatever reason an attacker tried to manually spend or fake-double spend bitcoin back to your new address as a "trick," all they've accomplished is an action that forces your system to mark their withdrawal as successful.
sr. member
Activity: 351
Merit: 250
February 12, 2014, 05:54:18 PM
#5
I'm interested in tracking sent transactions, not received.

Just to be clear (Sorry if this is obvious...) a sent transaction uses both inputs and outputs to create the transaction. If you want to track the sent transaction you need to track the TxIns and TxOuts.

See - https://en.bitcoin.it/wiki/Transactions
legendary
Activity: 947
Merit: 1042
Hamster ate my bitcoin
February 12, 2014, 05:49:04 PM
#4
Thanks Foxpup & optimator.

I'm interested in tracking sent transactions, not received.

Are there any other parts of the transaction that are permanently immutable, like the transaction hash for example, that could be used for tracking?
sr. member
Activity: 351
Merit: 250
February 12, 2014, 05:34:21 PM
#3
Can someone clear something up for me.

Given that the txid is unreliable for tracking purposes, what is the best way to track the status of a transaction automatically?

The txid is only mutatable until it's included in a block. Then the Txid is immutable.

Therefore, I'd characterize the question as "How do you track a transaction from creation until inclusion in a block?"

The current solution I'm working through is

1. You track the inputs/outputs (or if you are manually creating a transaction then maybe the rawtransaction)
2. Optionally store the intermediate TxId
3. Wire up bitcoind using -blocknotify
4. Scan each incoming block for your inputs/outputs
5. If #4 finds a match then you assume the transaction is the same as the one you generated
6. Store the TxId from #5 replacing the TxId from #2 if necessary.

However, I'm uncertain if the match logic used in #4 is guaranteed to be unique.
legendary
Activity: 4542
Merit: 3393
Vile Vixen and Miss Bitcointalk 2021-2023
February 12, 2014, 05:16:46 PM
#2
Address. Standard practice for merchants is to generate a unique address for each individual order, and search for all transactions to that address. Then it doesn't matter if a transaction is mutated, the customer pays in multiple instalments for whatever reason, or any other weird situations. For exchange withdrawals, each customer will already have a unique address. Tracking addresses always works. If it is absolutely required to record transaction IDs, simply wait until the transaction is confirmed. Most importantly, remember that unconfirmed transactions may be altered (and not just as a result of malleability), either maliciously or accidentally, so never record details of unconfirmed transactions without periodically checking those records against the blockchain and correcting them as necessary. Yes, that's more effort, but it's got to be done to keep track of unconfirmed transactions correctly.
legendary
Activity: 947
Merit: 1042
Hamster ate my bitcoin
February 12, 2014, 04:28:04 PM
#1
Can someone clear something up for me.

Given that the txid is unreliable for tracking purposes, what is the best way to track the status of a transaction automatically?
Jump to: