CounterpartyXCP / counterparty-core

Counterparty Protocol Reference Implementation
http://counterparty.io
MIT License
284 stars 206 forks source link

Require Dispenser Address to be Source Address #1785

Closed adamkrellenstein closed 1 month ago

adamkrellenstein commented 4 months ago
Screenshot 2024-05-11 at 6 59 03 AM

EDIT: It turns out that there is a hacky workaround was implemented as a mandatory protocol change just last November (with the casual changelog entry "Redefined EMPTY address to mean no XCP or BTC history"). This prevents dispensers from being opened on any address that has any XCP or BTC history, which probably resolves the associated security issue. Unfortunately, that little patch unintentionally (and retroactively!) made the entirety of AddrIndexRs (and its ~200GB database) consensus-critical and mandatory for parsing. :/ AddrIndexRs is a broken, unmaintained fork of a third-party codebase that is not deterministic and has been the cause of a large number of critical bugs in Counterparty, not to mention the fact that it makes Counterparty deployment a total PITA. See https://github.com/CounterpartyXCP/counterparty-core/pull/1255/files#diff-446a2aa52fd57fd6379f4732ae36f794df6f0fb1585494f798f4aa3f7b94fca2R136. Generally speaking, opening dispensers on addresses you can't prove that you own is a Bad Idea(TM), and just generally unnecessary... (yes, it will require a moving tokens to a cold wallet before using that cold wallet as a dispenser). Once we implement this, we can kill AddrIndexRs, per https://github.com/CounterpartyXCP/counterparty-core/issues/1764.

davestaxcp commented 4 months ago

this was discussed here (it can only be on addresses with no btc history) #1534

which is why the communication for opening dispensers is the written the way it is here https://davestaxcp.gitbook.io/freewallet.io-user-manual/freewallet-functions/setting-up-a-dispenser

I sometime open dispensers for friends and new users (and when users can only access Freewallet Mobile) from time to time. https://xchain.io/tx/182cc0e538f4617df767d7a5d54aba547ca1e8d38655c3f7a096aff9a118730b

It is very common within the xcp art community and incredibly helpful.

B0BSmiths commented 4 months ago

Opening a dispenser on a 'cold wallet' requires you to be able to open a dispenser on a non source address.

Having to make your cold wallet hot to create a dispenser is a downgrade

B0BSmiths commented 4 months ago

Opening a dispenser on a non source address requires only a single tx.

Opening a dispenser from a source address requires the address to have btc so must first be loaded with btc, meaning it becomes a two tx process and the cost increases

adamkrellenstein commented 4 months ago

Okay there's a sanity check now that it only works for empty addresses...

adamkrellenstein commented 4 months ago

Pretty sure this is required in order to get rid of the AddrIndexRs dependency. (https://github.com/CounterpartyXCP/counterparty-core/issues/1785)

B0BSmiths commented 4 months ago

If the address is brand new - e.g. has no btc balance and no counterparty activity it wont exist in the AddrIndexRs database so how is it dependant on it ?

adamkrellenstein commented 4 months ago

@B0BSmiths you have to check that the address isn't in the database

mikeinspace commented 4 months ago

I'm okay with this change given the AddrIndexRs impact, though it will kind of suck to lose Fair Minting ability (xcp20.wtf style). However, I'm following this thread and will try to collaborate on potential alternatives to Fair Minting: https://github.com/CounterpartyXCP/counterparty-core/issues/1843

adamkrellenstein commented 1 month ago

See https://github.com/CounterpartyXCP/counterparty-core/pull/2141