How do I build bitcoin transactions graph?

0

1

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?

Moonwalker

Posted 2015-12-10T15:28:35.810

Reputation: 201

Answers

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.

morsecoder

Posted 2015-12-10T15:28:35.810

Reputation: 12 624

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 2015-12-10T19:07:46.970

1The 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 2015-12-10T19:14:21.330

Could you suggest different data set which already has addresses in it? I would much appreciate it.Moonwalker 2015-12-10T20:08:53.947

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 2015-12-10T20:30:39.770