1

How do I customize Bitcoin Core's mempool policy so that low value transactions (ordinals, BRC-20) are not propagated my mempool? I compile my full-node from source, so I am interested in editing the code before compiling the clients as well as (if possible) configuring the standard client for the sake of implementing such policy. Some time ago I've heard on YouTube that someone already implemented it by modifying Bitcoin Core. I've not been able to find a repo of such project anywhere. If such project already exists - I would like to know what Bitcoin Core's file were modified and in what way.

P.S. Despite being well versed in other languages, I am only a beginner coder in C and have no experience in C++. Explaining like to a newbie would be appreciated.

2 Answers 2

1

The simplest patch for this is filter-ordinals.patch (aka Ordisrespector):

https://gist.github.com/luke-jr/4c022839584020444915c84bdd825831

--- a/src/script/interpreter.cpp
+++ b/src/script/interpreter.cpp
@@ -504,6 +504,14 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
                     return set_error(serror, SCRIPT_ERR_MINIMALDATA);
                 }
                 stack.push_back(vchPushValue);
+                if ((flags & SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS) && opcode == OP_FALSE) {
+                    auto pc_tmp = pc;
+                    opcodetype next_opcode;
+                    valtype dummy_data;
+                    if (script.GetOp(pc_tmp, next_opcode, dummy_data) && next_opcode == OP_IF) {
+                        return set_error(serror, SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS);
+                    }
+                }
             } else if (fExec || (OP_IF <= opcode && opcode <= OP_ENDIF))
             switch (opcode)
             {
1
  • Thank you. It succeds with an offset: Hunk #1 succeeded at 479 (offset -25 lines). I will follow your repo as spammers change their protocol and as Bitcoin Core's new releases may update interpreter.cpp.
    – John Smith
    Mar 15 at 16:15
1

If you want to keep running bitcoin core I think the easiest thing to do would be to add permitbaremultisig=0 and datacarrier=0 to your bitcoin.conf file althought I don't know how effective that would be. You could also look for one of the spam filter PRs that have been made for bitcoin core such as this one. If you want more strict spam filtering, then you could always run Bitcoin Knots which is a fork of Bitcoin core run by Luke Dashjr.

1
  • 2
    Ordinals bypass the datacarrier policy due to unfixed bugs in Bitcoin Core Mar 14 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.