cculianu / Fulcrum

A fast & nimble SPV Server for BCH, BTC, and LTC
Other
331 stars 76 forks source link

CashTokens; make absolutely sure no old clients break. #150

Closed zander closed 1 year ago

zander commented 1 year ago

As I understand from Jonathan Silverblood, he explained how the reporting of cash-tokens using UTXOs works in Fulcrum. Its not clear to me if the current approach in Fulcrum is actually going to successfully stop old clients from receiving UTXOs they can't use.

To avoid lingering confusion in the time before this is actually taken into production I thought it best to go to the source and check with you.

[tokens] might cause issues for those who don't send the recommended server.version message to state what version of the protocol they want to adhere to.

The issues specifically is that requests for a output-hash returning token based UTXOs / transactions are going to confuse older wallets. Wallets which have not been updated to understand tokens, either by the user going to the latest version or there simly is not yet a new release. Those wallets would include such an UTXO in a not-token-using transaction and get it rejected without understanding why.

My request is that Fulcrum never sends token-based UTXOs or transactions unless the caller explicitly states they are able to use them. So what Jonathan seems to be worried about is if and older client never states which version it supports, it will get tokens. If that is the case I'd love for Fulcrum to update that policy and avoid breaking wallet code.

Related reddit thread; https://old.reddit.com/r/btc/comments/znm4ai/how_often_does_bch_hard_forks_affect_wallet/

cculianu commented 1 year ago

Yes, this is handled in #149 , specifically see: https://electrum-cash-protocol.readthedocs.io/en/latest/protocol-methods.html#blockchain.address.listunspent

jonas-lundqvist commented 1 year ago

Just to clarify.

So what Jonathan seems to be worried about is if and older client never states which version it supports, it will get tokens.

This is handled by this section in the protocol specification

When a connection is made, both client and server must initially assume the protocol to use is their own protocol_min.

https://electrum-cash-protocol.readthedocs.io/en/latest/protocol-basics.html#version-negotiation

Since the token data will only be shown to clients by default in the new version, and Fulcrum will support the old one for the foreseeable future, no old clients that either requests an old version or omits the version at all will break.

My request is that Fulcrum never sends token-based UTXOs or transactions unless the caller explicitly states they are able to use them.

This is done explicitly when clients requests the new version.

zander commented 1 year ago

Awesome, thanks to both for giving an authoritive answer.

I'll close this question as I consider it answered.

cculianu commented 1 year ago

Yeah always feel free to contact me here or wherever @zander, I appreciate the concern. You are not the only one that prodded me about this (although others did this earlier hence #149 ). Thanks also @jonas-lundqvist for helping to answer the question.