Balancer - beyond automatic market makers - 0xPoland S01E03
ETH Warsaw·Thu, Oct 7, 2021, 12:00 AM
👨🏫 Alex Van de Sande: Balancer - beyond automatic market makers. An intro to what Balancer is, how it's more than you expect and how to build novel economic primitives with it. #0xPoland is an initiative to build an active community of blockchain developers. If you want to improve your coding skills, make sure to join our monthly meetups, workshops and a hackathon in May 2020! ➡️ Sign up for our events here: https://www.meetup.com/0xpoland ➡️ Follow us on Twitter: https://twitter.com/0xpoland
Transcript
so now uh let me tell you just a few words about alex before we connect him so alex is uh a very well-known persona in the uh defy and in the blockchain and ethereum space alex was i i believe he was like like fifth maybe six but one of the first employees of ethereum foundation just just very early after the ico happened and the whole thing started to be shaping alex was involved in many many um basic pro very base projects in ethereum space he created blockies of the small icons that you can see either in metamask or in many other applications and that was uh that was idea that came from alex and he created that and um he worked on many interesting projects first wallets together with alex we were working on uni logging and today alex is working and i i want to mention before before the final thing alex was involved in white hot hulk when there was a hack in the wallet that led into leaking a lot of money they alex was there in the room where they hugged those wallets take the money and return the money to the holder so that the black hats and the thieves could not utilize the hack to do that that was a huge huge huge event a couple years a few years ago now today alex is working for balancer and balancer is one of the top defy projects we have today in the space they are second to uni swap and that's pretty much it and they have very innovative idea like like if the phi space is no it's not innovative idea if uni swap is not innovative decentralized exchange then balancer is even more innovative and all about that alex will tell you just in a moment so without further ado i think we can have alex joining us now and he comes out thanks great to go just want to say before you start it's a great pleasure to have you today we have a lot of viewers so you know it's always a little bit in remote a little bit weird in your mall when you talk to the screen but uh but uh you know just by amount of questions that we have for the first presentation i think there's plenty plenty of people listening so without further ado alexander i will share my screen and see here okay can you see it is i will rejoin if something happens but i think it's gonna be all fine perfect so this is actually my first presentation about balancer i joined the project in december last year so i'm i'm still learning a lot and during the process of me learning i always like to try to i i make them into presentations so this presentation is about the process of how i learn what balancer is in the point of view of what exactly that is what attracted me to the project right so first of all this is sugar cane i'm in brazil we have a lot of sugar canes here and you probably know that if you take sugar cane and you add it to a meal you get sugar but the other thing you also get is the gas and the gas is a by-product of sugarcane but turns out and that usually was just discarded it turns out the gas is actually very rich in energy and you can you can make it either you can make it a biodiesel out of it that can be more valuable in some places than sugar so you can say that cane if you mill the cane you get sugar in the gas but you can also say that in fact you get a gas and a byproduct of it is sugar in the same way if you get arbitrage on the curve you get exchange and liquidity that's sort of like emm's work how that's any swap work but you can imagine that as the opposite you can maybe what if i told you liquidity proves the project is the main product it makes change it's just a by-product so what happens so first let's talk about how uh automatic market maker works right so most automated market makers you need to upgrade the world's famous one is the most used one they use a constant product function and that just means there's a curve that there's a constant that is always if multiply x by y they will always be in a constant so the curves look something like this and why does a curve like this magically make the the project work right so first let's explore the calculator of the of what the curve means so basically it means that one is the sorry about the type so i just just had a presentation set up and had to change the computer last minute so all my fonts are messed up but you can imagine that one of those x the x axis is the amount of tokens they and the other will be the amount of tokens an interesting thing is a user like a unisop or name emm they actually don't know anything about the prices the all the information they have to work is the amount of tokens they have in a pool and whenever you move and you had more tokens in the pool in one side the ball simply moves on that direction right and and you can imagine the the way you can think of it of course the effect the exact formula is you actually get the delta of those two but you can imagine as if you're getting the amount it's sort of similar to getting the amount of tokens similar to that right so if you if you as you move the pool on that aggression direction now you're getting more green tokens than the blue tokens and if you move it in the other direction now you get more blue tokens than the green tokens and until it reaches from equilibrium but why exactly does it work that basically will always be the same prices and you you not only you reach where we have the same prices but in which i can even work liquidity pool i always will have the same amount of value in the pool which is interesting because units again industry doesn't know what is the price of the of the pool it just happens that every liquidity pool will have an equal amount of teacher a little amount of dye or whatever tokens right so if we need to think about the interesting thing is that actually it doesn't there's nothing to do with the product function curve it wouldn't work the same way if it was a curve like this or a curve like this or even whatever a curve like this it doesn't actually matter which type of curve you use it's just that we are using this this constant product because it's a practical curve and there are some interesting characteristics about it but what i want you to think about is the value of tokens in the po right how do you think about what is the value of tokens in the pool and of course value is the amount times the price so you can think of the price as a multiplicator so if this token a is worth two dollars you can imagine it a multiplication and then we can simply fold that line and if the amount of tokens b is 50 like the other tokens or 50 50 cents think of it as as housing and then all you need to do is get the half folded it in right so this is really amount now you can see that the values while you had like equal equal equal amounts of tokens the values are completely wrong which means that basically if you give them tokens b you get tokens a and it's free money like the more if you get one dollar for can be in the pool you get four dollars out of how can be a token eight which of course you should then people are going to gold here and the more because so imagine that as a sort of like two two vectors then when they are out of the cathedral people will push them in one direction and the more you push them the more you pluto can be the top day the imagine it's all happening like faster than the prices is changing right until you reach an equilibrium and from that point on you can see now that the green line is bigger than the blue line so it's going to push it down again to that to that other point so i want you to think of emans not really as as mathematics but really as physics it's basically there's imagine there's a ball and those two points but you've that's the gravity and it's going to find the little point where the gravity sort of reaches the equilibrium and it's very still there and because it it has though because it will stop that we do stop at a point where value times amount is equal that's why you get a liquidity pool in which meaning that you if you add liquidity your if you if you add liquidity swap and you add eater and you got to die by the hundred dollars you always have an equal amount of interest and why is this important it's important because it means that unitop is used for trading it was built for trading and as a byproduct you get a self-balancing portfolio of two tokens and balancer actually was created almost at the same time zulu swap and they as in order to create a self-balancer a self-balancing portfolio and they ended up in um finding independently in the same solution of of of new one but from the other direction meaning balancer creates self-balancing portfolios for any number of tokens and that's not by problem you get trading so the idea here is that you can create any sort of self-balancing portfolio for a number of tokens and whenever and the traders the arbitrage people they will be the ones that will be managing and they will be they will be automatically changing that amounts in your portfolio and why that is important right let's think about like sizes of products like right now balancer is at number 10 and the typos we have we just crossed the one billion uh mark and maker has six billion have five compounds for curve three in subtree right if we think about them visually it's gonna look something like that if one million dollars is just the size of the dot in the eye then one billion dollars is this ball which like it's big and that would be the amount of uni swap like three billion and five million dollars which means look balancer is big but who is really bigger right if you compare it for robin hood which i suppose it's gonna go like a little bit now but like at last time i checked they had 20 billion dollars in assets which i mean it's a lot bigger but even bigger than that would be work her hat away that's uh that's mainly and uh uh like that's just a font right they and what they do in the fund is that they have a self-balanced portfolio they keep 20 ten percent in cash 20 an option in in this stock options thirty percent and then that right and usually what they do is they just they just set up a strategy in the beginning of the year and they just really follow it right so maybe if you could automate it like and even like berkshire highway is small fish if you think about it so this is one word which it's not showing but i think it's five trillion dollars so again this is the this is home the pale blue dot right this tiny thing there which represents balancer is a billion dollars all those tiny moons there to the little circles this whole thing that our friends have been talking about defy which we are just like a tiny one compared to the big star that is both of those index funds those and those automated etfs and my point being like we can probably automate that if you want ethereum to be the future of finance then we probably can think of how can we automate berkshire hathaway can we just replace every asset manager at bankwood with just a bot where where you set a strategy and you did you let the bots do everything and i think that's an interesting proposition so we can think of of both balancer pools are mostly just three things there's a bunch of assets there's a strategy which is a trade curve you can set really any sort of trade curve that you want under the governance which of course can be done you can set it i'm gonna create this pool in the beginning and it's gonna be like the same thing forever right that's like no governance is a type of governance and with just those three things you can build a lot of different things my point really is that i see pools as almost a new primitive new economic primitive that you can build a lot of cool things and in fact if you're building things with them it saves you a lot of a lot of time and trouble so for instance like you can start with basic books basic pools are what we have right now in master which is just you create at the moment up to eight tokens and you set i want to have 64 of this 40 of that i want to have eight tokens with this distribution and then we're and then you set up a trading fee and a few other things and you have like and and you can put a million dollars in or a billion dollars or one dollar or whatever and the boo always self balance i mean self balances because whenever any because whenever there is a difference of of of the size of the pool by people trading in the balance or exchange which is connected with other exchanges and there are people running arbitrage bots on it like they will make sure that europe will always like go back to where he was an interesting thing is that instead of paying an asset manager to make sure your money is is with the right proportions what actually is happening that you're being paid to do it because whenever someone trades they pay liquidity fees and that's equity fees go go back we'll go back to the liquidity owners so it's a great way imagine instead of you have to like instead of you paying berkshire hard way you can be paid by just putting your money there which like sort of how how it should work but you can do a lot of other things so for instance pydow is building autonomous index funds and balancer they are using a smartphone in their back end and basically what they do is they help create you what now and it's great because because balancer is super flexible you can use you can just plug any sort of ownership on that and every pool has their own full tokens so you can use that pool automatically to be your to users voting mechanism right so you can imagine a discussion of reinvesting or investing or cash flow or anything that's just you trading percentage you can say look we have right now a million dollar half of it's in each year and half of it isn't die and i you can say look i want to invest a hundred thousand dollars in this new project that can simply that in the size of balancer which doesn't mean we're gonna take a little slice of one percent of the die amount and you're going to convert that in one percent of this redeemable redeemable token or this other token that represents somehow your project right and the nice thing of this is that let's let's talk about like da molok dao i'm not sure if you're heard of but volatile is a very popular uh like minimum governance now in which idea is that people discuss people vote where the money goes or the money doesn't go and if you disagree with whatever like with the discussion at any point you can simply quit the doubt and get the token out of it and you're right and you're and you're good for it an interesting thing with by putting that on tomorrow smartphone you get a lot of that automatically because the minute you hear you hold a balancer pool token of anything it means that you can always either you know how it's trained that for more for like you can always borrow your tokens and get over your your liquidity tokens and then get the the tokens themselves right another project catnip catnip became very popular uh at the end of last year with with their with because they they try to bring a prediction market they are being predicted markets on balancer right now and they do operational market as simple as we swap if you go to their website and it was like oh who's going to win this election but i you will either buy a uh or you buy a trump token and that was it right with a uh uh relational market stripped down with bare minimums and they are building it above um pydow prime now is building liquidity goods trapping booth balancer so that's another very interesting thing that's happening i know there are a lot of people using lbps and i want to i want to explain why what they are because i like to think of the bootstrapping as almost the new it's almost like the new ico right you want to raise money or you want to launch a token and how do you do it you probably heard about uh average dollar cost averaging dollar course averaging meaning means you have a hundred dollars um let's say you have a thousand a hundred dollars and you want to buy a hundred dollars in bitcoin right or you have a thousand dollars you want to buy it four dollars in bitcoin you could just go there and buy a thousand dollars in bitcoin what's gonna happen is that if the price goes up yeah like you you got you got in a nice a nice moment but if the price goes down and then you could have like bought a lot of bitcoin for cheaper right so instead of doing just buying a thousand dollars bitcoin suppose that you buy a hundred dollars or ten dollars every day or one dollar every day until you get like every month every week you buy a little bit of bitcoin and what's going to happen is in the end of the of when you get a thousand dollars you're gonna be exposed basically to the average moving price of bitcoin when bitcoin was going down you bought more of it when bitcoin was going up you bought less of it but in the end of the day you in the end of the period you have bought a thousand dollars in bitcoin probably at a much better price than if you had randomly picking picked any any moment so uh liquid bootstrapping 2 does that pool does that but it's a food that you set to automatically change the amount so it starts as let's say 99 f and one percent a new token right it can be if it can be tied like let's say you start at any percent of if or a very popular token and it starts as a as a one percent of one token suppose that one token doesn't have really a lot of liquidity in it so you don't even know what what is the correct price that this token should have the cool thing is that if you put uh if you put let's say if you start with a million dollars of of of dye or eater on it or like of course these millionaires can be by multiple people i'm not saying you need a billionaire to do that the point is that uh if you the boom starts with a tiny percentage of that of the token which the market will sort of try to figure out what is the correct price of the token and then the next day it would be two percent the next stage will be three percent the next day will be four percent what's going to happen is while the market is still trying to figure out what the amount of tokens what is the value of the token you're gonna you're starting to give it more and more and more liquidity until by the end of it you basically sold automator you bought that token at the price that you you helped discover so the advantage of that is that first of all you don't know the market price of a token and that can work with any market price of the token right you eat because it's always at let's say at some point this week it's gonna be a five percent stoke it's gonna buy more token like if it's still suddenly the token price goes up or down your pool will buy and sell each other like buy sell buy it or sell the token buy the pokemon to always have five percent right so so the pool is sort of absorbing it's absorbing the the changes in the token and and by the end of it so by the end of it you get a great degree for a token so advantageous number one for people buying this this token they they allow you to buy a token that you don't know the price without being exposed too much exposed to price variants you're gonna be basically buying the token over a week or two weeks or a month depending on the degree bootstrapping event uh for the token launchers is great because you they are they are helping the market figure out and by the end of defense they will have a huge liquidity for that token and now it's hard to move the market around so the goal here so let that's that's all happening in bathroom right right now but right now we are really working on vitru and what v2 does is is interesting first of all we are really focusing on making it gas efficiency uh the way that every automatic market maker works right now is that every pool holds their own tokens and has you plug in the curve and it's one contract right and if you wanna and what we are doing is that instead instead of adding all that logic in the same contract we are working with with a very secure and super audited contract that it's going to hold all the tokens and you connect emm's into it right and it's it's fantastic because you can create any sort of email you want and just how you trade tokens and then you can add tokens through it another super advantage of that is that when you do multiple token trades when you do arbitrage you exactly a lot more gas efficient because first of all you look so let's say you have like three or four pools and you figure out like if you if you exchange token a nato with talking being that and don't see that other people you get one die arbitrage per arbitrage if you want to if you want to do that in amm right now you need to have all those tokens and you need to execute all those those buy and sell you need to buy and sell those okay in all those pools so you spend a lot of tokens if you doing that in balance or with you just means that you're gonna send the information of all the trades that you want to do and it's going to just execute unchain the next result right in the end of the transaction all the tokens that will move if the tokens are or the net result so what could happen is in fact you could do you could get an arbitration profit without even having any tokens how cool is that you never put any tokens in you just realize that if you trade with a with b with c with d you get up you get per profit out of it so it's good for gas efficiency but it's also good because it increases liquidity in our pools overall another cool thing oh i i just rather i just explain both things at the same time right so yeah so this is the idea that before we had two sort of pools and and then and then we allowed it to have really any highly customizable logic and and like any customizable logic in human sex because uh if you if you made uh the project curve dot finance is really uh launched uh interesting the one of the things that they do is that they have a very different curve or stable token that you have for for for normal variable tokens so if you have a pool of usdc and dye and theater you can have a very different type of curve than you would have with let's say eater and bitcoin baker and the final thing i think that sort of like blows my mind is capital efficiency when you put a thousand tokens in in the in the dao in the vault right you probably wanna only at a tiny percent of those is going to be used in trading like most most of them are going to just be sitting there on the vote and with the new token with the new v2 we have this this concept of an asset manager where you can set uh a contract you automatically pull those circuits add them to a lending protocol which is let's say like compound or something like that and then bring them back as you need it so it's almost as you have uh you you have like a uh but you have a thousand dollars there and you only you realize that you only trade an average hundred dollars per day or fifty dollars per day you can only you can you only need to have like a hundred dollars in that actually queue like driving in the pool and as those tokens get traded out then you bring them out from the from from from compound or any landing platform which is fantastic because now you can keep your pool like you don't need to choose oh i have like one guy should i put it in compound or curve or or or balance or this or that you can actually put it in multiple places at the same time and before you say oh this is this is this uh like that doesn't mean that you don't have the clutter right no trade to actually be taking place uh unless that collector is actually there like this right and if i try to make a uh uh if i try to make a big trade with a given pool and it doesn't have the doesn't have that like we will not even send that to send that trade to that guy because like that that that transaction will fail so my bigger point is balancer is really for builders we want to build a project and we are building an app and we are excited about building that but really what we want is to build something that other people can build on top of right it's almost like in this universe of money levels we are launching this new little customizable piece that can connect a lot of other things and you can it's a very powerful piece and you can build a lot of new things in this money level and you can learn a lot more about a bouncer by downloading the balance of finance or balancer or twitter advance labs and we're hiring so like if you're excited about this if you're excited about working on the future of money legos and being a part of this defy revolution like we are like just shoot an email right uh like right now we are looking for all sorts of positions so like you will yeah on on ui on front end on backhand so if you have like any sort of interest in that space just shoot us an email and we'll be happy to talk and that is the talk thank you hey and we're back thank you for graduation alex that was pretty fast i i i i think there might be some questions i think that we have at least one question here i'm going to read it in a moment but i will wait for the question to show up if mata was able to wrong questions it was 30 minutes so the time was good okay i'll start reading the question oh okay here we go yes yes we are working on that we are looking at that so interesting thing on on that change that i mentioned on balancer that a very cool thing is that we are making or or or our contract a very very basic contact that you can plug it plug in a lot of other things right so as soon as there's a site like i certainly want to move towards like anyone can actually create a pool that is just pointing out for a second later and we are also looking at roll ups and ziggy so yes we're looking at player 2 we haven't seen any solution that we truly believed in and we are sort of like skeptical of solutions that run their own chain and we we are very excited about those that are basically rolling up into achievement chain so we are we are willing for that i will just add a couple words of explanation because not everyone might know what l2 is yet as to our scalability solutions for blockchain that are just emerging right now there was really nothing working just half a year ago and now now there is at least a few and in a month we're gonna have a meeting exactly about layer two solutions so it's gonna be everything gonna be explained and i think it's time for the next question let's see if our studio okay very nice my pr good exposition yeah that's a vibration hashtag uh i'm not sure what he's talking about uh first one why is people designed to be unusable after any liquidity is no more than there and i can't even be added back so i hope that's the birth that you found somewhere there or not so like if you're finding uh if you're having any trouble adding to a pool or like feel free to share to jump into our discord we have this board we have it back and i would love to hear more about like maybe we can try to figure out what the problem is that you're having like i not sure what you're talking about sorry yeah we're gonna have that working alex will you have a little bit more time to stay with us on networking session yeah sure i can i can do that so let's let's take it there let's see if we have more questions but i think we still have time for two or okay i can read one i'm not sure it's not showing up here in a classical governed portfolio you have exposure to different assets and rebalance let's say every half a year some assets perform better some words one too short feedback loop and too frequent getting rid of a well-performing asset caused too much impart impermanent loss yeah so the question is if we gonna rebalance too often yeah then impermanent loss do we have did we explain what impairment loss is well i didn't explain what impermanent losses and the reason is that i haven't still found a great solution a great way to explain it but the short version of this uh because of the way that emm's work slowly as asset prices just diverge and that doesn't really some people call it divergence loss which i think it's interesting meaning that when prior prices sort of diverge uh you like the amount of money the more value that you get by holding a token of the two is a little bit less than just say holding that right so let's say you have a pool which is fifty percent either fifty percent die right and then you bought it when eater was like five hundred dollars now each other is a thousand dollars right your if you had if you had like the amount of money the the value of that will not be the same as if you had just kept like just just had one like half either or half uh like it had just held one eater on one die back then right it's always going to diverge and it the way that but that is usually compensated by by by trading fees right so the more people are trading the more basically they get they get that back so like permanent loss or diet different average loss will like sort of like disappear disappear as the if you can come back to the original price that you bought then government loss depends on when you bought an asset or what the market might condition where and there are always be there i mean usually like there's a trade-off if you like if the pool has enough liquidity of trading you will like you like you you get that back so an interesting thing is that if it doesn't depend on how often you trade like we we don't we don't rebalance boom like pulls our rebalance every time someone buys one token or buys to other tokens in our exchange then they are rebalancing almost like every food that they touch right and in permanent loss it doesn't depend on how often your balance it just depends on what price you bought at logan and well uh um so important okay there is one more i just want to add about empowerment laws that it is tricky to understand it is a little bit tricky to understand but the important part is that if the value of the assets change so let's say ether is getting more expensive versus dollar then there is some loss to those who provided liquidity but if they came back to the same price the loss is effectively you get the money back so this is this is a little bit unintuitive at the beginning i propose we do one more question the one that we see here and then and then we can go to networking so question about scalability and expansion plans we are the main challenge what are the main challenges and constraints you see to overcome land alert pins device or fintechs oh large fins and to start talking about small mid wealth management companies i think so so if i understand it's basically how how do we get out out of this defying bubble and how do we start attacking on getting actual like finance people right i think there is a lot of that that is about about scalability right now it's just very expensive to do it there's a lot of it that is about ui and you're like that's that's the part where i'm more excited about that support where i'm working directly on it so one of the things that attracted me into monster is that i really dislike their current website and tooling right they're great great project but their current site is a little bit confusing because you have to go to balance or site you don't actually discover any of those things that you're talking about it sort of looks just like a unison clone but like you get into it you get like you have to click on add liquidity and then you figure out all those cool things happening here and then that's sort of where you get into that right i think that's that's working like so we are we are working on just improving the ux so that is fun as beautiful let's say using robinhood right and i and i we i hope that we get there wonderful so let's um let's then let them point ourselves to networking so um here is a link you can see it on the screen http 0x network so we're meeting on a remotcal platform i think it's called remote it says remoka remoka yeah rainbow.co and the platform you need to go there you need to connect her and when you do that uh you will need to sit on a space click on a specific table and on the table you're gonna need to enable your camera and enable your microphone and then we can talk i think bartek is already there and myself and alex is joining any second now so yeah let i will stay here for one more minute to make sure you can see the link and we're also going to pause the link on facebook and on twitter and maybe on youtube as well let's see if we can actually do that so i think alex is already gone for um for networking and i'll be with you there as well in just a second
Automatic transcript — names and jargon may be misspelled.