simpleledger / slp-specifications

Simple Ledger Protocol (SLP) Specifications
MIT License
57 stars 40 forks source link

P2SH-based extension to prevent accidental burn #31

Open readcash opened 3 years ago

readcash commented 3 years ago

Hi everybody! I talked this idea over with Jonald and he couldn't find any obvious problems with it, so let's maybe discuss it wider.

What if instead of sending SLP tokens to P2PKH addresses (and risking accidental burn) we would send them to P2SH addresses that are unlocked by something like 'SLP' string (checked with OP_EQUAL to 'SLP') + the usual P2PKH unlocking params?

I think that might prevent accidental token burn, since regular wallets would have no idea how to spend this P2SH UTXO.

It seems to me that it's pretty backwards-compatible and opt-in, since if a wallet supports this scheme - it'll generate the P2SH-based simpleledger:... address to send to, but if you then want to send it to P2PKH - it works the same way. So, if some wallet implements that - it doesn't change anything - it's still interoperable with other P2PKH-based wallets out there.

I mean it could be something like SLP1.1 or something. An extension to the protocol that makes it safer, but is not obligatory to implement for other wallets.

About P2SH and HD wallets, we can simply generate and cache the P2SH address for every known private key and then see if there are any UTXOs there - that way even if we're starting from a seed, we'll be able to unlock P2SH. Additional benefit: non-compatible (old) wallets won't even see these UTXOs, thereby preventing burn.

Frankly, this accidental token burn is what really scares me in SLP tokens.

Of course, I haven't thought it in detail, so maybe there is an obvious problem that I haven't noticed.

Thank you!

jcramer commented 3 years ago

This would be a great thing to have and would probably prevent accidental burning as you suggest. One of the challenges in getting to this point is getting any wallet to implement a robust p2sh layer that would be required to make this work. Even the current Electron Cash support for p2sh is limited and not perfected.

I will forward this to SLP Foundation to see if they agree we should work this concept of "wrapped p2pkh" into the official roadmap. It really would be a great initiative and would probably contribute towards the goal of having a standardized p2sh smart contract specification/protocol that wallets could adopt.

readcash commented 3 years ago

Awesome! Thank you for your time!