Author

Topic: How to get the information about a bitcoin address without 3rd-pard services? (Read 1451 times)

newbie
Activity: 26
Merit: 6
Quote
Not intrinsically slow, probably slow when run on 20GB of unindexed data..

something  x2...x3 times slower than just copying 20gb of data

I would consider "slow" a database query that takes that much. Smiley That's why a nice indexed structure is a huge advantage and several tools certainly exist to build an efficient blockchain database and execute fast queries on top of it. Unless it's about practicing, as Buffer Overflow pointed out.
legendary
Activity: 1652
Merit: 1016
No, it wasn't unanswered.

"just type the addresses into your own web page once it is indexed." - I don't want to type an address. I want to create such a program myself. Is that more clear?



Then you need to have a full bitcoin node running locally. The program your planning to make will need to query the node's database to find the transactions your looking for.

This has been done already. Unless your after some programming practise, why reinvent the wheel?
legendary
Activity: 1260
Merit: 1019
Quote
Not intrinsically slow, probably slow when run on 20GB of unindexed data..

something  x2...x3 times slower than just copying 20gb of data
newbie
Activity: 26
Merit: 6
Quote
This is just a generic slow algorithm because I don't know the structure of Bitcoin Core files.

1) It is not very slow, because you should not verify signatures (your bitcoind did it)
2) Bitcoin core files have very simple structure. Have a look here
https://bitcointalksearch.org/topic/m.8623440


Not intrinsically slow, probably slow when run on 20GB of unindexed data..
legendary
Activity: 1260
Merit: 1019
Quote
This is just a generic slow algorithm because I don't know the structure of Bitcoin Core files.

1) It is not very slow, because you should not verify signatures (your bitcoind did it)
2) Bitcoin core files have very simple structure. Have a look here
https://bitcointalksearch.org/topic/m.8623440
newbie
Activity: 26
Merit: 6
You'll be only able to get such information about an address if you have a full node history locally. Given that, the overall process is:

  • Parse blocks from files
  • For each block, iterate through all transactions
  • For each transaction, parse output scripts
  • If the output script is of some standard form, you can get an address out of its bytes
  • If the parsed address matches the one you're interested in, add the transaction to your "interesting" set
  • From the relevant transactions you can finally infer all the stats you need, e.g. balance, sent/received..

This is just a generic slow algorithm because I don't know the structure of Bitcoin Core files. Some existing index would surely improve search efficiency (e.g. the UTXO index is enough for the balance), in fact web providers must have some internal index on addresses. I've seen many tools around that build fast databases from raw blocks, but I've never used them.

If you don't have any local history, the only way I'm aware of is loading a Bloom filter matching your address and scan the whole blockchain. The peers will then send you relevant transactions for that address plus some unrelevant ones due to the probabilistc nature of the Bloom filter. Beware that you will be forced to do a full rescan for each new address you want to search.
legendary
Activity: 1260
Merit: 1019
Quote
I want to create such a program myself. Is that more clear?

What will be your programming language?
newbie
Activity: 11
Merit: 0
No, it wasn't unanswered.

"just type the addresses into your own web page once it is indexed." - I don't want to type an address. I want to create such a program myself. Is that more clear?

legendary
Activity: 1512
Merit: 1036
The question was already answered if attention was paid. Bitcoin won't do it without help. Get ABE open blockchain explorer and install it to work with your own bitcoin, then you can just type the addresses into your own web page once it is indexed.
newbie
Activity: 11
Merit: 0
You will have to use a third party or a wallet AFAIK.

Easiest is to go to blockchain.info and just paste the address in the search at the top. That will pull all the history from the block chain for you and will give you a summary of the transactions on that address.
Have to? You're wrong.

blockchain.info obtains that information from somewhere, not from other web site.
newbie
Activity: 11
Merit: 0
You can get some API for for transactions of an address here : https://blockchain.info/api/blockchain_api . Do 'third party' includes blockexplorer and wallets?

  ~~MZ~~

Third-party includes any website because protocol bitcoin doesn't have a central web site. Blockchain is also a third-party web site.
hero member
Activity: 560
Merit: 509
I prefer Zakir over Muhammed when mentioning me!
You can get some API for for transactions of an address here : https://blockchain.info/api/blockchain_api . Do 'third party' includes blockexplorer and wallets?

  ~~MZ~~
newbie
Activity: 11
Merit: 0

service or software, what's the difference? The bottom line is that I don't want to use anything third-party.


Thanks for the link but since I'm quite a newbie I'd like more through information.
legendary
Activity: 1260
Merit: 1019
Quote
That doesn't make sense. If what language is this? How can I run it?

Sorry. It is too difficult for me to explain things in good English.
I mean that you should parse blockchain (.blk-files), take each block, parse it, take each transaction, parse inputs and outputs.
Of course, my code is not "real code". You should write parser yourself or ask somebody to do it.
May be it is also possible to find "exactly-what-you-want-program" in the Internet.
newbie
Activity: 11
Merit: 0
No third-party services! Why would I do that through a third-party service if I can do that without it? After all, how those third-party services do that? They use the standard way. So I want to find out what this way is and use it too.

You should code something like this:

Code:
long balance = 0;
for ( int i = 0; !atEnd ( ); i++ )
......
}

That doesn't make sense. If what language is this? How can I run it?
full member
Activity: 179
Merit: 151
-
Addresses do not send funds. This is a dangerous misconception covered on the wiki.
legendary
Activity: 1260
Merit: 1019
You should code something like this:

Code:
long balance = 0;
for ( int i = 0; !atEnd ( ); i++ )
{
  Block b = getBlock ( i );
  for ( int j = 0; j < b.txCount ( ); j++ )
  {
    Transaction tx = b.getTransaction ( j );
    for ( int k = 0; k < tx.countOutputs ( ); k++ )
    {
       Output out = tx.getOutput ( k );
       if ( out.isMyIncoming ( ) )
         balance += out.getAmount ( );
    }
    for ( int k = 0; k < tx.countInputs ( ); k++ )
    {
       Input in = tx.getInput ( k );
       if ( in.isMyOutgoing ( ) )
         balance -= in.getAmount ( );
    }
  }
}
legendary
Activity: 1512
Merit: 1036
sr. member
Activity: 336
Merit: 251
You will have to use a third party or a wallet AFAIK.

Easiest is to go to blockchain.info and just paste the address in the search at the top. That will pull all the history from the block chain for you and will give you a summary of the transactions on that address.
newbie
Activity: 11
Merit: 0
I have a bitcoin address. How do I get it's balance and the amount of BTC it's ever sent and received? I don't want to use any third-party bitcoin services, I want to do it as directly as possible. How can I do that?
Jump to: