1

I have a bitcoin address. How do I get it's balance and the amount of BTC (preferably in Satoshi) 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?

  • Is it just one address you want info for? Are you saving the transactions for just one address or are you tabulating multiple addresses? More info (including preferred OS, client etc) will help. What is the scope of the project too? Ps what do you define as first party? Eg are you looking at the BitcoinDaemon on an OS and wanting to avoid API? – Wizard Of Ozzie Sep 10 '14 at 11:34
  • @AussieCryptocurrency - the goal is get the info I want using the standard way, not third-party bitcoin services. That's it. Suppose, this is just one or a few arbitrary addresses - doesn't matter. – アレックス Sep 10 '14 at 12:30
  • The standard way, for most people, is to use third-party services. Bitcoin Core (and AFAIK other popular clients) don't support querying arbitrary addresses other than those that are part of the wallet. – Nate Eldredge Sep 10 '14 at 16:00
  • @NateEldredge, that can't be a standard way because the third-party services themselves obtain that information from somewhere. – アレックス Sep 10 '14 at 16:53
  • 1
    It's all in the public block chain, but the third party services have custom software to parse and index for arbitrary queries. You could write your own, but the standard software doesn't do it and I'm not aware of off-the-shelf solutions. If there are I'd be happy to know. – Nate Eldredge Sep 10 '14 at 17:09
2

If you dont want to use ANY 3rd party service, you will need to parse the entire blobkchain and put it inside a database so you can query whatever information you want.

To do that you have two options:

  • code your own parser for blocks/transactions, and here i suggest you using the rcpapi (its all json, nothing crazy) instead of doing it the hard way like this
  • use some software which can do it (something like blockexporer or Abe)

Another piece of advice: before you start downloading the blockchain, you need to set this in your bitcoin.conf

# look up historical transactions
txindex=1

Which allows you to get detailed information about "old" transactions, but this will make grow the blockchain size in your disk significantly

  • If I put the entire blobkchain into a db, it'll become outdated in a few minutes, won't it? I'll have to constantly update the db. – アレックス Sep 12 '14 at 17:01
  • Thats why i suggest you using rpcapi: you need to be running a bitcoind somewhere and have a process querying the rcpapi each 10 mins (whatever time you want) and keep your db up-to-date – reiven Sep 12 '14 at 17:04
  • Sorry, my question was "If I put the entire blobkchain into a db, it'll become outdated in a few minutes, won't it?" – アレックス Sep 12 '14 at 17:29
  • The answer is yes, but partially. If you keep a proceses checking for new blocks and their respective transactions and putting it into the db, you are ok. Keep in mind that the 6 confirmation needed gives you some time to parse 6 blocks – reiven Sep 12 '14 at 17:36
1

The standard way to to this is to use software that downloads, parses, and indexes the blockchain. While possible to do create your own software using the bitcoin specification, there are a number of ready-built applications that you can use, such as those listed here: https://bitcoin.org/en/choose-your-wallet. It's going to take a really really long time for the initial download, but once that's done, you'll have access to all the information you're looking for and then some.

In addition, you mention that you would prefer to get the balance in Satoshis? Which ever application you decide to use should give you this option, but just in case that it doesn't, simply take the balance in BTC, and multiply it by 100,000,000.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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