<p>The simplest patch for this is <code>filter-ordinals.patch</code> (aka Ordisrespector):</p>
<p><a href="https://gist.github.com/luke-jr/4c022839584020444915c84bdd825831" rel="nofollow noreferrer">https://gist.github.com/luke-jr/4c022839584020444915c84bdd825831</a></p>
<pre><code>--- a/src/script/interpreter.cpp
+++ b/src/script/interpreter.cpp
@@ -504,6 +504,14 @@ bool EvalScript(std::vector&lt;std::vector&lt;unsigned char&gt; &gt;&amp; stack, const CScript&amp;
                     return set_error(serror, SCRIPT_ERR_MINIMALDATA);
                 }
                 stack.push_back(vchPushValue);
+                if ((flags &amp; SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS) &amp;&amp; opcode == OP_FALSE) {
+                    auto pc_tmp = pc;
+                    opcodetype next_opcode;
+                    valtype dummy_data;
+                    if (script.GetOp(pc_tmp, next_opcode, dummy_data) &amp;&amp; next_opcode == OP_IF) {
+                        return set_error(serror, SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS);
+                    }
+                }
             } else if (fExec || (OP_IF &lt;= opcode &amp;&amp; opcode &lt;= OP_ENDIF))
             switch (opcode)
             {
</code></pre>

CC BY-SA 4.0
2024-03-15T16:15:09.420Z
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
CC BY-SA 4.0
2024-03-14T23:01:19.167Z
2024-03-14T23:01:19.167Z
Luke Dashjr
<p>If you want to keep running bitcoin core I think the easiest thing to do would be to add <code>permitbaremultisig=0</code> and <code>datacarrier=0</code> to your <code>bitcoin.conf</code> 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 <a href="https://github.com/bitcoin/bitcoin/pull/28408" rel="nofollow noreferrer">this</a> one. If you want more strict spam filtering, then you could always run <a href="https://github.com/bitcoinknots/bitcoin" rel="nofollow noreferrer">Bitcoin Knots</a> which is a fork of Bitcoin core run by Luke Dashjr.</p>

CC BY-SA 4.0
2024-03-14T23:00:24.290Z
Ordinals bypass the `datacarrier` policy due to unfixed bugs in Bitcoin Core
Luke Dashjr
CC BY-SA 4.0
2024-01-23T16:49:33.087Z
2024-01-23T16:49:33.087Z
luke
<p>How do I customize Bitcoin Core's <a href="https://bitcoin.stackexchange.com/a/118199/112354">mempool policy</a> so that low value transactions (<a href="https://bitcoin.stackexchange.com/questions/118567/how-can-we-check-if-a-transaction-is-an-ordinal-transaction-in-the-mempool">ordinals</a>, <a href="https://bitcoin.stackexchange.com/questions/118988/how-to-differentiate-between-btc-transactions-and-brc20-transactions-on-a-blockc">BRC-20</a>) 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 <strong>YouTube</strong> 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>
<p>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.</p>

<bitcoin-core-development><mempool><ordinals><spam><tokens>
How do I customize Bitcoin Core's mempool policy so that low value transactions (ordinals, BRC-20) are not propagated by my mempool?
John Smith
# How do I customize Bitcoin Core's mempool policy so that low value transactions (ordinals, BRC-20) are not propagated by my mempool?

(Asked by: username_0 on 2024-01-22)

How do I customize Bitcoin Core's [mempool policy](https://bitcoin.stackexchange.com/a/118199/112354) so that low value transactions ([ordinals](https://bitcoin.stackexchange.com/questions/118567/how-can-we-check-if-a-transaction-is-an-ordinal-transaction-in-the-mempool), [BRC-20](https://bitcoin.stackexchange.com/questions/118988/how-to-differentiate-between-btc-transactions-and-brc20-transactions-on-a-blockc)) 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.

**Tags:** bitcoin-core-development, mempool, ordinals, spam, tokens


---

## 2 answers

### Answer by username_1 on 2024-03-14. Score: 1 | Accepted answer

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

<https://gist.github.com/username_1-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)
             {

```

> **Comments:**
> **username_0**: 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`.  

---

### Answer by username_2 on 2024-01-23. Score: 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](https://github.com/bitcoin/bitcoin/pull/28408) one. If you want more strict spam filtering, then you could always run [Bitcoin Knots](https://github.com/bitcoinknots/bitcoin) which is a fork of Bitcoin core run by username_1 username_1.

> **Comments:**
> **username_1**: Ordinals bypass the `datacarrier` policy due to unfixed bugs in Bitcoin Core  

---

