How does blockchain.info determine when a payment is received?

1

2

Can anyone help me understand how their payment API works at a bitcoind rpc level? As far as I can tell, there is no way to see what the balance of an address is, only the number of bitcoins that address has received along with the confirmations for it.

If I were to replicate the blockchain API, i would have to:

  • create an address and associated it to an account (destination address)
  • check the balance of all accounts
  • get a list of all addresses in that account
  • check all the addresses looking for the lowest confirmations
    • if value < balance loop back to ensure to check other addresses
  • locate callback and call that
  • move btcs from account to destination address
  • repeat

Is it really that convoluted or am I missing something much simpler? I currently run a website that processes BTC payments but i'd like to move away from relying on blockchain.info.

Richie Lai

Posted 2013-11-28T20:45:51.560

Reputation: 171

Answers

1

What you're describing is one way to do it but there are much better ways. Take a look at https://bitlab.co/wallet which is an open source real-time wallet API that you can learn from. The back-end source that interfaces with the bitcoind service is at https://github.com/bitlabco/bitlab-nodejs

Bitlab.co

Posted 2013-11-28T20:45:51.560

Reputation: 724