# testmempoolaccept

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.

### Argument #1 - rawtxs

**Type:** json array, required

An array of hex strings of raw transactions.

Length must be one for now.

```
[
  "rawtx",    (string)
  ...
]
```

### Argument #2 - maxfeerate

**Type:** numeric or string, optional, default=0.10

Reject transactions whose fee rate is higher than the specified value, expressed in BTC/kB

**Result**

```
[                               (json array) The result of the mempool acceptance test for each raw transaction in the input array.
                                Length is exactly one for now.
  {                             (json object)
    "txid" : "hex",             (string) The transaction hash in hex
    "allowed" : true|false,     (boolean) If the mempool allows this tx to be inserted
    "vsize" : n,                (numeric) Virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted (only present when 'allowed' is true)
    "fees" : {                  (json object) Transaction fees (only present if 'allowed' is true)
      "base" : n                (numeric) transaction fee in BTC
    },
    "reject-reason" : "str"     (string) Rejection string (only present when 'allowed' is false)
  },
  ...
]
```

**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 --location --request POST 'https://btc.api.watchdata.io/node/jsonrpc?api_key=your_api_key' \
--header 'x-api-key: your_api_key' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "testmempoolaccept",
    "params": [
        [
            "signedhex"
        ]
    ]
}'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.watchdata.io/blockchain-apis/bitcoin-api/rawtransactions-rpcs/testmempoolaccept.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
