Skip to content

Implement Token Proposal (CashTokens v2.2)

Calin Culianu requested to merge cculianu/bitcoin-cash-node:cashtokens_v2 into master

I have implemented the CashTokens v2.2 spec.

Special thanks to @0353F40E for his spec. Special thanks to @bitjson for his spec.

Implementation is 97% complete. We also still need to implement a full suite of tests. EDIT: This has been done in !1600 (merged).

This MR depends on: !1597 (closed), !1598 (closed) and !1599 (closed) (it includes those changes).

TODO:

  • Implement spec for ser/unser, signing, and consensus rules for spending
  • Implement test vectors as they appear in the CashTokens v2 spec
  • Finish off unit tests to cover new code paths introduced
  • Add functional tests (python)
  • Disable accidental burns of tokens in wallet
    • Right now the wallet (RPC or GUI) will burn tokens if it spends UTXOs that contain tokens post-activation.
    • A potential stop-gap measure would be to just freeze such UTXOs, until we implement token spending logic in the wallet.
  • Decide if we will allow or disallow tokens on UTXOs created before activation (currently such UTXOs starting with PREFIX_BYTE are unspendable).
    • It has been decided that pre-activation token forgery outputs (PATFOs) will be disallowed.
    • Also, pre-activation outputs that start with PREFIX_BYTE but that fail to parse as token data are also going to be permanently unspendable as well (this is the case now before activation).
  • Update the CashTokens v2 spec to reflect the changes herein
    • Spec needs to clarify differnces between serialization errors when deserializing the token data block after the PREFIX_BYTE and actual consensus validation rules. It is unclear in places and definitely needs updating.
    • Spec is missing lots of detail and test cases still...
  • Implement cashaddr type changes. See MR !1596 (closed)
  • Write code to track activation height
  • Implement SIGHASH_UTXOS.

Test Plan

  • ninja all check-extended check-upgrade-activated-extended (must all pass)
  • ninja bench-bitcoin (must all complete)
Edited by freetrader

Merge request reports