# getrawmempool

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

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

Returns either a list of transaction IDs currently in the mempool or detailed metadata for each transaction, depending on the verbosity level.


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

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| verbose | boolean | No | If true, returns detailed info per transaction. If false, returns a list of txids.  |
| mempool_sequence | boolean | No | When verbose is false, includes mempool sequence number in the response.  |

## Result

**result** (object): Mempool data depending on verbosity level.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "getrawmempool",
  "params": [
    false,
    false
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "txids": [
      "5f10285c6fee80d1982df9893742d0c5aed5aa4fcca3aa4331d7fa071ba4d5ce",
      "30ad6eacfc8b83de7b91f8df705e081945c9d8a7a05506de38a1842dd856550b"
    ],
    "mempool_sequence": 1386211
  },
  "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": "getrawmempool",
  "params": [
    false,
    false
  ]
}'
```

### JavaScript

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

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": "getrawmempool",
    "params": [False, False]
}
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\": \"getrawmempool\",\n  \"params\": [\n    false,\n    false\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\": \"getrawmempool\",\n  \"params\": [\n    false,\n    false\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\": \"getrawmempool\",\n  \"params\": [\n    false,\n    false\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: getrawmempool
summary: Get raw mempool transaction data
description: |
  Returns either a list of transaction IDs currently in the mempool or detailed metadata for each transaction, depending on the verbosity level.
params:
  - name: verbose
    required: false
    description: |
      If true, returns detailed info per transaction. If false, returns a list of txids.
    schema:
      type: boolean
      default: false
  - name: mempool_sequence
    required: false
    description: |
      When verbose is false, includes mempool sequence number in the response.
    schema:
      type: boolean
      default: false
result:
  name: result
  description: Mempool data depending on verbosity level.
  schema:
    oneOf:
      - type: object
        required:
          - txids
          - mempool_sequence
        properties:
          txids:
            type: array
            description: List of transaction IDs in the mempool.
            items:
              title: Bitcoin Transaction ID
              type: string
              pattern: ^[a-fA-F0-9]{64}$
              description: A 64-character hex string identifying a transaction.
          mempool_sequence:
            type: integer
            description: The mempool sequence number.
      - type: object
        description: Map of txid to transaction metadata when verbose is true.
        additionalProperties:
          type: object
          properties:
            vsize:
              type: integer
              description: Virtual transaction size (vbytes).
            weight:
              type: integer
              description: Transaction weight as defined in BIP 141.
            time:
              type: integer
              description: UNIX timestamp when transaction entered mempool.
            height:
              type: integer
              description: Block height when the transaction entered mempool.
            descendantcount:
              type: integer
            descendantsize:
              type: integer
            ancestorcount:
              type: integer
            ancestorsize:
              type: integer
            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
              properties:
                base:
                  type: number
                modified:
                  type: number
                ancestor:
                  type: number
                descendant:
                  type: number
            depends:
              type: array
              items:
                type: string
            spentby:
              type: array
              items:
                type: string
            bip125-replaceable:
              type: boolean
            unbroadcast:
              type: boolean
examples:
  - name: getrawmempool simple list
    params:
      - name: verbose
        value: false
      - name: mempool_sequence
        value: false
    result:
      name: result
      value:
        txids:
          - 5f10285c6fee80d1982df9893742d0c5aed5aa4fcca3aa4331d7fa071ba4d5ce
          - 30ad6eacfc8b83de7b91f8df705e081945c9d8a7a05506de38a1842dd856550b
        mempool_sequence: 1386211
  - name: getrawmempool with verbose true
    params:
      - name: verbose
        value: true
    result:
      name: result
      value:
        5f10285c6fee80d1982df9893742d0c5aed5aa4fcca3aa4331d7fa071ba4d5ce:
          vsize: 234
          weight: 936
          time: 1714400000
          height: 840000
          descendantcount: 2
          descendantsize: 480
          ancestorcount: 1
          ancestorsize: 234
          wtxid: 5f10285c6fee80d1982df9893742d0c5aed5aa4fcca3aa4331d7fa071ba4d5ce
          fees:
            base: 0.0001
            modified: 0.0001
            ancestor: 0.0001
            descendant: 0.0002
          depends: []
          spentby: []
          bip125-replaceable: true
          unbroadcast: false
```
