Testmempoolaccept

testmempoolaccept ["rawtx",...] ( maxfeerate )


Returns result of mempool acceptance tests indicating if raw transaction(s) (serialized, hex-encoded) would be accepted by mempool.

If multiple transactions are passed in, parents must come before children and package policies apply: the transactions cannot conflict with any mempool transactions or each other.

If one transaction fails, other transactions may not be fully validated (the 'allowed' key will be blank).

The maximum number of transactions allowed is 50.

This checks if transactions violate the consensus or policy rules.

See sendrawtransaction call.

Arguments:
1. rawtxs          (json array, required) An array of hex strings of raw transactions.
     [
       "rawtx",    (string)
       ...
     ]
2. maxfeerate      (numeric or string, optional, default="100000.00") Reject transactions whose fee rate is higher than the specified value, expressed in XEC/kB
                   

Result:
[                               (json array) The result of the mempool acceptance test for each raw transaction in the input array.
                                Returns results for each transaction in the same order they were passed in.
                                Transactions that cannot be fully validated due to failures in other transactions will not contain an 'allowed' result.
                                
  {                             (json object)
    "txid" : "hex",             (string) The transaction hash in hex
    "package-error" : "str",    (string) Package validation error, if any (only possible if rawtxs had more than 1 transaction).
    "allowed" : true|false,     (boolean) Whether this tx would be accepted to the mempool and pass client-specified maxfeerate. If not present, the tx was not fully validated due to a failure in another tx in the list.
    "size" : n,                 (numeric) The transaction size
    "fees" : {                  (json object) Transaction fees (only present if 'allowed' is true)
      "base" : n                (numeric) transaction fee in XEC
    },
    "reject-reason" : "str"     (string) Rejection string (only present when 'allowed' is false)
  },
  ...
]

Examples:

Create a transaction
> bitcoin-cli createrawtransaction "[{\"txid\" : \"mytxid\",\"vout\":0}]" "{\"myaddress\":10000}"
Sign the transaction, and get back the hex
> bitcoin-cli signrawtransactionwithwallet "myhex"

Test acceptance of the transaction (signed hex)
> bitcoin-cli testmempoolaccept '["signedhex"]'

As a JSON-RPC call
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "testmempoolaccept", "params": [["signedhex"]]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/