0

We operate a market, there are sellers and buyers. Seller has Hierarchical Deterministic Wallets. Seller give us the Xpub. Which address should be used as destination, when buyer wants to send money to seller?

I thought I should find the first address that has 0 balance. Do you agree with this strategy?

3

I think these is only one answer to this question: ask whomever gave you the xpub.

Xpubs define series of keys, but there isn't any implicit contract or understanding about how that should be converted into addresses. The specific index positions to use is one question, but there are others, like what type of address/script to use (P2PKH, P2WPKH, ...). All of these are things you should ask the receiver, as it is ultimately up to them to determine what kinds of transactions they would consider a valid payment.

To make a analogy: the receiver told you where they live, and you owe them money, but they haven't told you anything else. Do they want you to pay to their bank account? Do they want you to put an envelope with cash in the mail? Do they want you to bury a treasury chest with jewels under their lawn at night? All of these are in some shape or form ways that value can be transferred, but arguably you wouldn't go bury a treasury chest in their lawn without even talking to them, and expect them to treat that as a payment.

3
  • Yes, of course "script", encoding, is asked from the seller i.e. P2PKH, P2WPKH – János Mar 1 at 10:23
  • Do you think is it any possiblity of interference if I am using the first index with zero balance address choosing strategy? – János Mar 1 at 10:24
  • If that's what you agree on, sure. Anything is fine, but you can't assume it's implicit. – Pieter Wuille Mar 1 at 18:38

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.