# getmempoolentry

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://bitcoin-mainnet.g.alchemy.com/v2/{apiKey}

Returns mempool data for a given transaction. The transaction must currently be in the mempool.


Reference: https://www.alchemy.com/docs/chains/bitcoin/bitcoin-api-endpoints/getmempoolentry

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| txid | string | Yes | The transaction ID to look up in the mempool. |

## Result

**result** (object): Mempool metadata for the specified transaction.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "getmempoolentry",
  "params": [
    "b86ae732473ff2c91c04073ec9cbef5e4ddaa701741e141e41345df72122b795"
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "vsize": 234,
    "weight": 936,
    "fee": 0.00001,
    "modifiedfee": 0.00001,
    "time": 1714400000,
    "height": 840000,
    "descendantcount": 1,
    "descendantsize": 234,
    "descendantfees": 1000,
    "ancestorcount": 1,
    "ancestorsize": 234,
    "ancestorfees": 1000,
    "wtxid": "b86ae732473ff2c91c04073ec9cbef5e4ddaa701741e141e41345df72122b795",
    "fees": {
      "base": 0.00001,
      "modified": 0.00001,
      "ancestor": 0.00001,
      "descendant": 0.00001
    },
    "depends": [],
    "spentby": [],
    "bip125-replaceable": true,
    "unbroadcast": false
  },
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://bitcoin-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getmempoolentry",
  "params": [
    "b86ae732473ff2c91c04073ec9cbef5e4ddaa701741e141e41345df72122b795"
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'getmempoolentry',
    params: ['b86ae732473ff2c91c04073ec9cbef5e4ddaa701741e141e41345df72122b795']
  })
};

fetch('https://bitcoin-mainnet.g.alchemy.com/v2/docs-demo', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://bitcoin-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getmempoolentry",
    "params": ["b86ae732473ff2c91c04073ec9cbef5e4ddaa701741e141e41345df72122b795"]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://bitcoin-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"getmempoolentry\",\n  \"params\": [\n    \"b86ae732473ff2c91c04073ec9cbef5e4ddaa701741e141e41345df72122b795\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://bitcoin-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"getmempoolentry\",\n  \"params\": [\n    \"b86ae732473ff2c91c04073ec9cbef5e4ddaa701741e141e41345df72122b795\"\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://bitcoin-mainnet.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"getmempoolentry\",\n  \"params\": [\n    \"b86ae732473ff2c91c04073ec9cbef5e4ddaa701741e141e41345df72122b795\"\n  ]\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## OpenRPC Method Specification

```yaml
name: getmempoolentry
summary: Get mempool entry for a transaction
description: |
  Returns mempool data for a given transaction. The transaction must currently be in the mempool.
x-compute-units: 10
params:
  - name: txid
    required: true
    description: The transaction ID to look up in the mempool.
    schema:
      title: Bitcoin Transaction ID
      type: string
      pattern: ^[a-fA-F0-9]{64}$
      description: A 64-character hex string identifying a transaction.
result:
  name: result
  description: Mempool metadata for the specified transaction.
  schema:
    type: object
    properties:
      vsize:
        type: integer
        description: Virtual transaction size as defined in BIP 141. Different from the actual serialized size for witness transactions, since witness data is discounted.
      weight:
        type: integer
        description: Transaction weight as defined in BIP 141.
      fee:
        type: number
        description: Transaction fee in BTC (deprecated; use `fees.base`).
      modifiedfee:
        type: number
        description: Transaction fee with fee deltas used for mining priority (deprecated; use `fees.modified`).
      time:
        type: integer
        description: UNIX timestamp when the transaction entered the mempool.
      height:
        type: integer
        description: Block height when the transaction entered the mempool.
      descendantcount:
        type: integer
        description: Number of in-mempool descendant transactions (including this one).
      descendantsize:
        type: integer
        description: Virtual transaction size of in-mempool descendants (including this one).
      descendantfees:
        type: number
        description: Modified fees of in-mempool descendants (including this one) (deprecated; use `fees.descendant`).
      ancestorcount:
        type: integer
        description: Number of in-mempool ancestor transactions (including this one).
      ancestorsize:
        type: integer
        description: Virtual transaction size of in-mempool ancestors (including this one).
      ancestorfees:
        type: number
        description: Modified fees of in-mempool ancestors (including this one) (deprecated; use `fees.ancestor`).
      wtxid:
        title: Bitcoin Transaction ID
        type: string
        pattern: ^[a-fA-F0-9]{64}$
        description: A 64-character hex string identifying a transaction.
      fees:
        type: object
        description: Detailed fee breakdown in BTC.
        properties:
          base:
            type: number
            description: Transaction fee in BTC.
          modified:
            type: number
            description: Transaction fee with fee deltas used for mining priority, in BTC.
          ancestor:
            type: number
            description: Modified fees of in-mempool ancestors (including this one), in BTC.
          descendant:
            type: number
            description: Modified fees of in-mempool descendants (including this one), in BTC.
      depends:
        type: array
        description: Unconfirmed transactions used as inputs for this transaction.
        items:
          title: Bitcoin Transaction ID
          type: string
          pattern: ^[a-fA-F0-9]{64}$
          description: A 64-character hex string identifying a transaction.
      spentby:
        type: array
        description: Unconfirmed transactions spending outputs from this transaction.
        items:
          title: Bitcoin Transaction ID
          type: string
          pattern: ^[a-fA-F0-9]{64}$
          description: A 64-character hex string identifying a transaction.
      bip125-replaceable:
        type: boolean
        description: Whether this transaction could be replaced due to BIP125 (replace-by-fee).
      unbroadcast:
        type: boolean
        description: Whether this transaction is currently unbroadcast (initial broadcast not yet acknowledged by any peers).
examples:
  - name: getmempoolentry example
    params:
      - name: txid
        value: b86ae732473ff2c91c04073ec9cbef5e4ddaa701741e141e41345df72122b795
    result:
      name: result
      value:
        vsize: 234
        weight: 936
        fee: 0.00001
        modifiedfee: 0.00001
        time: 1714400000
        height: 840000
        descendantcount: 1
        descendantsize: 234
        descendantfees: 1000
        ancestorcount: 1
        ancestorsize: 234
        ancestorfees: 1000
        wtxid: b86ae732473ff2c91c04073ec9cbef5e4ddaa701741e141e41345df72122b795
        fees:
          base: 0.00001
          modified: 0.00001
          ancestor: 0.00001
          descendant: 0.00001
        depends: []
        spentby: []
        bip125-replaceable: true
        unbroadcast: false
```
