Gas Manager Coverage API Quickstart

Gas Manager Coverage API enables your to programmatically create, update, and manage gas manager policies for your app. Gas manager policies define how and when you will sponsor your user’s gas fees.

Gas Manager Coverage API

📘

NOTE

Gas Manager Coverage API is currently in a Limited Private Beta phase. Access is restricted to a selected group of users who have been granted permission to test and provide feedback. The functionality and behavior of this method may change before the public release. Please note that availability, performance, and support are not guaranteed during this period.

If you are interested in receiving updates on this product, please sign up here. We will keep you informed as the product progresses and becomes more widely accessible. Thank you for your interest.

After adding policies and their rules in the admin UI, you can call the Gas Manager Coverage APIs on each new user operation (UO) to get a paymaster signature assuming your policy rules allow it. The alchemy_requestPaymasterAndData returns paymasterAndData field to include in the final UO.

📘

NOTE

  • You must call alchemy_requestPaymasterAndData with the Alchemy API KEY associated with the policy’s App.
  • Our Gas Manager Coverage API is limited to private beta. We’ll be supporting the latest entry point version (0.6)
  • We will be releasing on testnets to start. Supported testnets: Ethereum Goerli, Ethereum Sepolia, Arbitrum Goerli, Polygon Mumbai, Optimism Goerli.
  • We do plan on supporting all EVM chains that Alchemy supports in the near future ⚡️

Steps:

  • Create a policy using the Admin UI
  • Get supported entry points using: eth_supportedEntrypoints
  • For each user operation where a paymaster is needed to pay gas, call alchemy_requestPaymasterAndData with the user operation details, then include the returned paymasterAndData value in the final UO before submitting it to the bundler.

Endpoint: https://[evm-network].g.alchemy.com/v2/

Method: eth_supportedEntryPoints

📘

NOTE

Currently, we only support EntryPoint v0.6.0 at 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789

Returns supported EntryPoints by the Gas Manager service for a given chain. Network (and chain id) is inferred from the Alchemy endpoint (e.g. https://eth-sepolia.g.alchemy.com/v2/KEY)

Request schema

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_supportedEntryPoints"
}

Response schema

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": [0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789]
}

JSON-RPC Error Response

{
  "id": 1,
  "jsonrpc": "2.0",
  "error": {
    "code": int,
    "message": string,
      "data": object
  }
}

Method: alchemy_requestPaymasterAndData

Requests sponsorship for a UO. Returns paymasterAndData if approved, errors if not.

Request schema

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "alchemy_requestPaymasterAndData",
  "params": [{
        "policyId": "string",
        "entryPoint": "<address>",
        // Partial userOp: missing paymasterAndData, and signature
    "userOperation": {
            // Additional fields: chainId, sender nonce (for security)
            // All fields should be sent hex-encoded, with no leading zeros for type bytes and optional leading zeros for type uint256
            "sender": "<address>",
      "nonce": "<uint256>",
      "initCode": "<bytes>",
      "callData": "<bytes>",
      "callGasLimit": "<uint256>",
      "verificationGasLimit": "<uint256>",
      "preVerificationGas": "<uint256>",
      "maxFeePerGas": "<uint256>",
      "maxPriorityFeePerGas": "<uint256>"
        }
    }]
}

Response schema

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
        // The 0x-prefixed hex string for the user to put into the UO's paymasterAndData field. Contains:
    // From bytes [0:20] the paymaster contract address
    // From bytes [20:52] the sigTimeRange (bit-packed startTime, endTime, validity check as per 4337 spec). This should never be SIG_INVALID (1).
    // From bytes [52:116 or 117] the secp256k1 signature over the validation schema from the verifier key. Can be either 64 or 65 bytes in length.
    "paymasterAndData": "<bytes>"
  }
}