dcdpr / btcr-DID-method

BTCR is the reference Decentralized Identifier (DID) method for the Bitcoin blockchain
BSD 3-Clause "New" or "Revised" License
7 stars 5 forks source link

BTCR utilities should only use short txref if txo index is zero #30

Open danpape opened 5 years ago

danpape commented 5 years ago

As decided in the 2019 summer hackathon, BTCR should only use a short txref if the specified txo index is zero. For example, the following transaction parameters can be encoded as short (implicit txout=0) and long (explicit):

    "block-height": "1152194",
    "transaction-position": "1",
    "txo-index": "0"

Short: txtest1:xyv2-xzpq-q9wa-p7t Long: txtest1:8yv2-xzpq-qqqq-9yce-nk

I think that the filtering should be done in the BTCR utilities (txid2txref, createBtcrDid, etc) and not in libtxref itself. That way libtxref can be "clean" and we will keep the BTCR-related logic in the BTCR code.

Finally, following Postel's law, we should allow the long form of a txref as input to the command line utilities, but we will convert to the short form for any output (possibly with a warning message as well).