🎙️

S2E7: Mayflower Update 1: Sunrise Improvements

Date
April 26, 2023
Timestamps
Type
The Bean Pod

Recordings

Meeting Notes

Transcript

welcome to season two of the bean pod a podcast about decentralized finance and the Beanstalk protocol I'm your host Rex before we get started we'd like to again remind everyone that we here at the podcast are super bullish about Beanstalk protocol and other d-pipe projects but as we've seen time and time again this is still a risky space so with that in mind always do your own research before investing in a project including anything covered here in the podcast and never ever invest funds that you can't afford to lose and with that on with the show Hello Farmers after taking a short Hiatus the bean pod is back and we couldn't be happier now while we were away the farm stayed busy and now we find ourselves in the cusp of what has been casually referred to as beanstalk's Mayflower update this package of improvements will have a significant impact on beanstalk's utility governance and operation in this episode of the podcast focuses on the latter now those of you who are familiar with Beanstalk will probably recognize the term sunrise for those that aren't to kick off every new hour Beanstalk performs what you could call a system check that we refer to as a sunrise during the check Beanstalk re-examines its token balances in price if it's above Peg IT issues newly minted beans to stock pod and fertilizer holders on the other hand if Beanstalk is below Peg Sunrise is when the protocol determines the amount of debt it's willing to issue to bring the price back up to where it should be and the percentage of yield it's willing to pay to entice those interested in lending to it either way this function is absolutely critical to beanstalk's continued operation when Beanstalk first started the sunrise function was called by whoever happened to be sitting by their computer at the time and it paid out 100 beans as a reward to that individual as Seasons began to climb however it became more and more apparent the paying such a high amount every hour wasn't in the protocol's best interests similarly the community has raised concerns about the amount of debt the protocol has taken out over its lifetime and the development team has been tasked with finding ways to mitiate that debt while at the same time maintaining the free market ideals that underpin the protocol to learn more about the approach to these improvements today I'm talking with two of beanstalk's developers Breen and chai Kitty Breen and chai Kitty thanks for joining us today yeah great to be here thanks for inviting us yeah hey this is dry Kitty good to be on so to start us off would you like to tell us just a little bit about what you do for Beanstalk in the dev role yeah so for Beanstalk Farms I'm a solidity developer you know we me and among among other users we try to you know write some code and try to upgrade Beanstalk you know into a state where it becomes more self-sufficient and you know optimize as many parameters you know such as Peg maintenance or you know develop Future tools in which other developers can build upon to fully make Beanstalk a fully composable stack and uh be the best they can be yeah so for me um I I actually don't work with Beanstalk Farms um this is actually the first contribution that I've made to Beanstalk what we're going to be talking about today um aside from that I think I've I've done a little bit of minor stuff here and there I think I helped find a couple bugs on on the UI in the past but um yeah this is kind of my main contribution so far but you know who knows what maybe I'll do in the future as well love it brain it's been a pleasure to get to know you and your work over the last year or so and shy Kitty welcome to the team so to jump right into what we're going to be talking about today one of the first improvements the Beanstalk is rolling out as part of the Mayflower update is focused on the sunrise function and really to be fair it's actually a couple of improvements to Sunrise that are being grouped together but before we get into the improvements could you talk us through what the sunrise function is and why it's important yeah so the sunrise function is beanstalk's way to keep time and as well as to observe the state of itself every hour you know any user external internal can call this Sunrise function given that it's the correct amount of time has a last between the sunrise Funk uh functions you know we call them Seasons but time wise they're one hour and doing so being stock does you know the necessary calculations to check its state and gives and rewards the user who called it some beans it's important for the sunrise function to be cold because you know without it being Stock's unable to you know check on itself for example or check the state of Beanstalk and the reason why that's that's important is because Beanstalk constantly updates you know it stayed based on that basically you can kind of Imagine being stuck as a boat and it's guiding towards the destination well every hour it checks you know the wind the you know speed of the build yada yada yada and you know accurately changes directions you know bit by bit to properly and optimize its way towards a destination all right that's great so um with the current setup every season every hour there is that opportunity for being stuck to check its bearings and that's typically done by a user calling the sunrise function and essentially you know you've got theoretically it could be users sitting and actually watching the user interface or or you know or by themselves but in in most cases now it's some type of automated bot setup that folks have engineered to call that function and receive rewards why can that be problematic why is it not as efficient as it could be yeah so I can speak to this one um the reason why Beanstalk relies on some third-party you could you could call it some bot operator to be calling a function is that it's very important for being stock like Breen mentioned that it is always called every hour and as quickly as possible so to that end it must incentivize users to do so by providing some monetary reward and that's because in order to place the transaction on ethereum it costs gas so the the idea with the reward is that we need to we need to one compensate for calling the function but also provide some amount of profit so that people are incentivized to to do so to you know operate the bot to do it to make sure that it's that it's happening consistently and so forth so it sounds like what we're trying to do here is we're trying to say hey if somebody's got to buy an operation that's calling the center rise function there's going to be a certain Network fee that's essentially unavoidable in invariable depending on network load you know could could vary really pretty significantly and then on top of that there should be some type of incentive so that whoever is operating that bot or whoever is calling that function let's say has some type of incentive Beyond break even it sounds like the the goal is to try to make those both of those things as efficient as possible Right yeah so for reference currently being stock pays around 25 things which is a decrease from the original incentive and the original Center was 100 beans however you know this static value isn't as efficient on the evm so for example let's say you know the execution cost of that transaction is around ten dollars right and let's assume one dollar is one being you know there's a 15 Bean margin in which what it really occurs is that no no one just calls the sunrise function you know with the base fee or with the you know average price of an execution and get that 15 of beans what really happens is that these Bots are very competitive uh they look at each other's transactions and they see oh you know there's a 15 margin I'm willing to take I'm willing to call it Sunrise with 14 margin so they'll increase the gas price such that they will be the first one in the blockchain and therefore get the sunrise reward and another bot comes in and says oh you know I'm down for 13 and it's a huge competition and it keeps going until the margins around you know let's say three dollars or so you know so what occurs is that even though Beanstalk is paying 25 beans to incentivize people to call the sunrise you know truly we're paying around ten dollars of that or you know a non-in significant amount to the validators of the evm due to this competition-based nature and the Crux of that issue is based on the fact that we don't factor in the state of the evm or the state of the blockchain when issuing these beans so you know what chai's kitties Sunrise improvements part aims to solve is to include someone that uh into the calculation of issuing beans it's just such that Beanstalk pays the minimum or a more efficient manner needed to uh and properly incentivize someone to call the sunrise function in all conditions you know there are sometimes actually where the sunrise improvements that uh apologies the 25 beans wasn't enough to incentivize people to go in you know during I don't know uh nft Mentor the like gas was so high that 25 beans wasn't enough to incentivize a user you know so that's sometimes we see one block two blocks perhaps even three block delays and calling Sunrise so this also solves that edge case as well and so ultimately this should provide a more steady a consistent profit to the Bots calling the sunrise function how many Bots do you think there are competing to complete the sunrise function at a given season a given hour Rex you know you're you're guess as good as mine's uh we all have no clue I would say at least a couple like four at least four we feel but honestly we have no clue right and you know it's four maybe it's four right now during the less volatile times the Beanstalk but perhaps when things picked up again you know maybe even more people will be using advice to color sunrise and ultimately you know having more of these Bots uh it's good for being stuck given it increases decentralization and calling the sunrise function right and so one of the key reasons why we made it such that it's not the only one we call Sunrise right otherwise that introduces a centralization vector you know it's great that anybody in the world can call the uh the sunrise to make Beanstalk keep chugging along right and ultimately that's the only thing Beanstalk needs to keep juggling along so I think that's very you know that's great absolutely and so kind of is another follow-up to that Who develops these Bots I mean uh like and maybe it's somebody in this discussion if it is that's fine you know hey no judgment here it's not me that's for sure um but I guess really the question that I have is are there folks that are not part of the community the had the technical skill they were like hey I can develop this bot and you know I you know I I'm a I'm a solidity developer and I don't have any other interaction with Beanstalk besides the sunrise function but you know I I had the time and the wherewithal to put together a bot that would help you know make me a few dollars an hour competitively you know compared to these whatever other Bots are competing you're not you're you're not a bad guy you didn't know that sounds like someone who did make the VOD would say yeah that's right yeah yeah that's it I mean the landscape of evm is just so vast you know initially during the early days of being stuck you know Colony Sunrise is expensive and what actually occurred is that uh Bots that weren't into being stock just merely checked the mempool and saw that calling this one function because because you have to think about it from the like perspective or these Bots they scan the whole mempool they see someone call a function and they don't know what the function does it's a black box from their perspective all they see is that you call it function some erc20 is issued and that ERG Tony happened to have a pool to change for Eve you know from their perspective that bot will see that and you know we'll buy it so during the early days what occurred is that uh these external users who aren't being stock native uh users actually you know they saw the sunrise function and just called it and uh you know subsequently sold their beans to the pool right and that's what kind of ushered in you know this need to really invigorate the community to like educate the community and you know get them to running to run their own boss too these people who won't be as nefarious as these Mev you know Searchers within the mempool yeah that's that's what I was trying to get at is it like and and again you know this is obviously how much of a novice I am to some of these technical aspects because but that is that is what went through my mind is like are there people with a technical ability that can create Bots that are yeah that are essentially scanning the entirety of the ethereum ecosystem looking for those opportunities to NAB you know whatever bits and pieces of whatever coins they can as long as those coins can be traded for eth you know that's that that's it sounds like that's kind of what what I was imagining where you've got folks that are like hey I don't know anything about Beanstalk but I know how to I know how to create this thing that could do this they can perform this function and so that's that is how I'm gonna make my money yeah well the great thing is you know as bead stock scales up and more and more people and more and more eyes look at Beanstalk and inevitably people who are a major Beanstalk farmers will call to Sunrise function with their own Bots and you know ideally not sell their beans and you know keep it as their own you know they would have to sell eventually to You Know cover gas costs but you know the hope is that the profit margin stays within beans and I think ultimately that's what's kind of happening today so it's great to see that all coming into fruition no that's very fair so now try Kitty it sounds like this approach that you're taking helps to kind of Hit The Sweet Spot of managing both you know taking Network costs into account and you know managing the competitive nature of the Bots to minimize the cost to to be in stock right yeah yeah that's that's correct um kind of how green mentioned the reason why you know we like we have the 25 beans but at least you know just looking on ether scan at some of the recent ones uh for the amount of beans that were received versus the I guess the cost in in if that was incurred the margin is actually very small and where that money is going is just to the the validator of the block so in this case it kind of I guess it kind of helps everybody accept uh except the validator so can you walk us through a little bit about how the improvements to the sunrise function will help to optimize that process so it's really a couple things um the primary goal of it is just to reduce Bean issuance and by extension being cell pressure and the reasons for that is this is something that you know as we've discussed is kind of just called by Advanced users bot operators uh you know most people in the the Beanstalk ecosystem probably aren't really even aware that that this is you know happening every hour um you know it just it just kind of happens you know at the top of the hour it's it's completed oh we've gone to the next season um so in that sense like there's there's not really much else to to gain out of it other than the reduction in uh Bean issuance but basically what I've done is created a way to essentially check exactly how many beans correspond to the cost of ethereum in order to perform a transaction so you know let's say they submit and and this really could this really could work for for any transaction right now it's only applied to Sunrise but we can basically see okay they called Sunrise uh it made these adjustments to the temperature um maybe it uh distributed you know some amount of beans to Silo to pod line and fertilizer holders uh and then it cost um let's just say it costs like 20 000 gas to complete that operation then it can determine okay what is the cost of that 20 000 gas how much how much ethereum is that how much ethereum is is essentially going to be taken from the caller of that function with that value it can it can actually compare through a couple calculations exactly how many beans is that equivalent of ethereum that the transaction cost so it does so by getting the ethereum price in dollars and then the bean price in dollars and then essentially comparing the two to say okay this transaction cost ten dollars worth of ethereum okay so then that's ten dollars worth of beans um and then in the case of the sunrise depending on exactly what parameters are given to it or uh how you know how quickly it was called We'll add a few dollars on top of that uh in order to kind of how we were how we were saying make it profitable for the person doing it but that's but that's really the idea it's just to basically ensure that we're giving a fair compensation and to ensure that we're not issuing much more than needed uh and kind of kind of the the impetus for this was uh prior to the replant the Sunrise incentive the base reward was starting at a hundred beans and at the time that made a lot of sense because gas prices were very high uh I remember my my first interaction with Beanstalk I I sewed some beans into the Pod line I think my my gas fees were like 70 or something like that um so it was it was definitely appropriate at the time but after the replant it kind of became clear as you know both ethereum price itself had had dropped and then the the you know the general gas costs were lower as well uh that 100 was was a bit excessive um and then so so this was this was a developed uh after reducing it to 25 we wanted a more robust solution uh to kind of accommodate for for all the different possible conditions yeah so what you end up with is a system where Beanstalk itself is making a clever calculation to determine that that gas fee saying okay you know here's what it cost here's what it costs you know whatever you know entity is doing it whatever bot is doing or whatever and hey here's a here's a little bit of a premium premium on top of that to keep you coming back to make it worth your while but really you know the difference between whatever that is and the current issuance of 25 beans per season that amount is is kept by Beanstalk it's not issued and when you start multiplying that by 24 every day but you know by 365 days per year it doesn't take long until you get into a really pretty significant amount yes that that's correct and I think there's been some uh historical calculations done on exactly uh what those differences would be with the the actual versus uh what it would be under this change um I don't know if that's completed yet but I think we'll be we'll be seeing that at some point as well but but yeah I mean you're absolutely right just uh you know five ten even fifteen dollars every hour can can add up pretty pretty quickly yeah doing quick you know math in my head is just as we're sitting here you know you're easily talking about tens of thousands of dollars per year in in terms of fees that that are paid out yeah yeah absolutely so another part of the sunrise Improvement is how Beanstalk determines the return that lenders get for Lending to the protocol you know inside of Beanstalk we call that the temperature Improvement uses what's called a Dutch auction with an increasing interest rate but could you talk us through what that actually means would be happy to brainstock every season when the sunrise function is called updates the temperature or I guess you know the interest rate in which being Stock's willing to lend or to borrow against the right uh an absolute temperature an absolute plus or minus three percent a season right and this is very intentional you know uh you know nowadays temperature is very high but the change is very low and this is you know we do this intentionally because we don't want beans like to be we want pizza to be reactive but not too reactive we need Beanstalk to be reactive enough such that the market can react to the change in temperature right you know there is our thesis is that there is some temperature any external user is going to sell in order to you know get pods right but if Beanstalk gets there too fast you know there's not enough time for the market to react now conversely what we've seen prior to the uh exploit is that you know during the deleveraging period there was a significant demand for uh people to you know Soda sow their beans into soil into pots right and conversely that's what caused the temperature to go down but you know during this sudden shift in you know large demand the temperature was going down but the reality is we believe that a lot of people would have been willing to sew their beans for a significantly lower temperature than the one uh given right we have this very static temperature so what occurs is now Beanstalk issues more debt than it needs to in order to incentivize people to sow their beans right so what the auctioning creates is now we introduce some reflexivity in the temperature towards the downside so starting for the first five blocks or apologies 25 blocks the first five minutes which we you know dubbed the morning of the Season you know being stuck now starts the temperature at a very small you know one percent and over the course of the 25 blocks increases the temperature until it reaches its full amount after 25 blocks now we have this period in which you know let's say there's a lot of excess demand for sowing soil you know now instead of someone instantly selling soil you know with the full temperature they can they can gauge at which block or at which temperature they really want that soil and ultimately just causes you know being stuck to issue less debt in order to you know incentivize people to get that soil so right now the temperature is very high we're well over nine thousand percent temperature Vector over ten thousand percent temperature in one of the concerns that the community has had is that this level of return in terms of pods creates a situation where the the potential future debt of the protocol might not be sustainable or at least it's going to be extremely large because of essentially you know the amount of return that anybody is getting for for sowing any beans or you know burning any beans to to buy pods so it sounds like this is really built to directly address that concern through a competitive system that if I'm right so a block is like 10 seconds so like the first like you know four or five minutes of a given hour that that temperature is increasing if if I'm understanding this correctly yes well me personally I don't think many stocks at that very extreme state yet I think it's a very healthy State uh even with these very high temperatures you know from my perspective this temperature is well more than enough to well it's not in that extreme region to say but yes it does introduce competitiveness into the market into the you know the sewing market now right do you risk waiting the full five minutes and getting that full temperature or are you willing to take let's say 80 of the temperature to and to ensure you get those uh ensure you get those soil to sell right because you know what we've seen is that the man is very volatile right some days you know in times you know right now it is a very low period but you know when demand picks up it picks up and incurs more Demand right so we're so this whole Ducks auction really gives us that opportunity to take the most Advantage out of that you know sudden surge or Demand right so ultimately yeah we think this is a not a solution per se but you know hey not you're not a Band-Aid solution either maybe it is a solution but uh wanted to make an additional tool for Farmers to utilize when they're deciding you know when to sew and uh better optimize for being stuck overall so if I heard you right a minute ago so the the total the max temperature is still going to move based on that set of parameters that's in the current white paper um you know one percent three percent zero percent negative one or negative three if I'm recalling it correctly that that Max will still float in that non-reflexive manner but really what's changing is the the steps that the protocol takes to get to that correct yes and it's a it's good it's not to say it's a good note to say that you know now let's say we implement this morning auction you know we can go a step further and utilize that temperature you know for a future Max temperature changes right and right now we only change you know plus negative three percent but you know another thing we're discussing is that okay now we have this mechanism to see what the average temperature is so like to sell right let's say the maximum let's say you know there's a huge surge of demand and the average temperature in which being stuck shows during that last season is like you know 10 of the max right you know from my perspective it does feel that this that warrants a larger uh decrease in temperature than the minus three percent we have today right so you know this this Dutch auction introduces another level another axis of in which Beanstalk can optimize for right it sets a foundation for that right and you know obviously hasn't been fully specked out yet you know a lot of other things to do is always a busy day on the farm but these things you know build on top of each other these systems do it on top of each other and ultimately creates a more balanced more robust and great system that Beanstalk can you know use right yeah so what you're saying is that you know if every if every hour whatever soil is available is sewn in the Pods at 80 percent of the max temp over some time Horizon you know some period of time that will eventually could theoretically be used to help determine what that Max temperature would be and then conversely if there's a period of time where it always moves to its maximum every you know or or or you know like we're seeing right now there's soil that's left on the table that would be you know that that stronger signal to continue to increase correct exactly yeah ultimately is another indication of what soil demand is right we ultimately need more gauges on what demand is for soil and this adds another axis so great stuff so one more thing that I wanted to capture when we're talking about this Sunrise Improvement package this group of improvements is the interoperability with the farm function and um that's pretty it's pretty Niche for folks that that aren't part of Beanstalk already uh we might need just a little bit of explanation there brainer either you want to talk us through what that actually means so I think the idea here is that if somebody well if one of the bot operators is calling the sunrise function um if let's say they wanted to call Sunrise and then with the beans they received maybe they want to Silo them or maybe they want to you know use them to sew or they want to sell them or whatever it may be uh we basically are providing an easy way for them to to get at the at the run time of the function to see exactly how many beans they're going to be receiving so it's it's really just a way to help them chain function calls together if you will and I believe there's also an option to send it to either the the internal or the external balance of their wallet um yeah I'm not sure if I missed anything else there but that's that's more of like an advanced feature and um in practice I don't think we expect that will really be used but uh you know it's it was uh kind of easy to to add support for that in so you know maybe maybe one day that'll be useful um I guess we'll find out yeah we noticed that you know everything's all you know hindsight 2020 but we realized that after we implemented the form function and you know Depot and pipeline we realized that a lot of our functions don't have the ability to be composed within one and one to another you know for example with the sunrise we don't actually uh return you know the amount that's received or you know the ability to return it into the internal balances and things like these you know they're very little and they're very small quality of life changes but you know we've really taken a step back and really uh thought to ourselves okay how do we make these functions within Beanstalk and composable with each other and throughout the whole evm right and within a D5 and then you know he pulled itself right and you know that's this is just one of the many changes where we do we'll be implementing implementing you know in the next couple months month months and uh you know we'll really see just some fruition and uh salary update for instance right where uh a lot of more a lot of these functions will be more composable you know using Depot and Pipeline and hopefully these small changes will compound to Greater changes and you know turn the tides of what Beanstalk can do yes that's that's the point that I would want to emphasize with this and you guys hit it is it like in and of itself yeah this is this is pretty Niche because this is something that you know is going to be utilized by someone that's you know that's probably running a bot um that would have to understand you would have to understand how Beanstalk works and the most advantageous way to potentially use whatever their Sunrise reward was but two things first is yeah it's a really good opportunity to avoid the cell pressure to manage the cell pressure because if you have if you have somebody that's knowledgeable about what's going on inside of Beanstalk and they think hey you know I can I can capture pretty solid rate of return by taking you know whatever my premium is that I got for you know for calling the sunrise function and sticking in The Silo but if I was going to pay the gas fee to do that I'd essentially be I'd be nullifying that reward to do two transactions but if I can if I can link the sunrise function to to the ability to deposit into the silo then that's a it's a pretty gas efficient way for me is you know the bot developer to take that reward and and theoretically multiply it the other piece is that this is a really good early example of some of the new composability and functionality that we're going to see from Silo V3 and and you know the the broader pipeline program this ability to take multiple transactions that in the past would not have been especially gas efficient or may have theoretically involved moving funds in and out of balances that could theoretically hit your wallet and you know trying to manage all those pieces in a really clever way this is a good example of what is kind of out on the horizon right yeah exactly you know currently Sunrise collars have to do the sunrise function they have to then then call another function to deposit a silo horrible ux like what are we doing here right you know just minimizing that from two to one amazing right these small things just keep people who are interested in the system you know even more interested in this system right you know now you're incentivized to stay within the system rather than sell your beans into Eve right it's just it just really all compounds it's these great stuff building that farm one new Farmer at a time well thank you both so much this is really informative I mean it's great to see the improvements that are happening around Beanstalk and man I can't wait to see these pieces come together and then all the stuff that's going to be going on in the future yeah thanks Rex yeah thanks Rex it's always a pleasure to talk with you and you know hopefully we talk more absolutely can't wait and as a final reminder keep an eye out for the sunrise Improvement bip also known as bip34 which should be up for snapshot vote soon the beam pod is a production of Beanstalk Farms a decentralized autonomous organization you can find us on Twitter Instagram medium Discord and our home on the web at bean.money you can also find me on Twitter at Rex the bean and as a final reminder this podcast is not Financial advice thanks again for listening