Test whether a Bitcoin node would accept a signed transaction
Before handing transaction bytes to a broadcaster, ask a regtest node to evaluate the signed transaction against its current mempool policy.
Submit bytes to the local policy test
Set RAW to a signed regtest transaction in hex. The RPC accepts an array even for a single transaction. Query the first result and preserve the reason on rejection.
payload=$(jq -cn --arg tx "$RAW" '[$tx]')
bitcoin-cli -regtest testmempoolaccept "$payload" | jq '.[0] | {txid, allowed, reason: .["reject-reason"]}'
Interpret a positive result in context
A true allowed value means the node would admit this transaction under the tested conditions. The call does not insert it into the mempool. Another transaction can spend an input before submission, and another node can apply a different relay policy. Record the test time alongside any later broadcast result.