simpleledger / slp-specifications

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

Enable multiple types of tokens to be sent in a single transaction (Example) #9

Closed biocrypto730 closed 5 years ago

biocrypto730 commented 5 years ago

OP_RETURN

<lokad id: 'SLP\x00'> (4 bytes, ascii) <token_type: 1> (1 to 2 byte integer) <transaction_type: 'SEND'> (4 bytes, ascii)

(32 bytes) (required, 8 byte integer) (4 bytes, ascii) (1 to 2 byte integer) (32 bytes) (optional, 8 byte integer)
markblundeberg commented 5 years ago

We discussed a lot during design of SLP, whether it could be extended in such a way. After much deliberation we realized it's not possible to extend, and moreover we explicitly declare token type 1 SLP to be set in stone, no modifications possible ever.

It's worth noting exactly what will happen if you create a client that follows these new rules:

  1. Any existing wallet (under the current rules) receiving such a transaction will judge it to be invalid (i.e., tokens have been burned); the wallet will then take the BCH output and spend it as BCH alone, in which case the tokens will be definitely burned.
  2. Any descendant coins will have exactly the same issue -- they are also invalid under current rules, since their ancestor was invalid.

This is why we put the token_type field in -- modified rules will have to happen in a new token type, never in token type 1.

(We did also consider multiple-token sends during design, but it would have added more complexity and room for error when establishing the exact validity rules -- what happens when one token id is validly transferred, but the other is not, etc.. It's not as simple as declaring a new format, you also have to make sure all clients analyze every transaction identically, under all possible situations.)

biocrypto730 commented 5 years ago

Yes, there are ways to extend SLP that dont require updates to existing clients, since fortunately BCH is the smart bitcoin and can enable multiple OP RETURNs