0

According to another user here I am mistaken about how public keys work. I want a customer to have a wallet to which they have a public address to view funds only and I have another public address to deposit to. How can I derive such a key that can view only but not deposit to the public address? I want to make a crypto gift card I can reload and my customers can verify funds.

0

1 Answer 1

3

This is how regular wallets work - your public key is used to derive the address to which deposits are made.

However, you can't prevent someone else from depositing to an address once it is shared with them - for instance, you could print the address or put a QR code containing it on your gift card. Once someone receives it, they can look up that address on any blockchain explorer to see the balance.

However, if they can see the address, they can also make a separate deposit to it. There is no way to prevent this.

6
  • You could implement a new coin type / UTXO flag, and validation rules which restrict other UTXOs from being associated with an address for which such a UTXO already exists. Then after sending such a coin to an address, no more coins can be sent to that address until that coin is spent.
    – Jivan Pal
    Dec 26, 2022 at 23:25
  • @JivanPal: Bitcoin nodes today do not care whether a scriptPubKey was reused when validating a transaction. This would be a pretty big change in transaction validation, and require at least a few gigabytes of extra data to keep track of.
    – Murch
    Dec 28, 2022 at 19:52
  • @Murch That's not what I'm suggesting. As you rightfully point out, pruned nodes wouldn't be able to prune much at all under what you describe. I am merely saying that if an address has UTXOs (which are unspent by definition) of this hypothetical new type associated with it, then the hypothetical new protocol could deem associating subsequent UTXOs with that same address as invalid. Once those UTXOs are spent, the address is fair game again.
    – Jivan Pal
    Dec 30, 2022 at 1:07
  • Even if it is only applied to UTXOs that currently exist, these data structures do not exist currently and would take multiple GB to maintain.
    – Murch
    Dec 30, 2022 at 1:52
  • 1
    20 bytes seems a bit optimistic compared to existing address formats, but other than that your estimates seem reasonable. I would expect little support for a soft fork to introduce only this feature, though.
    – Murch
    Dec 30, 2022 at 16:20

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.