Only 10.21% of bundlers are currently profitable, with the majority yet to surpass $10 in profit. This profitability largely hinges on gas prices.

In this post, we will explore the different gas parameters in ERC-4337 and examine how bundlers can generate earnings, using two sample transactions as case studies.

According to the Development of 4337 report published by SixDegree in September 2023, only 10.21% of bundlers have earned more than $10.

**Introduction**

ERC-4337 introduced several new gas parameters that can be complex to understand. To fully grasp these, one must delve into the entrypoint smart contract code and bundler implementations to see how these values affect transaction processing and profitability. This post aims to clarify the meaning and purpose of these gas parameters as they relate to User Operations (UserOps) and their impact on blockchain transactions and bundler earnings.

We will analyze two bundles (or transactions) on the Ethereum mainnet, using them as examples to illustrate these concepts. These two bundles were chosen because one contains a single UserOperation, while the other includes two.

**Defining Gas Parameters**

To better understand how costs are calculated at both the UserOperation and Bundle levels, let's define the key gas parameters:

**UserOp Level:**The values from the UserOperation input or the UserOperation event log provide sufficient information.**Bundle Level:**Requires values from the TransactionInput and TransactionReceipt.

It might be challenging to grasp the differences between these levels right now, but don't worry. In the next section, we will use actual values from on-chain UserOps and Bundles to demonstrate the effects of these parameters.

**UserOperation Related Fields**

These impact the processing of an individual UserOperation and the gas fee paid for its execution.

**Special Common Fields**

These impact the gas fee calculation at UserOperation as well as Bundle/Transaction Level.

**Bundle/Transaction Level Fields**

These impact the processing of the entire transaction representing a Bundle and the gas fee paid for its execution by the bundler, irrespective of what is charged to the individual wallet owner.

**Fees in Sample Bundles and UserOperations**

Let’s take two sample transactions and see what the Wallet Owners were charged, what the bundler paid as *Gas Fee,* and the net profit (or loss) for the bundler.

**Transaction 1: Bundle with 1 UserOperation**

The links to further explore the transaction/UserOperation details are:

UserOperation on JiffyScan

Bundle on JiffyScan

Transaction on Etherscan

First Let’s Show all the values. Then we show the fees paid and the bundler markup.

**UserOperation Level Fields**

**Common Fields**

**Bundle Level Fields**

**Fee & Markup Calculations**

A few observations we should make from the above data:

**Gas Units Markup:**The*gas consumed by the UserOp*(`G1 = 107,648 Gas Units`

) is higher than the*gas consumed in the transaction*(`K1 = 102,924 Gas Units`

). This is because the*UserOperation*gas calculation adds the fixed*preVerificationGas*(`C1`

) value to the actual consumption, to account for the parts that can't be calculated. Thus, ~`4.589%`

extra*Gas Units*were charged. In a perfect bundler, this value is zero.**Gas Price Paid by the Wallet Owner:**The wallet owner paid*gas fee*(`F1`

)/*gas used*(`G1`

) =`2,103,274,083,204,352 / 107,648`

=`19,538,440,874 wei/Gas`

. This value is exactly equal to*baseFee for the block*(`H1`

) +*priority fee for the bundler*(`E1`

), which is how it's calculated in the smart contract. Thus`F1/G1 = H1+E1`

or`F1 = (H1+E1) * G1`

.**Effective Gas Price:**Similar to the*Gas Price*paid by the wallet owner, the gas price for the*Bundle*is the sum of the*base fee for the block*(`H1`

) and the*priority for the validator*(`J1`

). Thus`L1 = H1 + J1`

.**Bundler Gas Fee Markup:**Now, since the two gas costs are different, the bundler charged a markup of`(H1+E1)/(H1+J1)`

=`19,538,440,874/19,532,149,368 = 1.0003221102748`

or`0.032%`

markup. So did the bundler make only 0.032% profit? Not quite!**Fee paid by Wallet Owner:**As shown in`F1`

, the wallet owner was charged a total of`0.002103274083204352 ETH`

, which is approximately`3.527 USD`

as per the ETH price on that day.**Fee paid by Bundler:**This is essentially the*total gas consumed*(`K1`

) **price per gas*(`L1`

) =`102,924 * 19,532,149,368 = 0.002010326941552032 ETH`

, approximately`$3.34`

as per the ETH price on that day.**Bundler Markup:**This is the ratio of the last two values:`0.002103274083204352 ETH`

/`0.002010326941552032 ETH`

=`1.04623483859`

or ~`4.62%`

profit.

Thus even though the bundler charged only a `0.032%`

the markup on the actual Gas Price paid, as there were additional gas units, the net markup was ~`4.62%`

. (The net ratio can be calculated as `(G1/K1)*((H1+E1)/(H1+J1))`

). When this value is greater than 1, the bundler makes a profit, or else a loss.

Let’s see how to calculate these values in case of more than 1 *UserOperation* in a bundle.

**Transaction 2: Bundle with 2 UserOperation**

The links to further explore the transaction/UserOperation details are:

UserOperation 1 on JiffyScan

UserOperation 2 on JiffyScan

Bundle on JiffyScan

Transaction on Etherscan

**UserOperation Level Fields**

**Common Fields**

**Bundle Level Fields**

**Fee & Markup Calculations**

Let’s see how the values discussed before change when there are multiple *UserOperations* in the *Bundle*:

**Gas Units Markup**: The*gas consumed by the UserOps*to calculate the markup is the sum of the two values (`G2_1 + G2_2 = 112,763 + 236,999 = 349,762 Gas Units`

). The*gas consumed in the transaction*(`K2 = 346,938 Gas Units`

). The gas Units Markup is`349,762/346,938 = 1.008139782901`

or ~`0.814%`

. Less than a fifth of the previous bundle.**Gas Price Paid by the Wallet Owner:**The wallet owners paid`F2_1/G2_1 = 818,160,397,184,746 / 112,763`

and`F2_2/G2_2 = 1,719,564,005,679,058 / 236,999`

. Here both result in`7,255,574,942 wei/Gas`

, since the priority fee`E2_1`

and`E2_2`

is the same. In the future, a bundler could provide different values to different UserOps to be competitive. As previously, this value is equal to the sum of the*base fee for the block*(`H2`

) and`priority fee to bundler`

(`B2`

).**Effective Gas Price:**Similar to the*Gas price*by the wallet, the gas price for the*Bundle*is the sum of the*base fee for the block*(`H2`

) and the*priority for the validator*(`J2`

). Thus`L2 = H2 + J2`

.**Bundler Gas Fee Markup:**Now, since the*priority fee*for both the*UserOperations*is the same, the bundler charged a markup of`(H2+E2)/(H2+J2)`

=`(5,755,574,942+1,500,000,000)/(5,855,574,942) = 1.2390883925`

or a massive`23.908%`

markup. If the priority fees for the UserOperations were different, then you would have to do a weighted average of the gas units consumed by each to get the effective gas markup, or calculate per UserOperation gas markup and do a weighted average in the overall markup calculation.**Fee paid by Wallet Owner:**As shown in`F2_1`

and`F2_2`

, the wallet owners were charged a total of`0.000818160397184746 ETH`

and`0.001719564005679058 ETH`

, adding to`0.002537724402863804`

, which is approximately`4.176 USD`

as per the ETH price on that day.**Fee paid by Bundler:**The*total gas consumed*(`K2`

) **price per gas*(`L2`

) =`346,938 * 5,855,574,942 = 0.002031521459227596 ETH`

, approximately`$3.34`

as per the ETH price on that day.**Bundler Markup:**This is the ratio of the last two values:`0.002537724402863804/0.002031521459227596 = 1.249174303`

or ~`24.917%`

profit.

Thus the bundler charged a markup of `0.814%`

on the Gas units and ~`23.908%`

on the gas price. The net profit was a sweet `24.917%`

.

**What’s Next**

Check out a couple of Bundles, UserOperations, and their fees on JiffyLabs to distill the information.

Want to help build or use a low-cost bundler for wallet owners, or explore Account Abstraction-based blockchain usage? Get in Touch!

Note: If you need real-time data on 4337, do check out our leading API.

We will be releasing more deep dives, walkthroughs, and quickstart tutorials for 4337 regularly in the coming weeks. Follow on JiffyLabs to stay updated.