Zero to Millions in Months: TE for Ocean Predictoor

ETHCC 7 · 10 Jul 2024 · 25:41

Trent McConaghy of Ocean Protocol uses Ocean Predictor, a decentralized time-series prediction feed, to present a four-step token engineering recipe: set up the rules of the game, make it easy to play, kickstart the network, and optimize. He describes predictors staking on up or down every five minutes, private feeds bought by traders on Oasis Sapphire, team-run bots and weekly incentives to fill the empty network, and a fix for 50-50 staking bots. He reports monthly volume peaking near a billion dollars and now around 100 million, with accuracy climbing.

Speakers

Topics

From ETHCC 7, hosted by Ethereum France.

Transcript

See what you have to achieve, what you want to achieve with your incentive mechanisms, and come to a first design and Lit Protocol has to find out how it works out in reality. Now we have a talk, Trent McConaughey, who has have experienced this journey for a while now and can talk about how this played out at Ocean Protocol. Okay, and then this is a quicker.

All right, by the case of Predictor. Thanks for coming. Hi there, everyone. It's really my pleasure to be here. It's great to see the token engineering track growing. So kudos to Angela and the rest of the token engineering team for that. Today I'm going to talk about a specific project within Ocean called Predictor and where we started, which was basically zero with it less than a year ago, and where how it's growing and the token engineering lessons behind it, and maybe what you can take away. So, you know, one way to summarize token engineering is how do you ship a tokenized ecosystem? You know, build it and get it out there and then optimize, etc.

And you know, to expand upon that, um, you know, there's uh heavier uh thick token design processes if you want that um often the token engineering field explores. And um so you you can follow that and that's great. Uh if you have been doing it for a while, what if there's a way to sort of speedrun that, right? To sort of go through the process, but you know, drawing in your experience, what's a good way to sort of summarize it? Or if you haven't done it much before and it feels a bit daunting, is there some way that's a bit more lightweight feeling that you can get through and get most of the essence of token engineering, but just sort of yet at the same time ship something sooner. And that's um what this slide summarizes.

Call it token engineering in a nutshell. And uh it's gonna form the outline of my talk, actually, so I'm putting it up here. Set up the rules of the game, make the game easy to play, kickstart the network, and optimize. And I'll drill into each of these later on. But that is one way to think about token engineering. Set up a game, make it easy to play. Okay, so I'll get into that in a bit, but let's give a bit of a motivation for what the product we're working on here is. I'm not gonna zoom in into the why we built the product. I've given that talk before. So today I'm gonna talk about the the how we built the product, rolled it out, what the learnings were, etc. So I grew up on a farm, as many of any of you who knows me, I like to bring that up.

It was a pig farm and a grain farm in rural Canada, northern Canada. Um during seeding and harvest for the grain side, this was crunch time, right? Um the month of May was you know, you get up super early in the morning, four in the morning, five in the morning, six in the morning, and you're not going to bed till it's dark out, and you're actually often, you know, if farming everyone together is going all night whenever possible, right? For the for the preparing the field, the spraying, all that. Um, and then the actual seeding, etc. Same thing for harvest, right? Bringing the money in. Why?

That's when well, it's all about bringing the money in, and that is crunch time. But if it rains, if it's gonna rain, um and your tractors out there, you know, seeding, um, and it pours rain, you get stuck in the mud. And that could mean you're stuck in the mud for two hours, six hours, twelve hours if it's a really bad rain, right? And that is death to profitability because it means you're delayed by half a day or a day or two days. And every day really matters because the snow comes pretty early in northern Canada where I'm from. So every you gotta get done, you know, within two or three weeks in May, such that you can take off the crop soon enough, um, you know, by mid-September, beginning of October, because it could snow then, right? And you don't want to get caught by the snow because then you don't get profitable.

So every single hour matters when you're farming. So the thing is, therefore, you don't want to get caught by the rain. So what do you do? Well, you live and die by weather predictions. So as a kid, whenever we had the weather predictions, radio back then, not internet, everyone had a my father would go shh at every hour on the hour, right? 5 o'clock a.m. 6 a.m. 7 a.m. etc. Um we had to listen intently to see what the weather prediction was. If it was gonna rain, great, we better bring the tractors in, et cetera. Um and if if it had rained, listening, okay, is it drying up?

Can we go out yet? Can we go out yet, right? So we lived and died by weather predictions. It really mattered to our profitability as a as a farm. Um overall, you know, predictions lead to um, well, making money or saving money, right? And there's really two types of predictions. We've all heard of Chat GPT, and but below it, uh behind it, um the LLMs and so on. So the uh you we can what that comes out is one-off predictions, right? You might ask a question, you know, should a weather uh can I wear a leather jacket with just dress pants, right? And it can give you an informed opinion, informed by the rest of the internet. Um of course, you know, robots don't have bodies yet, generally.

Um, and then so those are the one-off predictions, and that's what gets all the headlines in AI. But there's something as big, as important, and probably even much more profitable, which is time series prediction. Um open up your weather app, you know, your Apple weather or otherwise on your phone, and you'll see you've got a prediction for one hour from now, two hours from now, et cetera. And it's rolling predictions, you know, 30 minutes from now, it'll give you one hour ahead of that, etc. etc. Right. So these are time series predictions, and we see them all over the place, right? We see them not only for weather, but a lot of other use cases. Agriculture, right?

We want to know about the rain and the sun and all that. Um so weather really matters there, but we also want to have other predictions on yield, et cetera. Um, time series prediction for energy, right? And uh, if it's Texas, it's the middle of the summer. You want to predict is it gonna be hot today? Because if it's gonna be hot today, well, you might need to uh turn on more energy demand. You might need to call up the Bitcoin miners and ask them to um not mine for a few days, right? And also energy prices, right? Um, you know, from the Ukraine war, the um the energy prices spiked a lot, especially in Germany and a lot of Europe. So energy predictions really matter, and they matter to individuals because you know the house the cost for uh heating could double in in one winter, and that's what happened a couple years ago.

Um, real estate, right? Um, another one. Uh and logistics, manufacturing, and of course, finance, right? So if you're in TradFi or DeFi, you also live and die by predictions, right? If you have terrible predictions of where things are going, you're gonna you know be out of the game pretty quickly. So predictions really matter, and it makes a big difference to making money or not. Um the thing is, you know, imagine me and my family listening to this radio for the weather predictions, and the weatherman says, Um, you know, it's gonna rain today, and it doesn't rain, um, or vice versa. And that would happen often, but and it affected us negatively.

But is it any skin off the weatherman's back? No, right? He could be wrong, you know, 80% of the time, and we'd still probably listen at first, although if he was that bad, we'd probably stop pretty quickly. But he had to be baseline accurate, you know, maybe 55-60% for us to listen at all. But overall, um, it's actually really hard to predict predict accurately, and usually the people that are making the predictions, they have no uh financial skin in the game beyond maybe losing their job as a weatherman, right? So they have to be baseline accurate, but not beyond. So uh ultimately, who's accountable. So the goal of our product that we call Ocean Predictor was uh decentralized time series prediction uh or prediction feeds.

And uh the idea is that you are accountable for your accuracy, right? So if you are correct in your predictions, you make money on average. And if you're wrong in your predictions, you lose money and you leave. And over time, if we set up the dynamics just right, then it can be an arms race for more and more predictions. And so, and of course, this is decentralized, so anyone can do it. They can predict and earn money or lose money. You tend to want to run AI powered bots because otherwise it gets very tedious if you're trying to make a prediction prediction every five minutes, et cetera, right? And uh, and that leads to that's why decentralized, right?

So that it's non-custodial and a bunch of these other benefits. So that's the goal. That's the product, that's what Ocean Predictor is. Um it's in the same space as prediction markets, but prediction markets tend to be one-off predictions. Will, you know, Trump or Biden win in 2024, right? And it's got this sort of speculation in between. Prediction feeds are really streams of information every five minutes, boom. Will Bitcoin USTT pair go up or down, yes or no, five minutes from now, et cetera, et cetera. Okay? So that's prediction feeds. Okay. So that's the motivator, and we said, okay, we're gonna go for this, and we're gonna zoom in on DeFi. Um so we asked ourselves, how do we build and chip this thing?

So once again, the outline, set up the rules of the game, make the game easy to play, kickstart the network, and optimize. And that's what I'm going to show you now. These four steps that we went through towards each of these. So the rules of the game, this is really at the heart of it, the smart contract, right? Um and ultimately, you know, probably the most compelling games are can you help people make money or save money? Maybe you can have other USPs, but if you can do that, it's that much easier. And that's probably why you know finance apps have taken off so much in blockchain land. And other stuff is coming, but it's just harder.

Um, make the game easy to play, so apps, four couple code, et cetera. And so I'm gonna drill into each of these four one at a time. Let's do it. Okay, set up the rules of the game. So the basic idea of predictor is the following. You've got these people that are data scientists who are you know sufficiently crypto savvy where they're making predictions. And they're making predictions into this smart contract on-chain. And then those predictions get aggregated by the chain, and along come traders, that's these guys on the right with the sunglasses, and they buy the predictions, aggregated. And it might be say, you know, a thousand ocean up and two thousand ocean down for this prediction of you know, will Bitcoin, UST pair, and Binance go up or down, yes or no, right?

So the predictors, the data scientists, they submit individual predictions, it gets aggregated, the traders buy it, and then with those feeds, what are the traders doing? They want this for alpha, right? Um so they want to have every edge they can get, and this is one of the edges they can potentially get. Of course, they have their own data infrastructure, et cetera. And on average, even if these um feeds are 51%, 53% accurate, that's enough to be helpful to help bias the decision making that they're running, right? So that's the basic idea. And ultimately the predictors have to be accurate enough to stick around. And the traders, they have to be good enough at trading to stick around, you know, to be profitable even after trading fees.

Uh let's expand this a little bit. So this slide expands in a couple ways. The bottom gray bar, horizontal bar, that is the contract. And then we've got actors engaging with this. On the very very bottom, we've got the data scientists that are making the predictions, and on the top, um we've got the traders. Um, and in the very top gray bar, this is the exchange. So what happens on the left from left to right is time. So on the far left, this is epoch uh an epoch of say uh 10 minutes ago or epoch T, so it's every five minutes, there's a new epoch. Um the predictors, they submit the prediction, right?

Each predictor, maybe one submits uh saying, I think Bitcoin will go up, I'm gonna stake a hundred ocean. The next one says, I think it's gonna go down, I stake a thousand ocean. I'm very, very confident. And the next person says down as well, stakes a thousand ocean. Okay. So overall, the aggregate prediction says down, but you um the trader comes along, they buy the feed, they see, okay, there's a bit of prediction, uh, there's a bit of stake down, but it's uh uh sorry, yeah, mostly up, a bit down. Did I get that right? Anyway, uh whatever the tr uh whatever the predictors submitted gets reflected there in aggregate form. And then they buy or sell based on it.

So um they might, for example, if the majority uh of the stake was that Bitcoin's going up, they might buy in a very naive trading strategy and then sell five minutes later. Typically they would integrate as part of their overall trading bot model, right? Um and then you know, five the naive trading strategy, five minutes later they would sell, or if they had sold, they would buy back five minutes later, or short. Um that basically covers three epochs. Um the original one, uh the trading one, and then the closing the trade. And then once uh the closing the trade happens, it's the same up epoch where we knew know the true value, right? Did Bitcoin actually go up?

Yes or no? And that's when the payout happens. Um the the predictors, uh, if they were correct, they make money. Um, and if they're wrong, they lose their money, right? So the the predictors overall, the data scientists who are doing their predictions, they can get income in two ways. Um, if they're correct, they only get income if they're correct. If they're correct, they get uh all the stake from the other guys who are wrong, and they get it pro rata to their stake, and then um they also get any revenue coming in from the traders who are buying the feeds, uh, pro rata to what the revenue from that is, okay? So this is actually another difference from prediction markets.

Prediction markets, the feed itself is public. In Predictor, the feed is private. So if you want to see this feed to get this trading alpha, you have to pay for it, right? And therefore, uh, if you're a data scientist making predictions, um, it's actually positive sum. It's zero sum where your stakes are sloshing around, but then on top of that, you've got the the revenue from the traders. So over time uh you're making money. And of course, the traders, if they're doing well, they're making money by from the trades on the exchanges. So that's the game. Um how did we implement this game, right? I've described the overall rules. Um four steps.

So, first of all, we had to do tech spikes. Um, in our case, you might have uh inferred already that we had to have privacy, right? When these data scientists submit predictions to the chain, if the chain is um public, transparent, like say if they're in mainnet, then the traders they would just look at that, right? And same thing for the aggregate predictions, et cetera. So you've got to do something else. So we explored a lot of different technologies with FHE, NPC, TEE, a bunch of things, right? And in the end, we we used uh Oasis Sapphire, which is um a privacy preserving EVM chain using TE. Um it just served our purposes very well, and they've been great collaborators.

So now basically we have smart contracts. Uh we chose that uh as the starting point. Then uh what did we how did we proceed? There's a lot of different ways to go about um making smart contracts. Uh myself and my team, we love Python, right? Uh I'm an AI person by trade for you know a long time. And so we initially wrote all of our games out in Python code, um, but it was shaped like Solidity, right? So we wrote it as Python code with tests and all this, making sure everything worked out, the mechanics worked out, doing basic simulations, all of this, right? And then we added fancier agents around the code, you know, um, agent-based, but of course all within the testing framework.

So predictor bots, trader bots, a price oracle bot, all of that, right? So we fleshed the thing out. We made sure that the game still worked. So think of this as verifying the token design, right? But at the same time starting to flesh out the code. And then finally, now that we we had these tests, unit tests, system tests, etc., um we had one implementation that implemented the contract as Python, right? Uh but then we just made a second implementation that also adhered to the same test to path the same tests, and that was in Solidity, right? And under the hood using a Ganache EVM simulator, right? And um, and we were able to leverage the Ocean Core contracts uh for uh tokenized data access and dollars, you know.

Obviously, we're familiar with it, we're ocean. So um that's how we implemented it. So and we found this to be a very useful pattern in general, where you're writing out the core games, et cetera, with Python code that's solidity-shaped, right? Um so that happened to be our approach. Depending on what you're doing, maybe you're doing everything in Rust, that's fine too. I want going was and whatever, right? This is our approach. Okay. Uh whoops. Okay, so we we built the game. We hadn't shipped it yet. Um the next thing we needed to make sure it was easy to play. So it's uh really important, you know, what is it that people are doing?

Well, they're running bots, right? They're not doing this individually because it's too tedious. Every five minutes, you don't want to be sitting there every five minutes and doing your thing. It gets tedious very quickly. And to really make money, it's a statistical game, right? You you can have you know several bad uh epochs in a row. So you really need to be running bots, and it's predictor bots or agents, and trader bots, right? Depending if you want to do prediction or trading or both. Okay. What does that mean? Well, if you're running bots and you tend to need to have ML expertise, these are Python people, right? So you have ML expertise, you're a Python person, and you know a little bit of Web3.

You're not scared of wallets, that's the basic thing, right? So we said, okay, if you're doing that, you run Python, we don't need to have a fancy GUI, we don't need to make this in Telegram or anything. Let's just focus on this. Therefore, what does it look like? Well, it uh how do you onboard people who use Python or code in general? It's README's, that's it, right? So this is great for us. We didn't have to go and build fancy web apps or any of this. So we we built a README for the Python bots, and that actually served as our spec to improve the bots further, further, further. Um, and then we also extended it with a command line interface over time and uh more and more plots too, as you'll see. So that was the heart of it.

So, us as coders, realizing that our users were coders, that made it much easier, right? So um it's not you know um for retail, it's for these prosumers and very specifically data scientists. Okay. But we still want people to build that mental model. Just like five minutes ago, I gave you guys a mental model of what's going on, right? So, how can we build a mental model that people can just go somewhere and build it quickly? So we built something called predictor.ai, which is a web app, and uh I show the first three rows. It's you know, there's 10 rows for 10 different tokens, and on each row it shows basically sort of coin gecko-ish or something, but on the left it shows the asset, and then it shows uh what the price, you know, the first row is Bitcoin. It shows what the price is at 1055, and then uh what the prediction was too.

Was the prediction down or up? And what was the stakes there? And then the the price at 11 o'clock and the prediction, and then the current price, and then finally um the the prediction now for the next epoch, right? And for the for Bitcoin, we actually made this free so that people can see and build their mental model. For the rest, you have to buy it, right? So this is sort of a data marketplace, but a very finely tuned data marketplace just to buy these feeds. So when you buy the prediction, you get a subscription for 24 hours. Okay. So this is helping to build a mental model, right? There's these epochs of every five minutes, and there's stakes up and down, and so on. Another key thing, though, from this on the top right of that page is a button, run bots.

You click it, go straight to the GitHub, right? So the overall flow then for people to discover this, because we want a channel for this, is on the left, people discover by here or they hear about predictor from X doc from Twitter or X.com, Medium blog posts, our Ocean Protocol website. We've got a big prominent link there. Podcasts, conferences like this, and even T shirts, right? So this is an NFT shirt, it's a one of one. So anyway, uh yes, these are and all of those lead to predictor.ai where people build their mental model, and then that has a big fat path, top right, going straight to the README, right? So overall, this is and ultimately we want all people to be in these README.

First click on the very top is you know, run a predictor bot. So that's that's basically the model there. So so far I've talked to you two of these four steps of this recipe. Got two to go. Uh so the first step was uh implement the game, design the game. Second step, make it easy to play. Third step, kickstart the network, right? So what is this? We've got predictors and we've got traders. If we just launch it with nothing at first, then uh you've got no predictions happening, traders wouldn't want to come, and predictors, they're like, why would I be incentivized to do this, right? So you've got to do something about that.

So the very first the one thing we did, as we were researching predictor and so on, we actually had data science people within the team building good bots for prediction. Because we also wanted to validate is there a fighting, can we have a fighting chance of predicting it all? And the answer was yes, right? Typically 50.5% up to 55% accuracy on any given feed. So that's enough, right? That's easily enough for our baseline for alpha and so on. Okay, and then uh we built it, we made it real easy for people to run these bots. So going back to that previous README, it's easy for others to run those bots, but why not run those ourselves? So when we announce the network, when we launch it, we uh have them running ourselves such that there's always a supply of these feeds, no matter what.

Um so that was the first thing. We launched our own bots and we run it, and call this dog fooding, et cetera. And then the second thing is though, um, how do we, you know, other people will be like, okay, well, it's zero sum slashing stakes among each other if there's no sales, right? So let's have some baseline sales to encourage others to come in. And so um you can view it as you know, prediction mining, if you will, right? We call it predictor data farming in our case, and we have baseline sales of 37,500 ocean a week. And depending on the price of ocean, that's anywhere from $20,000 to $40,000 a week, right? Going to the predictors running.

It's pretty good incentives, and that actually has um led to typically between 70 to 150 predictors people per week. So we were pretty happy with that, right? We would have been happy if there was maybe you know 10 people outside of the organization, outside of OPF uh running this, but we've got typically 70 plus. So this was basically solving the empty network problem by our own dog fooding and by incentives to you know, and uh that worked pretty well actually. So finally, we had built the thing, uh, we had shipped it, uh, we had uh uh kickstart of the network by dog fooding and incentives. Uh so the thing is running, the thing is live.

Um, and you know, like rewind to say 2019, right? Uniswap had just launched, but it had basically no traction, right? Completely new thing, Uniswap and Bancor and others, right? AMMs were out there, but no one is really using them that, right? Yeah. Same thing with DAI as a stablecoin and other stable coins, right? Then along comes DeFi summer, and everything blows up, right? Compound had incentives follow, and then that led to a lot of demand around stable uh around stable coins with DAI and then AMMs with Uniswap, and everything kind of blew up, right? But before that, Uniswap and DAI and others were wandering through the wilderness for a year or two.

Why? Because they were completely new apps, right? And we can understand that. There's a lot of completely new apps out there right now that are wandering through the wilderness. And maybe they always will, or maybe they will take off half a year from now, one year from now, three years from now, who knows, right? So we we were humble about our expectations. Uh we thought, okay, this is a completely new product, prediction feeds. Um maybe we'll be wandering through the wilderness for six months, twelve months, two years, whatever, right? Um ourselves. Sorry? One minute. One minute? Okay.

Uh okay, so let's we're dog fooding. Anyway, so we we launched in September, October, November, um, and we would be happy with 10K, 100k volume. But people got into the game, and um, you know, by January, three months later, we are at 300k uh per month. And then uh literally three weeks later, 10x, um, 10 days later, 10x, uh, two weeks later, 10x, two weeks later, 10x. So we actually hit a billion dollars in monthly volume. And this was a brand new product, and we're like, at first we're like, this is awesome, this is awesome.

Uh but at the same time, if something is too good to be true, it usually is, right? So we're like, this is great volume, right? Like overall, super happy with that, great volumes, et cetera, et cetera. And these days, people are celebrating prediction markets at 100 million dollars a month volume. We were hitting 10x that a few months ago, right? So these are pretty cool for a brand new product, and I'm proud of that. But like I said, uh be skeptical too. So we looked into what was happening, and we realized that basically, you know, if you want to make money, you have to stake more, and you have to have higher accuracy. But the guys, there were some people who decided figured out a game where they just stake 50-50. Um, so not trying to be super accurate at all, but they stake a lot, right?

So 50-50 bots. And um it turns out that that's it's easier to be profitable with that than if you're just predicting up or down, even if you're saying 52% accurate. Uh, and you have to be 56% accurate or more in order to beat those 50-50 guys, with if you're just doing one-sided staking. How did we fix that? We made it really easy to do two-sided staking so that if I'm 52% accurate, I actually can um eat all the money of the 50-50 bots. So we did that, and we rolled it out, and what happened? The accuracies went up. They they and they're still climbing bit by bit every day. There's an arms race for accuracy, and the stake went down.

So it went down 10x, now we're at 100 million a month volume. We kicked out the 50-50 guys, which I'm very proud of, but the volume is still substantial. So to me, I'm very I'm proud of this result, right? Yes, we divided the volume by 10, but now we have real accuracy, and that's the real USP of predictor is accountable, accurate prediction feeds. Uh we did other optimizations to help go along. We built a simulator if you're running uh predictions and trading, and then we added plots to it to make it easier, plots on the modeling, plots on the performance, um, benchmarking all of this. So we we built all of this in.

I view it as a CAD tool, and you know, and we keep doing at it, we keep uping the accuracy. Um we actually are dog fooding internally to make money trading, so we're turning into a trading fund in a sense. But ultimately, why? Because we want our users to make serious money trading. Okay, so to wrap up, thank you, Angela. So overall, I started with a question how do you ship a tokenized ecosystem? A token engineering question, right? And I gave a recipe. Set up the rules of the game, make the game easy to play, kickstart the network, optimize. This is the first time that we actually took this recipe in Ocean. And we probably got lucky, but it worked, right?

So and in this case it was Predictor. I described how we did this. And you know, we've hit all-time highs of about a billion dollars a month volume, but still to this day, we've got about 100 million dollars a month volume with this completely new system. So I encourage you all of you to try this out. Go to Predictor.ai, um run your own bots, make some money, and thank you for your time. Thank you, Trent. This is in case you'd like to explore more Trent writes about this work, about the token engineering at predictor and ocean protocol, check it out on Medium. And

Related talks