0

I'm using blockchain dumps from http://dumps.webbtc.com/ in database schema in mentioned that result of script in pk_script should specify recipient of transaction. But how do I get amount of bitcoin sent and sender?

1 Answer 1

1

The database schema is located here: https://webbtc.com/api/schema

You might be disappointed to find out that it's not as simple as an amount and a sender for each transaction. What there are is a list of inputs (references to previous outputs), and a list of new outputs. Each output with an amount and a pseudonymous address. Each input has a TXID and output index to reference which previous output it is spending. Unless you know who owns specific addresses, though, you can't determine the identity of the sender(s).

You can use the prev_out and prev_out_index from a row in the inputs table to find the associated previous output, which will tell you the amount and address.

5
  • I need sender in sense of getting his pubkey or even hash of pubkey which your comment if I understand correctly refers to as 'address'. So, I need to look up previous transactions. And what if previous transaction has many recipients and only one of them participating in the current?
    – Moonwalker
    Dec 10, 2015 at 19:07
  • 1
    The pk_script of the outputs table gives you that, but you'll need to convert that scriptPubKey to an address. It's not super easy to do that, and the table doesn't give you the actual address. So, you can either look up the standard output types and learn how to convert them to an address, or use a different data set that has the addresses in them.
    – morsecoder
    Dec 10, 2015 at 19:14
  • Could you suggest different data set which already has addresses in it? I would much appreciate it.
    – Moonwalker
    Dec 10, 2015 at 20:08
  • If you're specifically looking for downloadable databases, I don't know of any, unfortunately. There are API web services that provide that information, but it takes a long time to parse the whole block chain (and a lot of bandwidth) with an API.
    – morsecoder
    Dec 10, 2015 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.