How do I find the address that sent the most Bitcoins to a specific address?
Th0rgal opened this issue · 3 comments
Hey there,
I'm new to this library (which btw looks awesome) and I have a question. I'm using bit to generate a new address which will receive a few transactions (probably between 1 and 5). I need a way to find the address which sent the most bitcoins to my newly created one. According to the doc I can get a list of the previous transactions hashes: https://ofek.dev/bit/guide/network.html#transaction-history
But how could I check the transaction amount per input address?
Thanks,
Thomas
Bitcoin uses UTXOs as inputs to transactions, so in theory you could receive bitcoins in one transaction from multiple "addresses". Are you sure when you receive bitcoins they will come from transactions using a single input or at least from UTXOs referencing the same scriptPubKey?
There is no easy way of doing this. But to see which transaction sent the most you could check the unspents with key.get_unspents()
, which will show you the amount and transaction id.
Bitcoin uses UTXOs as inputs to transactions, so in theory you could receive bitcoins in one transaction from multiple "addresses". Are you sure when you receive bitcoins they will come from transactions using a single input or at least from UTXOs referencing the same scriptPubKey?
There is no easy way of doing this. But to see which transaction sent the most you could check the unspents with
key.get_unspents()
, which will show you the amount and transaction id.
You are right, this wouldn't work especially if the user sent his bitcoins from a mixer an exchange. I'ld better ask him directly where he wants to receive his funds. Thanks for your help.
I have another question (it might be a bit off topic so if you prefer I can open another issue): do you know how I can know the status of a transaction (is it in the process of validation, validated ...or cancelled?).