Avalanche goes its own way
If you are going to move your ETH/BSC farm to Avalanche, read this post carefully.
The average time to generate a block is different on ETH/BSC compared with Avalanche.
There was an interesting thread on Twitter by Yield Yak
Coming from chains like ETH, devs are used to relying on block times. There is a significant cost to make blocks. There are mechanisms to produce blocks at certain frequencies. And they are reliable
It is dangerous to make similar assumptions on Avalanche.
This gave us some food for thought because we already created a farm that produces 1 Olive per block here on Avalanche. Our Master Chef contract is immutable and we can’t change the minting rate of Olive token. We worked on the basis that a block is produced every 3–5 seconds and made an APR calculator based on this assumption.
Let’s visit https://cchain.explorer.avax.network/ to check real Average block time.
During one day the values can differ.
Looks like we have to dive a bit deeper and build a table (Picture 1)
Column 1 represents the possible block generation rate (from 1 to 13 seconds)
Column 2 shows how many Olive can be minted per 24 hours (using a distinct amount of seconds for each block)
Column 3 shows different APR based on the assumption that the current user owns 1/100 of One Pool that works with the Master Chef Contract and no other Pools and/or Farms.
In Column 4 we provided the names of the applicable chains.
First of all, let’s start with the SPAM Attack which was mentioned in the Twitter Thread.
That case is quite interesting. Any Avalanche user can make a new block that contains only one transaction with a very small payment ~0.005 AVAX. After the block is created, the farm mints 1 Olive and shares it between all stakeholders. Theoretically, if there was a single user that held a large proportion of a Pool and Olive’s price remained competitive then they would be able to benefit.
In real life, this would not occur because we have farms in a decentralized ecosystem where lots of users can participate in Pools. If one single person’s holding of Olive made up a large portion of a Pool the price of Olive would not remain competitive, for obvious reasons.
Therefore, if a Spam Attack did occur the farm would emit a lot of Olives but all of our users will benefit as a result, not just the single person that carried out the spam attack.
Why so slow?
After our investigation with the table and Avalanche chain explorers, we saw that the Average block time can be even 13+ seconds. What does it mean for our users?
That means that farm mints Olive 2–3 times slower and the APR on our site can be incorrect.
We implemented an APR calculation based on the actual average block time and fixed the APR calculation. To do so, we use the last 1000 blocks to calculate the APR.
💰Avalanche is quite a young network and it’s going to grow. Block times currently differ from between 0.9 to 15+ seconds. Once more adopters are using this network more frequently the block generation rate will increase, which will, in turn, benefit our users.