instagibbs / anticycle

Demo anti-cycle replacement script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

anticycle

Demo anti-cycle replacement script

https://bitcoinops.org/en/newsletters/2023/10/25/#replacement-cycling-vulnerability-against-htlcs

Requires ZMQ and RPC access to your Bitcoin Core node

Horrifically untested, won't stand up to real attacks probably, maybe? For now, only tracks/attempts single tx resubmissions for RBFs. In other words, it will not attempt CPFP-based fee transaction structures, though that can be supported in future.

Mostly implementing to see how many times this cycling seems to be happening in practice to set the cycling threshhold.

flowchart TD
    A(UTXO Spend in Top Block) -->|cache evicted chunk\nif empty and above thresh| A
    A -->|increment spent-unspent counter,\ntry resubmitting\ncached| B(UTXO spend NOT in Top Block)
    B -->|clear cache for utxo| A
Loading

TODO: Figure out more comprehensive anti-DoS story against an attacker simply churning the cache with incremental RBFs:

  1. Only cache full tx when CYCLE_THRESH breached, vs storing everything in dummy_cache
  • requires some other publication mechanism?
  1. Increase CYCLE_THRESH, for multiplicative security (costing attacker more per slot)
  2. Increase max memory usage X times, for multiplicative security
  3. Cache to disk for additional security

Branch in warnet which is actually being tested: https://github.com/instagibbs/warnet/commits/2024-05-28-instagibbs-demo/

About

Demo anti-cycle replacement script

License:MIT License


Languages

Language:Python 100.0%