New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Cracking Nanopayments: how to transmit tiny amounts of value using probability by Travis Cannell

Ethereum DenverMon, Oct 9, 2023, 12:00 AM

Imagine the possibilities if you could send a tiny payment with every data packet you send. Long an elusive ""white whale"" in the crypto, payments, and finance spaces, nanopayments are a way to send infinitesimal value from one to many parties. Orchid recently developed an API so you can build with the same technology that powers the bandwidth marketplace. Come learn about what is possible Orchid’s fascinating layer-2 technology. In this workshop we will be funding an Orchid account and then stepping through what is required to send a nanopayment.

Transcript

foreign [Music] testing all right we're good to go hello everybody I'm so happy to be here I'm Travis canell from orchid and uh we're very well known for our bandwidth Marketplace and we happen to have a VPN application that runs on that bandwidth Marketplace uh gives privacy to a lot of people around the world today I want to talk about one of the core pieces of technology that our VPN app uses to send really really tiny payments and it allows the VPN app to be uh one of the only pay as you go VPN apps where you're sending tiny tiny Miller pennies worth of payments to the VPN provider as in a continual payment stream as that VPN provider is providing you service which is very trustless because you're not trusting Somebody by paying them five dollars a month and hoping that they're not going to screw you at any time if they're screwing you you just stop paying them and then they stop giving service so Nano payments are away so that when you're trading in a decentralized and trustless Marketplace you don't build up too big of a credit balance on either side of the equation uh the payment system are very scalable um and so what I think about this talk I think one of the core pieces to think about is what is a theoretical minimum size payment you can send probably something in the order of like a clock cycle you can't really get much better than that and you know we think that we're pretty close with Nano payments uh in getting there in terms of the few key operations that you need to do to send a tiny payment and then we use uh the law of large numbers and probability to send and transmit that value um so that over time the on-chain payments sort of represent the probabilistic payments that get sent so today what I want to cover during this Workshop is just discussing this concept a little bit I want to show you our dap and how you can move money into our L2 which uh what I just described we kind of describe it as a L2 payment protocol so uh it runs on nine different blockchains right now so we're on Avalanche and binance smart chain and ethereum um or even on optimism which makes us an L3 but uh it's kind of how we like to send but uh or we we want to we want there to be sort of options for you we kind of have this idea that your L1 is a commodity for rl2 um and then lastly I want to show a couple of examples so orchids VPN app is just an application that uses this Tech and uh I have another sort of demo that we have hacked together for you guys to show you some other cool things that you could use we have two bounties right now for anyone that can use Nano payments in their system so anything that requires paying for some compute resource or something that is very small in value of course bandwidth VPN bandwidth is a commodity it's not worth very much and that's why when you're running the orcid VPN you're getting kilobytes of bandwidth and paying um Miller pennies for that um so I'll go ahead and show you guys so this is the uh the Orchid dap and one of the core things about orchids L2 that makes a little bit different is we actually manage two sets of keys so we have a your L1 key which is going to be managed by metamask and then we roll and use a second set of uh keys that are your L2 keys and I don't want to get into the reasoning why that we have those two keys uh it was for some decisions that we made early on and um it but essentially how it works is you can select here so when I set the nine blockchains here they all are so we're on Aurora Avalanche binance cello Phantom ethereum optimism and polygon I'm going to show gnosis right now because I just happen to have a gnosis wallet with some X die in it so uh and once I connect that wallet it shows me my wallet balance um and then here's where I put in the public address of my second set of keys my L2 keys and right now you can roll that using like the web3 library there's a lot of different ways you can manage your own Keys pretty easily just need to roll a new ethereum wallet and then you put in the public address here uh our app actually the VPN app has a manager and you can actually roll a new identity which is kind of the word we use for the L2 Keys the public address of L2 keys you can copy it here and get a little warning saying hey this isn't a ethereum wallet and when you put this in here then you've now connected up like all the key parts of an orcid account which is again the L1 key the lq2 key and I can now move some money from my balance uh you know in into the orcid account which is nice on gnosis it happens pretty fast and um and the balance portion of the orcid account is how you pay for things it's just what gets spent down and then the deposit portion is another thing that you uh you have to add some funds for the deposit prevents a double spending attack on the network uh for a reason that I'll get into in a second tier but I just wanted to show the DAP this is how you add funds and kind of looks like a then once this updates you can see that this is 95 99 efficient and I'm going to jump back to the presentation and kind of describe a little bit more about how this sort of works now so um and I'm just going to jump around because I want to get into some of the examples for you guys and so basically uh when you're sending a nano payment what you're going to do is you're set you're using the large numbers and probability so the idea is that rather than some sending somebody a dollar you send them a one out of a hundred chance of winning a hundred dollars so if I'm trying to send if I'm trying to pay for something and I want to send you a dollar rather than sending a dollar a hundred times and incurring a hundred transaction fees I'm going to send you a one out of 100 chance of winning a hundred dollars and if I do that enough times the right amount of value is going to be sent so that is where the probability comes in we call it stochastic payments uh we call it Nano payments probabilistic payments uh it's it's an interesting concept um and essentially you use that probability to transmit value so uh there's a couple of other details in there the receiver um the payee generates a random number the payer receives that number and then uses their L2 private key to sign what we call lottery ticket and send that payment and then the payee every time the payee receives a lottery ticket they're like cool and it's like a scratch lottery ticket and they see if it won or not using the claim call and the money is all held in our um nanopayment smart contract which is the Smart contract that I just showed you that our dap talks to that's on nine different blockchains so if that is a winner the claim call Will correctly pull the right amount of money out of that account and send it to the payee and the payer will be debited and all is well so basically when you're running our VPN app what's happening and a lot of people come up to me and they set up an orchid account and they're running our VPN app and they don't understand why their balance isn't going down immediately once they connect and what's happening is that uh they're setting up a balance and then they're starting to send these lottery tickets but they don't send enough of them to to trigger an on-chain payment and uh so it kind of goes down in chunks the way is one way to think about it but as you're using our VPN app or any application or hopefully somebody can build something here today using this print payment protocol but what you would expect is that as you're sending this stream of small payments for some sort of very cheap resource uh that over time uh the on-chain activity is going to reflect the sort of probabilistic theoretical activity and so that's what we see our app has been live for uh three years now and uses this scheme um you know so we have successfully been sending all these these payments and we're now branching out to look at other use cases for this technology of sending really tiny payments um so you know in our VPN app and I'll jump into our VPN app right now there we go yeah so um here's what our VPN app looks like uh I'll go ahead and connect it'll probably scrub my internet connection but uh basically I have a an account here with oxt and uh right now I'm connected to a VPN server and it is using our payment protocol to pay for this tiny amount of bandwidth that I'm using right now and um and that's that's kind of how it works uh you know at any given time the the VPN server the provider in this decentralized network is getting enough payments where you know if I if I stop paying them like no one's out any money here so that's one of the nice things about having really small um really small payments again and we have an account manager and so you can kind of when you grab when you start using your L2 Keys you can actually have multiple accounts and things like that but um uh you know this is kind of one of the core applications that we have running that uses this Tech and what I'm excited to show is what this is kind of what we hacked together we're calling this Nano diffusion so is anyone familiar with stable diffusion people been doing some image generation out there yes um so you know what what what does it cost to generate an image it's like a couple seconds of GPU time really depends on the size of the image the version of stable diffusion that you're running but if you're using a really modern GPU you're talking about it's like a couple seconds per image um and so how could you possibly bill for that you know if I don't know if you guys are familiar with mid Journey or some of these other payment systems that of course you always have to have this like monthly payment model for API requests so if you you know want to charge somebody it's like inferior has this problem anyone that sits behind anyone that's trying to Bill people for API requests has this problem and they're like well we're going to tear this thing and if you want to use a little bit we'll charge you five bucks and then if you use more it'll be 10 bucks but it's never really perfect uh you know and historically you've just never been able to send really tiny payments because really tiny payments credit cards actually require the use of uh you know they have like a 25 cent minimum fee which like you can't that's so high for anything like this that we're talking about uh but here we kind of hacked together this little demo we have now uh created an API for our nanopayment system that is using this and so you can connect an account and again the account is really specified by the L1 funder which we call the funder which is like you're usually managed by metamask and that's how you moved funds into the L2 and then our uh and then the signer which is your L2 kind of keys this is a the actual key uh I know that's not really secure but we only have a couple dollars in there so I trust you guys so we'll uh send in our prompt and here we can see in the logs that we kind of have this little system that we hacked together that is correctly um charging the user for uh one I think it's actually three runs of this no it's one run yeah so this one image was about eight mil of pennies that you can see here and so this has been correctly billed from this orcid account to pay for the exact amount of GPU usage that this provider wanted to provide so this is kind of a scalable system where you could come in you could make five images you could make five million images uh and the building would all work out and you know it's one one of the things that or can we think about a fair amount is you know what kind of business models and what other cool things people could build if we weren't under the tyranny of different business models on the internet today the first one being the advertisement model like I wish I could just load up a website and send somebody eight Miller pennies and be like I don't want to see any ads ever again never do that to me don't cookie me don't do all this stuff like I'll just pay you for your server resources or pay you for this article maybe it would be 20 cents for this article or whatever you wanted to charge me but there's just really no good payment system that can handle you know tiny payments and larger payments uh kind of together so um that's the core of of the kind of nanopayment system and I'll jump back over here so to do yeah I think you know there's some trade-offs here so one of the really nice things about this system again is the ability to send tiny payments settle things up never run an account balance with anybody that you're trying to trade with um one of the trade-offs is finality so obviously if you're trying to get your money out of an exchange or something you don't want them to send you a probabilistic amount of money that may or may not you know you may may or may not be able to pull out um so we're trading a little bit of immediate finality uh for the ability to kind of scale down the amount of money that we're sending because all these payments are going off chain and you know what are the costs of selling the payments so it really depends on the like uh when you think about sort of the cost how the costs all kind of roll together in this system uh the it really depends of course on the L1 that you're on but um I think it is about I forget the exact amount of gas costs right now but um you know and on on gnosis which we like to to use a lot I mean it's like a couple pennies uh per transaction which is really nice ethereum obviously kind of depends on what's happening on the network so um and I guess lastly one other thing I want to describe is that you know in our dap we have this notion of efficiency when you look at an account and what that really means is it's kind of like um when the provider goes to claim money from this orcid account the efficiency is uh how much in the gas costs they could expect to pay so uh the one the provider gets a winning lottery ticket they have to go into your Nano payment account and pull the money out and obviously if when they go to do that if the gas costs are spiking on ethereum and it costs a thousand dollars for them to get that money out of that orcid account the efficiency of that orcid account is very low if not negative so um you kind of have to have a lot and this is kind of related to how big your deposit is so um hopefully that was a good enough explanation uh but but basically the yeah the efficiency of these excise account is typically always 99 even with a smaller ten five cent 20 cent deposit um but you know here's an account that basically has and we also kind of calculate how many tickets you have remaining so each payment uh is twice the size of your deposit so this has um oh it's half the size of your deposit so then you have uh nine tickets that are available on this Orchid account um yeah so uh you know and yeah this again you're paying like eight mil of pennies for this GPU time and settling up with this provider who's providing this service right away without having to do any sort of crazy ad Revenue business model or sell your user data business model or paying a monthly fee that you might forget about business model I think the whole internet is a software as a forget service you know it's like what am I paying five or ten dollars a month for that I totally forgot about and you know I used to work in advertising and you just test that landing page which is like well maybe it's free for six days or maybe it's free for five days or maybe it's free for ten days but you got to put your credit card in and you know you as a user like oh I'll remember I'll remember to cancel that in two weeks before they bill me I definitely will definitely remember that and you never do and then a couple of months goes by and you're like what is this thing um you know we're hoping that with the ability to settle and send smaller payments kind of open up some more uh business models here on the internet and I'm kind of curious if there's some questions out there uh happy to open up to anyone that's followed along or is there any part that haven't described yet or you don't understand yeah sure foreign thanks for the talk um just uh with regards to the settling of the basically the lottery ticket right do you see uh of even a possibility of people gaming it so you know let's just say it's one in 100 chance and then you're using the service and oh cool I've used it you know it's been queried like 50 times or something I haven't paid I'm gonna just start a new account and then keep going right it's just a cynical take but I'm curious what what you're thinking yeah I think I think probability is one of those things that uh yeah I mean if you use it 50 times and the payment isn't triggered I mean arguably you still sent value because I think really how we think about it is that when you send one of these lottery tickets value is being transmitted just because it's a fair Lottery that's provable and it's governed by a smart contract so you if you're trying to if you're doing that and I'm taking lottery tickets from you and giving you a service it's really on me to make sure that the lottery tickets that you're giving me are valid and just because you sent me 50 and a payment didn't hit you know doesn't really mean it it just means that like if you keep liking the service and you keep paying me you know using the law of averages and large numbers like over time the right amount of value is going to settle but you know you're right on in terms of if there's very few payments and the and and the numbers are very large it does start to feel like gambling but if you start to think of like uh you know if you imagine like you're just if if it hits it's going to be three cents on gnosis that's paid out you know and then you're sending these lottery tickets that have a one in ten thousand chance of paying out three cents that's kind of what's powering our bandwidth marketplace right now so when you're using the VPN those are Quasi close to the numbers that you're going to be paying uh on the gnosis Chain um so it's really about trading and like if you're getting good value for your 50 probabilistic payments you're going to want to keep trading with me you know and so then it's one of those things at any time if I look at your lottery tickets and I'm like you know I can see from your lottery ticket how much money you have on deposit in the smart contract and how much is in your balance so I know like oh this guy doesn't have a deposit I'm not gonna you know I'm not gonna trust this guy uh and the deposit on the orcid account when you move money into the L2 using our dap the deposits locked for 24 hours so that kind of gives the provider 24 hours to get their money if you give them a winning lottery ticket so hopefully that was kind of this kind of a long explanation but that was a very good question and there's even other little pieces where imagine not that you know you could send 50 payments and never you know one never hits and you're you're stoked what if you send two payments and then they both hit it so that could happen as well so you know that's where you have to send enough payments and trade enough over time to where it's going to sort of make sense because you know you could start up the Orchid VPN app and start buying bandwidth and then just right out of the gates you know you're charged three three cents and you're charged five cents uh but you know just that's kind of how probability works so you got a question yeah sort of in the same line of thinking here I'm I'm maybe I missed the explanation but um what what's the rationale behind the the stochastic payments like is it because you you're trying to uh not have to wait for settlement of the transactions or is it just a smaller transaction like a commitment or something yeah so the the benefit here is that you can lower the transaction costs for sending one payment so it's it's all research actually that's based on a really good paper called micropay that was actually done in the 90s like way before any blockchain Tech and they were they did it because there's a minimum credit card transaction fee how can I pay five cents for something that was what they were trying to deal with there's really no way you know or or you can pay somebody five cents the credit card jumping is gonna you know they're gonna charge you 25 or 50 cents per transaction so the amount of money you're transmitting is like nothing compared to the fees so enter the blockchain world and you know I could send you so if I want to send you you know a dollar a hundred times as you're providing a service for me I'm sending you a dollar you're providing me a service like you you're running your GPU I give you a dollar you're giving me cool stable diffusion images and everything's good and I keep doing that well if I send you a hundred dollars you know we've just incurred a hundred transaction fees on the blockchain so the whole idea of stochastic payments is that we're sort of mitigating that we're rolling those up into one transaction so one really good word that we also use is probabilistic roll up so we're kind of like using probability to roll up transactions rather than you know taking all those transactions like a real roll up Works we're just kind of using probability and so the big thing that we get is the ability to send small payments and I've been talking about cents but you know it keeps going down so you can send payments for Miller pennies or less uh to almost where it gets like ridiculous so it's like even calculating like the number of payments you could send almost just doesn't make sense because it's it's you know it's just it sort of depends on how small of a ticket you want to write and then then basically you get limited by the computation time to read a ticket and decide if you want to accept it for payment to not so yeah so um I don't know if there's any other questions I'm happy to answer them um just keep your hand up we'll send a mic over there just want to pitch our bounties we have a bounty right here GitHub orcid protocol Nano paid demo you can find more information about that or on the The Bounty platform uh my question is about the roll up so when you roll do you like is there an Optimum time when you like okay we've got a full block and that's when we do the roll up or is that also how is that well okay so roll up it's just it's more of a kind of like a an easier way to explain it but what basically what I'm saying is if I send you a hundred chances to win a hundred dollars so I send you a hundred payments and each one is a hundred chances to send you know uh to for you to win a hundred dollars I think I said that right but I think you get the gist of it the roll up happens when you get a winning ticket see so I sent you these hundred payments and then suddenly you're like oh this one's a winner and then you grab the hundred dollars from me that what I'm saying is a roll up is that represents probabilistically a hundred payments that I've sent you and as our friend pointed out here you know there's a little bit of gambling here because we're talking about probability so it's not always going to perfectly land and the the larger payments you send with a fewer amount of transactions the more variants that you'll variance is the mathematical term for that but the more variance you will experience if you send smaller payments with under like you know more of them so you send a thousand payments for a penny each then we're going to settle up more and there's going to be sort of less variance but yeah we describe it as a probabilistic roll up in that way we're using probability to roll up these transactions into one on-chain payment and so our API um kind of lets you set the ticket you know when you send one of these payments the question is what's you know what's the win rate what's the probability that the receiver is going to be a winner and if they win how much is that going to be worth you know and that's kind of how you can mitigate how much money you're sort of sending and um you know here's some links here you can take a screenshot of this if you're interested and for all the hackers out there come find us we're Orchid get the Orchid uh purple t-shirts on well actually they're gray as well uh but we'll be hanging out around Tierra for the next little bit I'll be off stage and we'd uh love to help you with the Bounty or answer any further questions thank you [Music]

Automatic transcript — names and jargon may be misspelled.