# rundler_getUserOperationGasPrice

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

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

Returns gas price recommendations for setting fees in your user operations. The response includes current required fees and suggested fees with buffers for faster inclusion.


Reference: https://www.alchemy.com/docs/wallets/api-reference/bundler-api/bundler-api-endpoints/rundler-get-user-operation-gas-price

## Result

**Gas price recommendation** (object): Gas price recommendation containing current fees and suggested fees with buffers.

## Example

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "currentPriorityFee": "0x59682f00",
    "baseFee": "0x165a0bc00",
    "blockNumber": "0x12a3b4c",
    "suggested": {
      "maxPriorityFeePerGas": "0x746a5280",
      "maxFeePerGas": "0x28CDB6C80"
    }
  },
  "id": 1
}
```

## Code Examples

### cURL

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

### JavaScript

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

fetch('https://eth-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://eth-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "rundler_getUserOperationGasPrice"
}
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://eth-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"rundler_getUserOperationGasPrice\"\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://eth-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"rundler_getUserOperationGasPrice\"\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://eth-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\": \"rundler_getUserOperationGasPrice\"\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: rundler_getUserOperationGasPrice
description: |
  Returns gas price recommendations for setting fees in your user operations. The response includes current required fees and suggested fees with buffers for faster inclusion.
params: []
result:
  name: Gas price recommendation
  description: Gas price recommendation containing current fees and suggested fees with buffers.
  schema:
    type: object
    required:
      - currentPriorityFee
      - baseFee
      - blockNumber
      - suggested
    properties:
      currentPriorityFee:
        type: string
        description: The current minimum priority fee required by the bundler (same as `rundler_maxPriorityFeePerGas`).
      baseFee:
        type: string
        description: The current pending base fee for the next block (without bundler overhead).
      blockNumber:
        type: string
        description: The block number this estimate is based on.
      suggested:
        type: object
        description: Suggested fees with configurable buffers for faster inclusion.
        required:
          - maxPriorityFeePerGas
          - maxFeePerGas
        properties:
          maxPriorityFeePerGas:
            type: string
            description: Priority fee with buffer above the current minimum (default 30% buffer).
          maxFeePerGas:
            type: string
            description: Bundler-inflated base fee with buffer plus suggested priority fee (default 50% base fee buffer).
examples:
  - name: rundler_getUserOperationGasPrice example
    params: []
    result:
      name: Gas price recommendation
      value:
        currentPriorityFee: '0x59682f00'
        baseFee: '0x165a0bc00'
        blockNumber: '0x12a3b4c'
        suggested:
          maxPriorityFeePerGas: '0x746a5280'
          maxFeePerGas: '0x28CDB6C80'
```
