Skip to content

Instantly share code, notes, and snippets.

@dev7ba
Last active March 5, 2024 16:44
Show Gist options
  • Save dev7ba/caae6ac50491cf36fbf51d5bce64184f to your computer and use it in GitHub Desktop.
Save dev7ba/caae6ac50491cf36fbf51d5bce64184f to your computer and use it in GitHub Desktop.
Tx cycling attack contrib script

Tx cycling attack contrib script

I would like to expand the assignment expressed in this document just to be sure we are on the same track:

https://docs.google.com/document/d/1qqz7vs49jbqzt3DDqrvmuSxMU9n4trNYaA4QPsrDcRk/edit

What is asked is a Phyton script that analyzes the txs from a bitcoin node with "unlimited" mempool size, calculating the feerate of all "chains of transactions" as in CPFP.

(I assume a "chain of transactions" as is expressed in the document, is the list of unconfirmed transactions that form the full ancestry of one transaction, forming a "transaction package".)

We send the transaction packet using sendrawmempool submitpackage RPC, that is currently now in development, See: gihub and github, and is only available for signet.

(We cannot use sendrawmempool RPC as expressed in the document because it does not take into account a "transaction package" as a whole. And low fees parents couldn't get into the mempool.

We can avoid sending the tx package to the bitcoin node with "limited size" if the tx package feerate is below limited-node's mempoolminfee value.

We can use getmempoolinfo RPC to obtain mempoolminfee value.

Assumptions, Problems:

  • This script helps optimize block templates, but what is the execution interval of this script? As transactions keep coming, both mempools become more desynchronized. Given that you want a "history of transactions" and desync problems, wouldn't it be better to have a service running all the time?.
  • AFAIK, bitcoind refreshes getblocktemplate results every 10-20 seconds. Does this script need to execute in less than this interval for a really big mempool? In Python?.
  • I do not understand what you mean by "we want a history of all the transactions."
  • I am still figuring out how the tx cycling attack works. It requires a lot of context: Package relay, Tx V3. (I started with cluster mempool and it seems indifferent for the tx cycling attack?). IMHO, After reading and understanding how the tx cycling attack works, I can't figure out how a script like this can help mitigating the attack. I've studied Bitcoin Optech Newsletter and there's a huge list of possible mitigations, but none of them have to do with anything related with this script. Maybe it has to do with improving tx propagation using a node with a big mempool?
  • It's challenging to progress with such ambiguous objectives. Nevertheless, I am still trying to figure it out.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment