← Socratic Seminar #52 ← → or space to navigate

Bitcoin Core #29843 · merged 2026-10-29

Allow non-standard scripts with -acceptnonstdtxn=1

On test networks, nodes can now relay and mine transactions that only break policy script rules, like spends using OP_SUCCESS or OP_NOPx. That makes it easier to try out proposed soft forks.

Author: ajtowns · Test networks only · github.com/bitcoin/bitcoin/pull/29843

Background

Two sets of script rules

The standard script flags are a superset of the consensus flags. Consensus flags apply to blocks; the extra policy flags apply only to the mempool. STANDARD_SCRIPT_VERIFY_FLAGS mempool policy: what your node relays and mines by default Consensus flags every block must obey P2SH · WITNESS · TAPROOT DERSIG · CLTV · CSV NULLDUMMY break one → tx is invalid + 13 policy-only flags Upgrade hooks DISCOURAGE_OP_SUCCESS · DISCOURAGE_UPGRADABLE_NOPS · …_TAPROOT_VERSION · …_WITNESS_PROGRAM · …_PUBKEYTYPE Hygiene / malleability LOW_S · STRICTENC · MINIMALDATA · MINIMALIF · CLEANSTACK · NULLFAIL · WITNESS_PUBKEYTYPE · CONST_SCRIPTCODE break one → valid in a block, but not relayed

The "upgrade hook" flags keep unassigned opcodes and versions out of the mempool, so a future soft fork can give them meaning without anyone having already used them.

What changed

An OP_SUCCESS spend now reaches the mempool

Mempool acceptance with -acceptnonstdtxn=1. Before: standardness checks skipped, but the policy script flags still reject an OP_SUCCESS spend. After: both are skipped and only consensus flags apply, so the transaction enters the mempool. IsStandardTx policy script flags consensus script flags Before tx skipped (already true) enforced OP_SUCCESS fails not reached rejected not standard After tx skipped skipped new in #29843 enforced still checked in mempool Both rows: a node on a test network running with -acceptnonstdtxn=1

Before, the option skipped output and size checks like dust and OP_RETURN limits, but script checks still used the full standard flag set.

Now allowed on test networks

Spends a future soft fork might define

OP_SUCCESSx

Tapscript opcodes reserved for upgrades, like a re-enabled OP_CAT. Today they make a script succeed unconditionally.

OP_NOP1, OP_NOP4–10

Legacy no-ops kept for upgrades, the way CLTV and CSV were added. OP_NOP2 and OP_NOP3 are exempt because they're already CLTV and CSV.

Unknown versions

Unknown Taproot leaf versions, unknown witness program versions, and unknown tapscript public key types.

Hygiene rules too

High-S signatures, non-minimal pushes, unclean stacks and the other malleability checks are skipped as well.

Still rejected: anything that breaks a consensus flag, including rules from any soft fork deployment the chain has defined, even before it activates.

The change

Swap the flag set when standardness is off

// src/validation.cpp · MemPoolAccept::PolicyScriptChecks()
-    constexpr script_verify_flags scriptVerifyFlags = STANDARD_SCRIPT_VERIFY_FLAGS;
+    const script_verify_flags scriptVerifyFlags = (m_pool.m_opts.require_standard
+        ? STANDARD_SCRIPT_VERIFY_FLAGS
+        : m_active_chainstate.m_chainman.m_all_consensus_script_flags);

// New: every consensus flag any deployment on this chain could turn on
+    ConsensusScriptVerifyFlags flags{SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_TAPROOT};
+    flags |= add_pending_flag<SCRIPT_VERIFY_DERSIG>(params, Consensus::DEPLOYMENT_DERSIG);
+    flags |= add_pending_flag<SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY>(params, Consensus::DEPLOYMENT_CLTV);
+    …
  • It uses all possible consensus flags, not just the active ones, so a tx can't sit in the mempool and become invalid when a pending soft fork activates.
  • New compile-time checks (static_assert, consteval) make sure standard flags stay a superset of consensus flags.

Why not mainnet?

Still refused on mainnet

$ bitcoind -acceptnonstdtxn=1
Error: acceptnonstdtxn is not currently supported for main chain

Non-mining nodes

Non-standard txs can sit in your mempool and conflict with standard ones, which can break apps and layer-2 protocols.

Mining nodes

A tx accepted before a soft fork activates could make your blocks invalid. ajtowns notes a restart reloads the mempool under the new rules.

The Knots objection

luke-jr: the option came from Knots, where it runs on mainnet and never enabled upgradable opcodes. He suggested making this =2.

Discussion

Questions for the room

  • ajtowns' motivation: OP_CAT and SIGHASH_APO txs are standard on Bitcoin Inquisition but mainline Core couldn't accept them. Does this make Inquisition-style experiments on other test networks practical?
  • Testnet5 enforces BIP54 from block 1. Should it ship with miners running this option?
  • Should the upgrade hooks ever be split from the hygiene rules, e.g. allow OP_SUCCESS but keep LOW_S?
  • Was changing an existing option's meaning right, or should it have been a new value like =2?