0

I'm developing bitcoin payment processing application.

I've two question to ask:

  1. In each bip32 address, How much UTXO each address should have to consider generating new address to avoid address re-using? for example If address A used twice should I generate a new address or does it have specified number for address re-use before generating new one?
  2. When new address generated, from my understanding , I've to scan following address for each address derivation path to see if each index have fund or not:
    • Legacy
    • Segwit
    • Change address for Legacy
    • Change address for Segwit

What's best way to scan addresses without submitting so much request (for each index) to blockchain explorer to scan funds?

Thanks in advance.

2 Answers 2

1

How much UTXO each address should have to consider generating new address to avoid address re-using?

Preventing address re-use by itself means that an address should not be used more than once. So unless, someone sends you two outputs to the same address in the same transaction (highly unlikely) you are going to end up with one UTXO per address. Preventing address re-use helps your privacy. For example, say you used an address to receive funds from your customer. If you use the same address again, these customers can actually scan the blockchain to see how much amount you have received from others. Not re-using addresses more than once helps protect your privacy.

When new address generated, from my understanding , I've to scan following address for each address derivation path to see if each index have fund or not?

Depends on what address format are you using for your payment gateway. If you have always generated bech32 addresses, you need not scan the blockchain for P2PKH addresses to see the amount received from your customers. You only need to scan the blockchain for the addresses that you have generated (receiving or change).

2
  • I still don't get it how to handle address scanning,let's say I don't use P2PKH addresses anymore, over time, When transactions grow and that means generating more new address, Is there good way to handle address scanning considering speed and performance? for example If single user does have 100 transaction(100 addresses?), Should I scan 100 blockchain addresses to find out how much funds user have? In over time, when I have more users and they also generate address does it not going out of control?
    – Nobit
    Commented Jun 30, 2019 at 6:38
  • @nobit You cannot do away without scanning the blockchain. If you want to generate more addresses, you would need to scan them to see you have not magically received some funds (after their use) or if there is a leak in the private keys and your bitcoins got spent.
    – Ugam Kamat
    Commented Jun 30, 2019 at 7:17
1

What's best way to scan addresses without submitting so much request (for each index) to blockchain explorer to scan funds?

You should not build your service to trust some third party blockchain explorer service. If you are handling payments from customers, you should be running your own node, and looking to it for confirmation of payments.

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.