0

I'm trying to see how much bitcoins I've received via bitcoind's one method, getreceivedbyaddress specifying a certain address, and after knowing the amount of bitcoins, I soon realized that such as block explorer services, blockchain.info or blockcypher indicates the different amount of bitcoins. It's interesting that when I specified another address, both bitcoind and block explorer services indicated the same amount.

Since I'm developing a crypto exchange, I need to know a user's deposited amount of bitcoins in order to calculate how much a user has bitcoins rightly, even after letting other users withdraw their bitcoins.

So which is exactly right and reliable?

closed as unclear what you're asking by Adam, Raghav Sood, Andrew Chow Jun 20 '18 at 23:13

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

In general, I would trust my own local node over a block explorer website. If you’re running an exchange you should be running a node, or more likely several nodes on isolated machines, this will allow you to interact with the network without trusting any other person or service to provide you with honest information. You will need to build a system to resolve deposits, based on the info supplied by your node(s).

Relevant point: bitcoin does not keep track of ‘account balances’, rather the system tracked ‘unspent outputs (UTXOs). To find the balance for an address, a block explorer would need to sum all current UTXOs associated with that address.

So the source of error may come from how a particular block explorer performs this operation. Blockchain.info, for example, will report the sum of all inputs that have ever paid to a certain address. So if you had 0.1 btc, and you repeatedly spent it back to the same address 30 times, blockchain.info would probably report it as 3btc received (lifetime). This may be an interesting stat, but it isn’t necessarily relevant to your issue of resolving customer deposits.

  • So you mean even if I send send bitcoins back to my address repeatedly, bitcoind won’t peform as block explorer websites do? – 西田龍 Jun 21 '18 at 22:19
  • 1
    I only meant to provide a potential example of how one block explorer website may interpret and display blockchain data in a different way than some other block explorer website. The important point is: there is one absolute record of the transactions that have happened, and that is the blockchain. You can run a node so you have your own copy, and then use this data to determine an address' balance (by summing UTXOs). You don't need to (and shouldn't) rely on a 3rd party block explorer to get this info (they could lie to you, or an error in their system could present incorrect data, etc). – chytrik Jun 21 '18 at 23:34

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