Relay Mining: Cryptographically Incentivizing Non-Validating Nodes

ETHCC 7 · 11 Jul 2024 · 20:23

Daniel Olshansky, head of protocol at Grove, the company that houses the Pocket Network protocol team, explains relay mining, a way to give non-validating RPC nodes a reason to exist. Each request (signed by the application) and response (signed by the supplier) goes into a sparse Merkle sum tree; the supplier commits to the root and later proves one branch using a closest Merkle proof, and on-chain difficulty adjusts with network traffic. He frames the RPC trilemma of reliability, performance and cost, and describes a pilot extending Pocket Network to LLM inference.

Speakers

Topics

From ETHCC 7, hosted by Ethereum France.

Transcript

Uh hello everybody, I'm Olshanski. I'm the head of protocol at Grove, which is the company that houses the protocol team for Pocket Network, uh decentralized RPC protocol. So prior to this, I worked at a lot of other companies uh at Waymo, at Magic Leap, at Twitter, at Google, did a lot of MLOps throughout my life. Uh, but I got my first ETH in 2016, and I remember actually syncing a full node on my computer uh simply because I wanted to send it somewhere else. And uh I don't actually remember what that where that went.

Uh that said, I'm excited to talk about relay mining today because what we have designed is an incentive for non-validating nodes to exist at all, which is not a which is actually a pretty big problem in the industry today. And I'm also gonna talk about how this solution extends to not just Web3, but also decentralized social and LLMs and et cetera. Uh so this is the agenda. I'm gonna spend a lot of time talking about what is the problem, why are we solving it, just really setting it up uh because I've got a lot of questions about it and I want to make sure it's really really clear. The two things that you should come away uh being able to answer today is why do we need to incentivize read-only relays and how we incentivize read only relays.

So if you're gonna snooze off or open up your phone, these are the two questions uh you should be able to answer by the end. And if you are gonna get bored at some point, the technical deep dive is the time to kind of snooze off. Uh but I think it this is the important part, this is the interesting part, but it's also the hard part. So feel free to ask me questions afterwards as well, in case the uh speedruns are gonna be a little too fast. Okay, so what problem are we solving? And in order to answer this, think about kind of what blockchains were built for at all. Um they were built for secure state transitions.

Whenever we think about blockchains, we think transactions, a secure state transition from one state to another, Merkle Tree's verifying everything. We think about latency, live uh safety, liveness, all these things, right? MEV is an auction for secure state transition. Snarks are just compressed secure state transitions, right? That's what blockchains, that's what L1s, L2s, that's what they're all built for. But fundamentally, when you build a real application like a wallet, the number of reads that you need from a node uh dwarfs the number of writes. Uh and just as a fun fact, I spent like 10 minutes or maybe even more talking to ChatGPT on how to like anthropomorphize uh network requests, and uh this this is the best I could come up with.

Uh so I thought that was pretty funny. Okay, that aside, so blockchains were meant for rights. Uh, but RPC nodes is a completely different industry, right? That's those were meant for reads. Uh, if you came from a web 2 background, you've probably you know done a system design interview at some point and so but having a load balancer, horizontal scaling, right? This is where all of these companies come in and they solve for latency, they solve for round trip time. They charge you not based on gas fees, they charge you you know per request. Uh and quality of service uh becomes a completely different problem to solve.

So, right here we have a lot of different companies that provide RPC services, but what you'll notice is that very, very few of them actually have blockchains. So Grove and Pocket Network, we're an RPC provider that has a blockchain. I know Covalent has a token as well. Uh I don't think they're an L1 at the moment. But most of the other companies are just, they provide RPC services because it is a different problem. And the way I want to show that here is literally if you compare the if you compare these two charts, these two dashboards from different websites to understand what is the most performant RPC provider or what is the most performing blockchain, they're evaluating 100% different metrics. And in the same way, if a blockchain is kind of like making a like growing a potato, then an RPC provider is like serving fries, right?

You need you need a potato, you gotta cut it off, you get a fry it, and then you serve the fries. Uh so related but very, very different. So let's answer the first question. Uh why do we need to incentivize read-only relays? It's because we need to attract high quality supply. We need to attract uh providers and DevOps that can solve this problem. Um because blockchains were not designed for this at all. And the way I want to really hammer in this point is a few years ago, I think two, three years ago now, Moxie, the founder of Signal, uh, wrote a blog post where he said that even nerds don't want to run their own servers anymore, right?

Nobody wants to run their own full node anymore, except for uh 20, 16 year old me who uh I don't know, you know, because I wanted to send one ETH somewhere. Um what he didn't realize is that if you give nerds an incentive, uh, if you give DevOps engineers an incentive, then we can really build a solution here. Okay, so how do we solve it? Um, we solve it through experience, uh, through through pragmatic technical trade-offs, and by giving the customer what they need. So let's let's start with the experience.

Uh we've been on Maynet for over three and a half years. Uh we have a thousand validators. We settle uh more than 600 million requests a day on a decentralized network of RPC providers. We have real revenue, real product, like it's not just an idea, it's been in production for a long time, and we've seen the lots of highs, lots of lows, uh, lots of customer support requests, both centralized and decentralized. But if you have ever been to one of my presentations, uh you might have seen this slide, the RPC trilemma.

Uh so it's reliability, performance, and cost. That's that's not where RPC came from, but I'm gonna keep presenting this slide until it becomes mainstream. So go please go and tell all your friends that the RPC trilemma is a real problem, and Pocket Network is leading the charge on solving it, but there's also a lot of other great projects, a lot of other great teams helping us solve it along the way. Now I said that we'd solve this through pragmatic technical trade-offs. And part of that is decoupling, like vertically, vertically decoupling the responsibilities of quality of service and on-chain verification.

So the way this works right now is we have a gateway, which does what we call permissionless quality of service. Not gonna do a deep dive into that today. But what I what I am gonna do a deep dive into is the on-chain verifiable counter, right? In the same way that Bitcoin is a time-stamping server, we have built a new primitive, and that's what I'm gonna explain today. But before we get into it, something that I also kind of like to mention uh every now and then is that decentralization is not the goal. Right?

Decentralization is a byproduct of a permissionless and incentivized system. If you need a lot of supply, they will come. If you don't need any supply, they will leave, right? As long as you're getting a good customer, as long as you're providing a good service to your customers with a good quality of service and it's permissionless and incentivized. Decentralization will increase or decrease depending on what the needs of the user and the market are. And when you try to build a business, uh right there on the right, on your right, is what customers want, just cost and quality. This is what we always talk about, like how secure, permissionless, incentivized, verifiable, censorship resistant is, which is really really important, right?

That's the long-term vision, that's the ethos, and we enable it, but fundamentally, in order to succeed, we focus on what's on the right. And uh that took a very long time to really uh accept that that's the reality. Okay, now we're beginning to get into DD, but not quite yet. I want to explain uh some of what the actor topology is like in Pocket Network. There's a lot on the screen, so just kind of take a moment, maybe take a photo. Uh let's look at what's happening here. We've got applications, we've got gateways, we've got suppliers.

Requests can either go through a gateway, they can go around a gateway and directly to the network. So it's up to you how you want to use the network of suppliers that we have. And up there at the top, I don't really care what we call it. It could be an L1, a blockchain, a distributed ledger, a data availability layer. They're all the same as far as we're concerned, but we are an L1, we're owned with our own DA layer secured by our own validators. But that's kind of not the core of what I'm going to be talking about in a moment. And what I am going to be talking about is this relay miner.

This is a simplified version of what I just showed you. And the relay miner is kind of a sidecar, it's a process, it's a coprocessor. But it's a pretty big coprocessor, so that's why I have a bus. But because that's where the magic happens, I decided to add a little photo of a magic school bus. I hope you guys enjoyed that. Okay. This is the real deep dive. This is a technical deep dive into how relay mining works. Uh, and this is a mouthful, but you can think of it as a dynamically scalable, non-interactive frog proof. Uh again, I already use the Bitcoin analogy of like you mine for new blocks.

Here, everything is useful work. You serve RPC requests, you serve our PC requests, it's all useful. Uh, but when you hit a certain a certain request uh that matches a certain hash, you get paid for it. And we're gonna show how that works in a moment. But the key thing to remember is that this is a new primitive, right? This is a primitive that can be extended to any other blockchain. It's a perimeter that can be extended to any other rollup. It verifies the volume of RPC requests that you have served, and that is the incentive that makes RPC nodes service requests. It's composed of two steps, building a tree off chain, and then we go through a commit and reveal scheme, which we call the claim and proof lifecycle, where you actually put the commitment and then prove it later.

We use a bunch of very classic uh simple cryptographics key schemes, sparse miracle trees, uh collision mining, DSAs. Uh but we did have to build a few things ourselves as well. Right? We took an SMT, made it an SMST, and then we also uh kind of innovated on a closest Merkle, uh a closest Merkle proof, which hasn't been done before. Okay. Step one of six for relay mining is a session. We match an application to a supplier, and then the suppliers basically like let me serve as many requests as possible so that I can get paid as much as possible uh throughout this 15 minute session. We basically give them an option.

In the same way that a Bitcoin miner is not forced to mine blocks, a supplier is not forced to respond to your request, but they have an incentive to respond to as many of those as possible. And if they don't, then they go they don't get paid anything. Theoretically, they could respond to a hundred million requests and get paid nothing, but probabilistically speaking, that's almost impossible. So let's just say you sent a request, you get a response, it's all good, and it's one of the golden requests, it's the one you get paid for. We bundle all of that up into a structure.

You take the request, sign it with the application key, you take a response, sign it with the supplier key, put it into that structure, hash it all together, bada beam, bada boom, put it into a tree, super easy. Um it actually is quite easy, but it's the design and the schema that enables it, where is kind of where the magic is. So every request response pair goes into a leaf, that goes into a tree, and then we commit to the root of that tree. Pretty standard uh Merkle tree sort of um uh approaches.

The difference that we made is that it's an SMST. So the number of compute units that you serve throughout that session, that limited time window where you had an opportunity to serve requests, uh, we sum it up, and this is again verified at every single branch and in every single subtree uh within our SMST. Now in the current version of the protocol, which we're rewriting completely, and the new version is going to be launched uh later this year. It's actually uh the first test net has been released. We're gonna be able to support basically an unlimited number of relays.

Because when we were handling about three to four billion relays a day, we started hitting scalability issues. Uh you can think of the these coprocessors. Uh, you can't insert hundreds of millions of requests within a very short period of time. So this is why there's an on-chain modulated difficulty based on the overall traffic of the network that goes up that goes up, that goes up and down, depending on um how many previous requests were solved. So, for example, if we lose supply and we lose demand, that difficulty will go down. If both go up, that'll increase.

And these are on-chain parameters. There's events. It's very easy to follow along. Uh, but this works. And we've put to uh we've put it to the test through some stress testing. Uh I'm gonna go through this pretty quickly, but the entire claimant proof lifecycle is non-interactive and on-chain. The TLDR uh is that you commit, but later you only have to prove one small, only one branch in that entire tree. The issue is is that since it's a sparse Merkle tree and not a complete tree, you may hit a branch that doesn't actually exist. And this is where the closest Merkle proof uh kind of came into existence, and that's why we had to actually invent something new and novel uh for this end-to-end lifecycle.

Uh I'm kind of before I continue. I'm kind of curious uh from the audience. Raise of hands if you got all of that. Uh let's do questions at the end. But I'm actually gonna okay. Can I also raise up hands if you got half of that? Okay, okay. Raise of hands if you got 10% of that. Okay, all right. We got we so between 10 and 50 percent. That's why I have this slide. The TLDR. Uh so the way we incentivize read-only relays is by having suppliers sign, commit, and prove their work, and then there's a lot of crypto cryptography that makes it happen. Uh, and this is all public and it's documented.

You can check out our docs later too. Um there's a missing slide, but what I want to do now is we've thought through many different analogies to help people understand what this core primitive really enables. And there's a lot of different things, a lot of different analogies compared to the OSI networking stack that we've thought about. So for example, there's projects that you can think of as Airbnb for hardware. We're more of an Uber for network requests. That's one way to think about it.

You can also think of uh pocket network as incentivized TCP IP. You can think of it as multi-tenant rate limiting. So if you go to a centralized cloud provider, they usually rate limit you. But what if it's multi-tenant and it's across different uh different actors? There's lots of different ways to think about it, and hopefully, one of those uh you can kind of associate with. So that was uh one of the slides that I've place. Uh so that's the first question I usually get.

I usually get what's an analogy. The second question I usually get is uh whether we can be a roll-up or whether we are a roll-up. Uh so the answer is yes, no, and maybe. Uh yes, because we take hundreds of millions of requests a day and roll them up into small proofs and claims. Like in a sense, we're our custom app chain roll-up. Uh we're not a roll-up because we have 1,000 validators. Uh, we are an incentive for non-validating nodes, so incentivizing validating nodes is even easier. Uh, kind of lots of really high quality validators on our network.

And maybe because we've what we've worked with RAS providers, I've spoken to a lot of uh roll-ups, and we end up being the backbone for them because everyone needs someone to run a full node for roll-ups to access the data. Uh, and they actually end up coming to us uh so that we can incentivize our network and run full nodes on the or have uh actors on our network run full nodes on their behalf. Okay. Uh I wanted to end with future work, but you know, you guys know it's 2024. We need to talk about AI, uh, especially with a background in AI, when um I we kind of had to make this happen.

But it's not that we only had to make this happen, it's I run a lot of local models on my computer when I develop, when we work with a team, and one of the issues I really hit is that I don't want to keep downloading models and running them and losing energy and everything else. I just want an RPC endpoint where I can hit any LLM that I want. So we are actively running a pilot where we're expanding pocket network to LLMs. And the reason we're doing this is literally because in the same way that an RPC request is you make a request, you do a query, you get a response, you make a request, you do LLM inference, you get a response. The architecture, the design, the hardware, everything we have in place expands really naturally into LLM inference.

And I've been speaking to a lot of projects and a lot of operators that have occasional idle compute, uh, they're interested in collaborating, uh, and we're gonna be targeting that kind of mid-tier sector when you don't necessarily we're not gonna be the best for low latency LLM inference because you're gonna need the most powerful NVIDIA GPUs for that. But what if you're using LLMs as LLMs as part of your CI CD? Or you're okay with waiting 30 seconds for it to review your document or your presentation instead of 10 seconds when you're talking to it when you're talking to a live. There's a really big list of use cases, a lot of idle compute that we can leverage.

And we've actually we released a light paper about this about a month ago. This is kind of the next big thing after the major protocol overhaul that we're focused on. So the call to action is that if you have idle GPUs or need chip inference, or if you're if you need if you're building a roll-up and you need someone to run your full node, uh do reach out to me. Lots of different links here and uh X handles as well. That's really mining and uh thank you very much.

Thank you. We unfortunately have no time for questions, but you can catch our speaker after the talk. Thank you.

Related talks