Skip to content

testmempoolaccept JSON-RPC command

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

Returns result of mempool acceptance tests indicating if raw transaction (serialized, hex-encoded) would be accepted by mempool.This checks if the transaction violates the consensus or policy rules. See sendrawtransaction call.

Arguments

1. rawtxs (json array, required) An array of hex strings of raw transactions. Array length must be exactly one for now. [ "rawtx", (string) Serialized transaction hex ... ] 2. allowhighfees (boolean, optional, default=false) Allow high fees

Result

[ (array) The result of the mempool acceptance test for each raw transaction in the input array. Length is exactly one for now. { "txid" (string) The transaction hash in hex "allowed" (boolean) If the mempool allows this tx to be inserted "size" (numeric, optional) Serialized byte size of the tx (only present when 'allowed' is true) "vsize" (numeric, optional) "Size" of the tx for the purposes of fee calculations. Often the same as 'size' but may be larger for sigcheck-dense txs (only present when 'allowed' is true). "fees" : { (json object, optional) Transaction fee information (only present if 'allowed' is true) "base" (numeric) Transaction fee in BCH "effective-feerate" (numeric) The effective feerate in BCH per KvB. May differ from the base feerate if there are modified fees from prioritisetransaction and/or 'vsize' > 'size'. } "reject-reason" (string, optional) Rejection string (only present when 'allowed' is false) "reject-details" (string, optional) Rejection details (only present when 'allowed' is false and rejection details exist) } ]

Examples

``` Create a transaction

bitcoin-cli createrawtransaction '[{"txid" : "mytxid","vout":0}]" "{"myaddress":0.01}' 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/ ```


Bitcoin Cash Node Daemon version v29.0.1-71febb2

Documentation on docs.bitcoincashnode.org reflects the current master branch in Git, and may include API changes that are not yet present in the latest release.