# Boosted Sponsorships

Boosted Sponsorships make your sponsored user operations 34–43% faster end to end (see the [benchmarks](#benchmarks)) and cheaper in gas, without changes to your app logic. They skip the paymaster and gas price calls, so a user operation can be a single `eth_sendUserOperation` request.

:::info
Boosted Sponsorships are available upon request. To activate this feature, please contact us at support@pimlico.io
:::

## How do Boosted Sponsorships work?

Boosted user operations are sponsored user operations without paymaster data. This allows you to save on extra RPC calls and optimize the latency.

These are the RPC calls that are skipped:

* `pimlico_getUserOperationGasPrice` - we set the gas price to zero, read below for why.
* `pm_getPaymasterStubData` - since we don't have paymaster data, we don't need to call this.
* `pm_getPaymasterData` - since we don't have paymaster data, we don't need to call this.

optional:

* `eth_estimateUserOperationGas` - If your `callData` is predictable, you can hard code the gas limits and skip this call as well.

When you set `maxFeePerGas` and `maxPriorityFeePerGas` to zero, no balance is deducted from user operation's sender on chain. While we charge you off-chain at the end of the month when your bill gets generated. The charge is based on how much fees the bundler has to pay to include the user operation plus the paymaster surcharge for that user operation.

## How to send a Boosted User Operation

To send a Boosted User Operation, you only need to:

* Set `maxFeePerGas` and `maxPriorityFeePerGas` to zero
* Remove the `paymaster` and `paymasterData` fields

You won't need to make any changes to your application logic as the Boosted User Operation is sent using the standard eth\_sendUserOperation endpoint.

In the background, Pimlico will calculate the User Operation cost offchain based on the User Operation's `gasUsed` and the bundler's `gasPrice`.

### Code Example

```ts
import { createSmartAccountClient } from "permissionless"
import { toSimpleSmartAccount } from "permissionless/accounts"
import { http, createPublicClient, zeroAddress } from "viem"
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
import { sepolia } from "viem/chains"

const apiKey = "YOUR_PIMLICO_API_KEY"
const pimlicoUrl = `https://api.pimlico.io/v2/${chain.id}/rpc?apikey=${apiKey}`

const publicClient = createPublicClient({
    chain: sepolia,
    transport: http()
})

const account = await toSimpleSmartAccount({
    owner: privateKeyToAccount(generatePrivateKey()),
    client: publicClient
})

const pimlicoClient = createPimlicoClient({ // [!code --]
    chain: sepolia, // [!code --]
    transport: http(pimlicoUrl), // [!code --]
    entryPoint // [!code --]
}) // [!code --]

const smartAccount = createSmartAccountClient({
    bundlerTransport: http(pimlicoUrl),
    paymaster: pimlicoClient, // [!code --]
    account,
    chain: sepolia,
    userOperation: { // [!code ++]
        estimateFeesPerGas: async () => { // [!code ++]
            return { // [!code ++]
                maxFeePerGas: 0n, // [!code ++]
                maxPriorityFeePerGas: 0n // [!code ++]
            } // [!code ++]
        } // [!code ++]
    } // [!code ++]
})

// Send a mock transaction
const tx = await smartAccount.sendTransaction({
    to: zeroAddress,
    value: 0n
})

console.log(`Transaction included: https://sepolia.etherscan.io/tx/${tx}`)
```

## Further optimizations

For maximum performance, hardcode your gas limits if you know your User Operation's gas usage. This eliminates the gas estimation RPC call, reducing your entire transaction to a single `eth_sendUserOperation` request.

```ts
...

// Send a mock transaction with hardcoded gasLimits
const tx = await smartAccount.sendTransaction({
    to: zeroAddress,
    value: 0n,
    callGasLimit: 250_000n,
    verificationGasLimit: 250_000n,
    preVerificationGas: 0n
})
```

:::info
* Set `preVerificationGas` to 0 as the bundler skips this check for Boosted User Operations
* Don't set gas limits too high - the bundler will reject operations that exceed the block gas limit
:::

## Benchmarks

| Chain | % faster | Avg. ms saved | Standard latency (ms) | Boosted latency (ms) |
|-------|---------:|--------------:|----------------------:|----------------------:|
| OP Mainnet | 42.27% | 2,524.22 ms | 5,971.89 ms | 3,447.67 ms |
| Base Sepolia | 43.15% | 3,216.54 ms | 7,454.20 ms | 4,237.65 ms |
| Base | 39.23% | 2,662.73 ms | 6,786.65 ms | 4,123.93 ms |
| Arbitrum One | 33.93% | 2,799.35 ms | 8,250.12 ms | 5,450.78 ms |
| Arbitrum Sepolia | 41.88% | 3,881.81 ms | 9,267.81 ms | 5,386.01 ms |
| Sepolia | 34.74% | 5,396.30 ms | 15,535.38 ms | 10,139.09 ms |

*Benchmarks were collected by sending 100 simple ETH-transfer user operations per chain and comparing end-to-end latency between a standard sponsored flow and the Boosted flow. Real-world performance will vary depending on network conditions and callData complexity.*
