Lets have a scenario where POS software wants to support bitcoin payments with zero risk. Ideal is to store Merchant's Bitcoin address in POS settings.
The intention here is to uniquelly bind receipt in local POS Database with transaction hash on Blockchain, in order to know whether the receipt was already paid or not.
This is the scenario where Merchant generates QR Payment request with BTC price and recipient address. Some applications also pass a message but that is stored in internal memory and does not go to Blockchain.
I have came up with two possible algorithms.
Reserve last several satoshis for temporary ID. e.g. 0.00000065
As most of direct (F2F) payments takes less then 2 minutes. It would be possible to generate shorterm ID and then check the Merchant's address for latest transaction, once the temp ID was found POS would mark the receipt as paid and remember the tx hash. This would prevent
Possibility to handle the case where the payment comes from multiple inputs by adding together the inputs for merchant address.
- 1 BTC would have to be atleast $100000 in order to break this.
- Tipping would break this.
HD wallet Generating from Bitcoin address
- Generate new address for each Receipt paid in bitcoin.
- I don't think this could be technically possible, as it is neccessary to derivate child key from master private key.
- How to achieve this with knowing only the Bitcoin address of merchant?
Encode some message in ScriptPubKey OPRETURN
- customer side (depends on wallet they run).
Is there any other - better possibility that is still unknown for me?