2

Say for example I run an ecommerce website which mandates users to have a minimum balance of 1 bitcoin in their wallets to access the platform. In the event the balance in his wallet falls below 1 bitcoin he should not be able to access the platform and he should see a message on his screen saying "Please load to minimum balance".

So, the question is, can I, or the Bitcoin wallet provider I use, read the bitcoin balance of the users so as to fulfil the above business requirement?

3
  • Are you hosting the wallets for them, so that only you have control of the private keys? If not, this requirement is impossible.
    – Tim S.
    Commented Aug 27, 2014 at 12:12
  • We are planning to host multisig wallets where we will have only one of the private keys but the overall control on the wallet will be completely in the hands of the user.
    – Abhishek
    Commented Aug 27, 2014 at 12:24
  • So basically if i have got this correct this would meaan that I can write a script which calculates the unspent balance on a particular public address (associated with a user in the system) and at any given time if it goes below a particular predefined value, then it sends out a message to the owner of that address to take corrective action?
    – Abhishek
    Commented Aug 27, 2014 at 12:27

3 Answers 3

2

All Bitcoin transactions are publicly available. This is fundamentally why Bitcoin can work as a truly decentralized currency. Bitcoin is different from the traditional banking system specifically because anybody can see and validate everyone's transactions. If only a few could access the information about people's balance, then it wouldn't be fully decentralized, it would be just like traditional banking.

So yes, you can calculate the balance of any Bitcoin address in the network.

4
  • 1
    Yes you can calculate the balance of an address, but you can't really know that it belongs to that user. Even if you require a signed message, you don't know if it's the user or if they asked for/paid for someone else to sign the message for them.
    – Tim S.
    Commented Aug 27, 2014 at 12:13
  • We are planning to host multisig wallets where we will have only one of the private keys but the overall control on the wallet will be completely in the hands of the user. – So basically if i have got this correct this would mean that I can write a script which calculates the unspent balance on a particular public address (associated with a user in the system) and at any given time if it goes below a particular predefined value, then it sends out a message to the owner of that address to take corrective action?
    – Abhishek
    Commented Aug 27, 2014 at 12:31
  • @Abhishek exactly. Commented Aug 27, 2014 at 12:48
  • okay thanks. just one last question, will the same logic be applicable to deterministic wallets with multiple public addressees too?
    – Abhishek
    Commented Aug 27, 2014 at 16:28
0

The service provider can know the balance of the wallet, if the wallet is "hosted" one.

The service provider must know all the addresses associated with the wallet (this is pretty much the definition of a Bitcoin wallet in the first place). However, you do not need to know private keys needed to send out Bitcoins from the wallet, you can have "read-only" knowledge about the wallet.

However from your service it sounds like you are already using hosted wallets, so finding out the balance of the wallet should be just summing up unspent balance on the public addresses of the user wallet.

1
  • We are planning to host multisig wallets where we will have only one of the private keys but the overall control on the wallet will be completely in the hands of the user. – So basically if i have got this correct this would mean that I can write a script which calculates the unspent balance on a particular public address (associated with a user in the system) and at any given time if it goes below a particular predefined value, then it sends out a message to the owner of that address to take corrective action?
    – Abhishek
    Commented Aug 27, 2014 at 12:29
0

I think there is some general confusion as to what a wallet is, and how you interface with one. I'll try to be detailed but not too nitty-gritty.

A wallet is really two connected things. First it is a collection of private/public keypairs. In the case of standard addresses (P2PKH) each public/private keypair matches to 2 distinct Bitcoin addresses. This is because you can derive two addresses from the keypair because there is a compressed and uncompressed representation.

In the case of multi-signature the address is constructed based on all of the public keys involved in the transaction. This can create many addresses that represent the same keypairs or combinations thereof.

Based on the comment above you want to run a site that does 2ofN multisignature. Which means you control one of the keys at least, this means that your wallet is a collection of addresses that you have partial control of. At any time you can sum the balance of every address you mutually control with the user and come up with a total balance.

So, the answer is yes, you can contact the user when the balance falls below a certain amount since you have total knowledge of all keys that the user is using since you are party to them. This lets you compute based on the public ledgers information. This is also true for HD wallets / Keys so long as you compute a collection of multisig addresses derived from the HD keys.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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