# Keepers profitability

**URL:** <https://gov.yearn.fi/t/keepers-profitability/7409>\
**Category:** Keep3r\
**Created:** [31 October 2020 19:49 UTC](https://gov.yearn.fi/t/keepers-profitability/7409 "2020-10-31T19:49:44Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![yEtienne](https://dub1.discourse-cdn.com/flex013/user_avatar/gov.yearn.fi/yetienne/32/2069_2.png) [@yEtienne](https://gov.yearn.fi/u/yEtienne)\
**Post date:** [31 October 2020 19:49 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/1 "2020-10-31T19:49:44Z")

</div>

Hey,

I’ve been runing a Keeper for several hours now. First, I must say that keep3r.network is an awesome creation. Thank you @andre.cronje !

Nonetheless, It is currently quite complicated to run a profitable keeper because of the way we are rewarded.The incentive layer must be improved.

**Increase keepers premium**  
I’m quite sure that projects willing to delegate these tasks to keepers will be willing to pay way more than the current price, especially with the safety that comes with the multiplicity of keepers running on their behalf, to support their respective networks. Prices should be raised.

**Avoid gas war**  
My second concern is related to front-running bots. With the current system, we will end up with bots taking a ridiculus profit by estimating the perfect gas expense by transaction - and most of the value added provided by the protocol will be granted to ethereum miners/stakers. A solution would be to share the premium of a successfull transaction with all the other keepers. I’m not going into the details as i don’t have all the answers, but it’s definitely something that might help.

Otherwise, excellent job. The future is bright !

---

<div class="post-metadata">

**Author:** ![andre.cronje](https://dub1.discourse-cdn.com/flex013/user_avatar/gov.yearn.fi/andre.cronje/32/2283_2.png) [@andre.cronje](https://gov.yearn.fi/u/andre.cronje)\
**Post date:** [1 November 2020 06:28 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/2 "2020-11-01T06:28:01Z")

</div>

Agreed on both. Busy working on a new increased reward mechanism based on bond. The gas war one is a bit more tricky, since you don’t want to reward idle keepers (then you are just promoting rent seeking behavior). I don’t have any current proposed solutions for it unfortunately, but definitely a good discussion to start!

Will deploy a new Keep3rV1Helper candidate and release here so we can discuss.

---

<div class="post-metadata">

**Author:** ![andre.cronje](https://dub1.discourse-cdn.com/flex013/user_avatar/gov.yearn.fi/andre.cronje/32/2283_2.png) [@andre.cronje](https://gov.yearn.fi/u/andre.cronje)\
**Post date:** [1 November 2020 09:12 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/3 "2020-11-01T09:12:06Z")

</div>

Released a new Keep3rV1Helper candidate;

This will distribute rewards between 1.0 and 2.5 based on how much KP3R you have bonded up to the maximum at 2.5 at 100 KP3R.

As soon as the new Keep3rV1Oracle is out then we can integrate that to do ETH gas price adjustments as well, so this is an interim proposal.

> <https://github.com/keep3r-network/keep3r.network/blob/master/contracts/Keep3rV1Helper.sol#L239>

---

<div class="post-metadata">

**Author:** ![DanceAnt](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@DanceAnt](https://gov.yearn.fi/u/DanceAnt)\
**Post date:** [1 November 2020 10:11 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/4 "2020-11-01T10:11:10Z")

</div>

Great idea, so just confirming that this means if keeper work for a job, then the reward given to them is base on the amount of KP3R they bonded and the gas fee. Is that correct?

---

<div class="post-metadata">

**Author:** ![andre.cronje](https://dub1.discourse-cdn.com/flex013/user_avatar/gov.yearn.fi/andre.cronje/32/2283_2.png) [@andre.cronje](https://gov.yearn.fi/u/andre.cronje)\
**Post date:** [1 November 2020 10:28 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/5 "2020-11-01T10:28:46Z")

</div>

The proposed formula is as follows (until Keep3rV1Oracle is active);

1. Calculate gas cost (`gasUsed` in wei \* `fastGas` price) =: `min`
2. Calculate boosted value; `min * 2.5` =: `boost`
3. Calculate bonded amount; `Math.min(bond[KP3R], 100 KP3R)` =: `bonded`
4. Calculate bonded boost; `boost * bonded / 100 KP3R` =: `max`
5. Calculate `KP3R` amount `Math.max(min, max)`

So looking at a practical example with the following variables;

-Example 1-

`gasUsed = 100,000`  
`fastGas = 40`  
`bonded = 10`

`min = 100,000 * 40 = 4,000,000`  
`boost = min * 2.5 = 4,000,000 * 2.5 = 10,000,000`  
`bonded = Math.min(10, 100) = 10`  
`max = boost * bonded / 100 = 10,000,000 * 10 / 100 = 1,000,000`  
`KP3R = Math.max(min, max) = Math.max(4,000,000, 1,000,000) = 4,000,000`

-Example 2-

`gasUsed = 100,000`  
`fastGas = 40`  
`bonded = 50`

`min = 100,000 * 40 = 4,000,000`  
`boost = min * 2.5 = 4,000,000 * 2.5 = 10,000,000`  
`bonded = Math.min(50, 100) = 50`  
`max = boost * bonded / 100 = 10,000,000 * 50 / 100 = 5,000,000`  
`KP3R = Math.max(min, max) = Math.max(4,000,000, 5,000,000) = 5,000,000`

-Example 3-

`gasUsed = 100,000`  
`fastGas = 40`  
`bonded = 100`

`min = 100,000 * 40 = 4,000,000`  
`boost = min * 2.5 = 4,000,000 * 2.5 = 10,000,000`  
`bonded = Math.min(100, 100) = 100`  
`max = boost * bonded / 100 = 10,000,000 * 100 / 100 = 10,000,000`  
`KP3R = Math.max(min, max) = Math.max(4,000,000, 10,000,000) = 10,000,000`

Hope that helps

---

<div class="post-metadata">

**Author:** ![DanceAnt](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@DanceAnt](https://gov.yearn.fi/u/DanceAnt)\
**Post date:** [1 November 2020 10:34 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/6 "2020-11-01T10:34:50Z")

</div>

Thank you! That is some clear method explanation.

---

<div class="post-metadata">

**Author:** ![n1ck](https://avatars.discourse-cdn.com/v4/letter/n/ba9def/32.png) [@n1ck](https://gov.yearn.fi/u/n1ck)\
**Post date:** [1 November 2020 21:55 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/8 "2020-11-01T21:55:17Z")

</div>

wouldnt that start a gas war?

---

<div class="post-metadata">

**Author:** ![andre.cronje](https://dub1.discourse-cdn.com/flex013/user_avatar/gov.yearn.fi/andre.cronje/32/2283_2.png) [@andre.cronje](https://gov.yearn.fi/u/andre.cronje)\
**Post date:** [2 November 2020 05:25 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/9 "2020-11-02T05:25:10Z")

</div>

Competition is unavoidable. That’s why rewards are capped at FASTGAS

---

<div class="post-metadata">

**Author:** ![kx9x](https://dub1.discourse-cdn.com/flex013/user_avatar/gov.yearn.fi/kx9x/32/2308_2.png) [@kx9x](https://gov.yearn.fi/u/kx9x)\
**Post date:** [2 November 2020 05:54 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/10 "2020-11-02T05:54:05Z")

</div>

I have been brainstorming some ideas that might prevent gas wars. I can make a forum post later once I gathered my thoughts, but the main idea I have been pondering is a job that allows K3PRs that perform the job first to become the only K3PR able to perform that job for at least some time.

Once a K3PR becomes a privileged K3PR, the job can define an uptime, and if a job isn’t completed within an appropriate time, the current privileged K3PR can be banned for a time and the next K3PR to perform the job can be given a bonus for noticing that the job went past its SLA and filling in for the dedicated K3PR that failed its promise to perform the job in a timely fashion.

The job implementing this spec could also limit how long a K3PR can be privileged and implement rewards that trail off or ramp up depending on how they want to incentivize.

The idea is that you would not have a gas war while a K3PR is privileged. The only gas war might start if a privileged K3PR goes down and a bunch of K3PRs want to be the next dedicated one. But I feel like that kind of gas war might be fine. The one willing to spend the most gas might be showing that they are willing to recoup that one-time cost to become privileged by not missing jobs.

I’ll split this into its own post once I solidify my thoughts and perhaps I can provide a proof-of-concept implementation.

---

<div class="post-metadata">

**Author:** ![KALEB](https://avatars.discourse-cdn.com/v4/letter/k/e480ec/32.png) [@KALEB](https://gov.yearn.fi/u/KALEB)\
**Post date:** [2 November 2020 08:27 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/11 "2020-11-02T08:27:59Z")

</div>

> [@yEtienne](#):
>
> My second concern is related to front-running bots. With the current system, we will end up with bots taking a ridiculus profit by estimating the perfect gas expense by transaction - and most of the value added provided by the protocol will be granted to ethereum miners/stakers. A solution would be to share the premium of a successfull transaction with all the other keepers. I’m not going into the details as i don’t have all the answers, but it’s definitely something that might help.

If you put in place any limitation on the gas price that can be paid by a keeper… then you risk killing kp3r system all together, as bots that don’t follow the gas price constraints of kp3r will front run kp3r bots… The only solution to that is forcing projects to adopt kp3r as the only keeper, which is kind of a stretch and I’m sure not possible… In other words gas wars can’t be avoided without increasing dependency on kp3r.

---

<div class="post-metadata">

**Author:** ![bhargav](https://avatars.discourse-cdn.com/v4/letter/b/dfb087/32.png) [@bhargav](https://gov.yearn.fi/u/bhargav)\
**Post date:** [2 November 2020 08:45 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/12 "2020-11-02T08:45:19Z")

</div>

Simply put the current Keeper rewards proposed by @andre.cronje will be as below:

If Bonded KP3R is \<=40: Reward Multiple is 1.  
If Bonded KP3R is \> 40 & \<=100: Reward multiple is: (Bonded KP3R)/40  
If Bonded KP3R is \> 100: Reward multiple is 2.5

So if 50 KP3R is bonded:  
Reward multiple is 50/40 = 1.25  
i.e if the gas cost is 4.000,000: Reward is 4,000,000\*1.25: 5,000,000

With current KP3R price at ~$200, anyone with less than $8000 (40\*200) bonded doesn’t earn any premium.

---

<div class="post-metadata">

**Author:** ![carton.rouge](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@carton.rouge](https://gov.yearn.fi/u/carton.rouge)\
**Post date:** [2 November 2020 09:41 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/13 "2020-11-02T09:41:55Z")

</div>

Why not using the deviation between `tx.gasprice` and the Oracle’s `fastGas` ; so that using higher gas prices would result in less rewards?

---

<div class="post-metadata">

**Author:** ![andre.cronje](https://dub1.discourse-cdn.com/flex013/user_avatar/gov.yearn.fi/andre.cronje/32/2283_2.png) [@andre.cronje](https://gov.yearn.fi/u/andre.cronje)\
**Post date:** [2 November 2020 09:58 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/14 "2020-11-02T09:58:43Z")

</div>

The cap is to stop gas front-running & gas wars. Otherwise someone could just say gasprice = 999999 and get rewarded for all the jobs Keep3r credit.

---

<div class="post-metadata">

**Author:** ![n1ck](https://avatars.discourse-cdn.com/v4/letter/n/ba9def/32.png) [@n1ck](https://gov.yearn.fi/u/n1ck)\
**Post date:** [2 November 2020 12:32 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/15 "2020-11-02T12:32:36Z")

</div>

that means whoever got less than 40 bonded is losing money.

- by doing jobs lose because gas fees \> reward
- by not doing jobs, for being inactive.

---

<div class="post-metadata">

**Author:** ![facendra](https://avatars.discourse-cdn.com/v4/letter/f/d6d6ee/32.png) [@facendra](https://gov.yearn.fi/u/facendra)\
**Post date:** [2 November 2020 14:36 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/16 "2020-11-02T14:36:07Z")

</div>

I only have 6 kp3r, because they do not design something attractive for those who have my situation the same

---

<div class="post-metadata">

**Author:** ![KALEB](https://avatars.discourse-cdn.com/v4/letter/k/e480ec/32.png) [@KALEB](https://gov.yearn.fi/u/KALEB)\
**Post date:** [2 November 2020 20:48 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/18 "2020-11-02T20:48:23Z")

</div>

well the point is to have not too many keepers (otherwise the chance of hit is too low) and not too few (otherwise the chance of anyone participating is too low)

---

<div class="post-metadata">

**Author:** ![kenny](https://avatars.discourse-cdn.com/v4/letter/k/90db22/32.png) [@kenny](https://gov.yearn.fi/u/kenny)\
**Post date:** [2 November 2020 22:55 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/19 "2020-11-02T22:55:27Z")

</div>

Congratulations on Keep3r project it,s great to have Andre Cronje on the Yearn.Finance community forum

---

<div class="post-metadata">

**Author:** ![kx9x](https://dub1.discourse-cdn.com/flex013/user_avatar/gov.yearn.fi/kx9x/32/2308_2.png) [@kx9x](https://gov.yearn.fi/u/kx9x)\
**Post date:** [5 November 2020 15:48 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/20 "2020-11-05T15:48:37Z")

</div>

By the way, why does the deployed helper end up multiplying by PRICE which is set to 10?

The proposal and latest github commit shows this code snippet:

> function getQuoteLimitFor(address origin, uint gasUsed) public view returns (uint) {  
> uint \_min = gasUsed.mul(uint(FASTGAS.latestAnswer()));  
> uint \_boost = \_min.mul(BOOST).div(BASE); // increase by 2.5  
> uint \_bond = Math.min(bonds(origin), TARGETBOND);  
> return Math.max(\_min, \_boost.mul(\_bond).div(TARGETBOND));  
> }

But this is the [deployed](https://etherscan.io/address/0x1530a2924805aed2385f8b91849cab7fe95a5df9#code) one:

> uint constant public PRICE = 10;  
> function getQuoteLimitFor(address origin, uint gasUsed) public view returns (uint) {  
> uint \_min = gasUsed.mul(PRICE).mul(uint(FASTGAS.latestAnswer()));  
> uint \_boost = \_min.mul(BOOST).div(BASE); // increase by 2.5  
> uint \_bond = Math.min(bonds(origin), TARGETBOND);  
> return Math.max(\_min, \_boost.mul(\_bond).div(TARGETBOND));  
> }

Is this why txs with really high gas prices are netting so much reward? See this one for example: [Ethtx.info Analysis](https://ethtx.info/mainnet/0x449b6510f30ccf171664fb7395f3c9135f1a3f7312ec1030a1471a48a7d9aef5)

The gas oracle return 95 gwei, but the keep3r used 129.06 as a price and still made 0.998 KP3R ($121.38) on a tx fee of 0.1502 Eth (129.06 Gwei, 1,163,980 used). This KP3R also has a small bond, so it gets the min amount.

Is this because the helper doesn’t use the Uniswap oracle to find the price of KP3R yet?

I couldn’t find in the code where a ratio of Eth to KP3R is determined, except it seems as if the ratio of ETH to KP3R is currently hardcoded as 10:1 with that PRICE variable.

---

<div class="post-metadata">

**Author:** ![andre.cronje](https://dub1.discourse-cdn.com/flex013/user_avatar/gov.yearn.fi/andre.cronje/32/2283_2.png) [@andre.cronje](https://gov.yearn.fi/u/andre.cronje)\
**Post date:** [5 November 2020 15:51 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/21 "2020-11-05T15:51:13Z")

</div>

Until [uniquote](http://feeds.uniquote.finance/) has enough data points the ratio is fixed at 10:1, will propose a new helper tomorrow.

---

<div class="post-metadata">

**Author:** ![kx9x](https://dub1.discourse-cdn.com/flex013/user_avatar/gov.yearn.fi/kx9x/32/2308_2.png) [@kx9x](https://gov.yearn.fi/u/kx9x)\
**Post date:** [5 November 2020 16:10 UTC](https://gov.yearn.fi/t/keepers-profitability/7409/22 "2020-11-05T16:10:54Z")

</div>

Gotcha, makes sense to me. I figured Uniquote would be the natural choice for price determination in the helper. Thanks for the update!

[Next page](https://gov.yearn.fi/t/keepers-profitability/7409.md?page=2)
