Building an open commerce protocol as public infrastructure
EthPrague 2024 · 1 Jun 2024 · 24:03
An open protocol for crypto-native commerce in physical goods is proposed as a shared data layer that no single platform owns, in contrast to siloed marketplaces that can price gouge and raise barriers to competition. Merchants and customers sign events covering inventory, listings and orders kept on relays reachable over websockets, relays compute store state and put a state root on chain, and two small contracts cover shop ownership as an NFT and payment handling. The talk compares this with OpenBazaar's node-per-device design and a permissioned government protocol, and notes that inventory counts stay visible to relays. Asked about disputes, the speaker says a listing's payment address could point to an arbitration contract.
Speakers
Topics
From EthPrague 2024, hosted by ETHPrague.
Holešovice Market
Transcript
[Music] all right so up next we have two speakers uh Martin a veteran developer in the space creator of ethereum JS and ewom as well as moo who in the last decade uh has been in the field of um decentralization and enhancing uh privacy so welcome to the stage both of you and thank you give a round of [Applause] applause hello everyone uh I'm Martin and moo um we're going to talk about uh building an open uh Commerce protocol as a public
infrastructure um so yeah we're hopefully going to explain why we want to Proto protocolized and why that's going to be good for everyone um so uh I think I've been in crypto for quite a while and um defi has been a lot of fun over the last few years it has given liberating access to financial Concepts ideas and markets that people never had before um and this is great I think but I think crypto can really be used in more than just this like it needs I think it can break out uh into the real
world um so to complement financialization that we see in defi we are proposing on to build open infrastructure for crypto native Commerce of physical items so a decentralized Marketplace for physical Goods so not only can you swap tokens for uh Doge tokens you can also buy your Doge pizza that is their goal um so in this talk uh I'm going to describe we're going to describe like why we're doing this like how it's going to be done the architectural comparisons of what has existed before uh and some
privacy aspects um to this oops okay um so first why are we doing this um many of you have probably heard the rally and cry protocol not platforms so we'll go over that we think that the Advent of blockchains allows us to tackle some of the um old and persistent issues with decentralized protocols um that that you've probably heard about um blockchains also introduce a whole host of new features um that help us to tackle some of the challenges of existing uh Commerce um and of course crypto as currency which I'm sure I
don't need to explain so protocols not platforms what do we actually mean by that so the difference between a protocol and a platform is that the protocol is a set of specifications that anybody can Implement so it's permissionless and it's locked open it can't be closed further down the line um in our case what this means is that we want to create a shared data layer um and this is this helps to challenge the current kind of platformization of Commerce which is where we have these silos of data um that allow because of the lockin that they allow they create a situation where these platforms can um exploit the users that are registered on them so
they can price gouge um and they create very high barriers to competition um so so by creating this shared data layer we're actually lowering those barriers to competition allowing more applications to be built on top um and encouraging like a more thriving kind of ecosystem and what this shared data layer also allows us to to do is that the data is no longer owned by the platforms but it's owned by the user so the user can then make the decision themselves whether their data is um consumed by a certain application or not um one of the exciting challenges about this actually is the Privacy versus Discovery challenge so at the moment
when you have all this siloed data and the platform owns all of your data they can serve you recommendations so they can run recommendations over it recommendation uh engines over it sorry and they they can serve you things that you maybe want but don't realize you want um and so once you apply privacy to that that becomes much harder and we find it quite an interesting Challenge and we have a few ideas about how to um Implement kind of self self- selected Revelation um so you can choose what data you want to reveal and you want to be recommended Things based upon um and what data you would rather keep private why add a blockchain to this so some of what we're trying to implement can be
implemented without a blockchain um decentralized protocols uh long preceded blockchains um but some of you may have heard Moxy Marin spikes talk from several years ago called the ecosystem is moving about how difficult it is to um govern and run a decentralized protocol when you can't when you when you lack coordination mechanisms and you also lack monetization mechanisms so I've spent the past 10 years working in offchain decentralized privacy enhancing Technologies I've spent a huge amount of that time writing Grant applications um and it has been a challenge um to keep these systems maintained and keep them being continuously developed and
blockchains allow us to address both of these challenges they're an excellent coordination mechanism and they allow for everybody who participates in the ecosystem to be rewarded for that participation um blockchain also allow us to introduce a whole host of new features what we know about existing um Commerce platforms is that they lack Provence so Providence was one of the first ideas to be to to be raised or to be to attempt to be applied in the blockchain space um but back then the technology wasn't mature enough and now it is we have projects like circularize that are coming up that um that document kind of supply chain verification and that's quite exciting for um purchasers and they've also got we've got
reputation and verifiable reviews so what we know is that with a lot of existing Commerce platforms verifiable reviews are extremely challenging Merchants can completely game the system and we can no longer trust what we see um blockchains make that verification um a lot easier to ensure blockchains also um allow creators to um Implement a whole host of new community building Community reward like loyalty reward mechanisms and they allow for fractional ownership ship and collateralization all right so I'm going to give uh a bit of a technical overview of the system I'm going to start with defining uh what this protocol like the
boundaries of the protocol like what it's actually doing or taking care of um so um I have listed uh inventory is the first thing it it uh manages the inventory um and and the listings listings are obviously tied to the inventory um and then orders so orders are when a end user is purchasing something all the way up to shipping uh orders track the state of uh a set of listings transferring ownership then lastly uh we it uh we look at payments and check out flow
those are like the four domains that we're concerned with um and here's our design goals the system should be delegatable and we I mean something very specific here um the merchant should not need to stay online for a customer or user to see the listings or to purchase an item uh so that work should be we should be able to delegate that to someone else it should that delegation should be trustless uh and it should be censorship resistant and lastly it should be
accessible um what I mean be what I mean by accessibles here is that uh we want the uh uh listings to be reachable from uh using regular web technology in our our case we're using websockets um we don't want to require users to have to download a special client to access this network and this is in justos to some earlier designs that um we'll talk about so how are we doing this we have a relay system if you're is anyone
familiar with any of these projects Noster Blue Sky Scuttle butt okay so they all have a similar concept uh of relays personal data servers or pubs but they all essentially do something similar and that is um hold signed data from users and Reserve that so our relays are very similar um they're designed to have minimal trust so everything is signed by the merchant by the customer it's put onto the relay and then uh you verify it uh it does have a data availability problem potentially I will
admit that because like relays can go down um so it's up to the merchant to have more than one relay if um they're worried about data availability everything is an event sourcing model or a simple log so uh all the edits to the store um are sign messages that are put into a log that are put onto the relay um this should sound familiar with you for probably because you know blockchain Works similar you have a log of transactions relays can sync between themselves so that is something a little bit different than uh Noster or um blue
sky that their relays uh don't do that um and then clients sync from the relay just download the vents verify the signatures and additional the relays also compute the state of the store so we have a like a materialized view so you know uh all the edits to a particular listing it's going to compute that listing um and then it mizes the state and puts the state root uh on chain and the reason we do this is uh for basically like client support so random people can uh who are visiting the shop you know can uh download the
current state of the shop instead of having to replay the entire log of events to compute the state um in the future we also want to investigate using uh validium type construct like you know the um the uh uh the relays could also uh post a proof and they wouldn't even need to like we wouldn't verify the proof online or on chain we just post it there and then the clients would verify the proof so it'd be super lightweight we don't currently use vum um because it's still uh fairly secure as long as the uh Merchant comes online once every like couple days and checks that the relay is Computing the
correct State not too worried about that yet um but that is a path that we're investigating um um so what do real do uh they're quite simple in the end of the day they serve in store listings they process the events they lock items so uh when a customer or someone is purchasing an item they make sure that it's not being uh purchased twice and then lastly they watch for payments on chain and then notify the uh customer and the merchant when you know uh the transaction is complete um uh we have a very minimal set of smart contracts there's a shop registry
which is erc20 or ERC 721 an nft um and this is basically an access control mechanism whoever owns the uh ERC 721 uh can update and add clerks to the shop um and also add and remove relays the shop registry also yeah records the relays so you look at the metadata of the erc721 to see where to load the data from uh that will be the end points of the relays uh and then the other smart contract we have is a payments contract it's also quite simple it just does some simple um uh validation of the payment
and we also have it call some hooks in case you want to do other onchain actions after a purchase has been completed such as like I don't know like uh issue an nft or I don't know what but like lots of different possibilities so architecture comparison so now that you've heard a bit from Martin about um how the protocol actually works and how it's structured um you might be thinking well we've seen uh decentralized marketplaces be attempted before um we have done but um that was a while ago so the OG of decentralized Market Market places is open Bazaar um 2016 they started um the
technology was in a very different place back then um so they their architecture was to have a node on every device and this had two main problems one was that Merchants had to always be online if they wanted their shop to be available for customers to browse or to purchase from and there was no web interface so you had to download an application onto your phone where you were a merchant or a customer in order to access the marketplace um we're at a place right now where we're able to do something very different to this um so in the past year or so that we've been working on this architecture um designing it Martin has been has spent
about a year doing that um we've seen a couple of other um onchain marketplaces pop up in the ethereum ecosystem so I think this shows two things I think it shows the technology has matured usability is there now and it shows that there's a massive appetite for this and we're like we're ready and and the time has come so Mass Market we see ourselves as complimentary to these other projects so we see ourselves as being able to offer a service um that they can take advantage of and what is this service so this service has two goals um privacy and scalability so we don't put everything on chain we're creating an L2 like protocol of a network of relays
that allows minimal amounts of data to be stored on chain so that's um payments and proofs um so that you can always verify what's going on in in on the relays and that the relays are behaving themselves um so if you were to store everything on chain the CH there's a big challenge of privacy as I'm sure a lot of you are aware it's pseudonymous it's not Anonymous um and when you're talking about scalability Commerce is a hugely interactive um ecosystem so every time you uh increment inventory decrement inventory um edit a product add a new photo um create a Shop create a new add a new Clerk and everything that you do if you have all of this data on chain
that's going to incur gas fees and transaction costs um and you might deploy it on an L2 but then you're still over time accumulating huge fees and so by creating this L2 like design um we're massively reducing fees so what we're hoping um is that we can offer this service to these marketplaces that are popping up um and help them to be private and scale so that's two so that's the open Bazaar and the other new ones on um ethereum there's a third protocol that we stumbled across um quite recently that we got um a bit excited about actually it's called onc and the beckon protocol so it stands for
open network for digital Commerce this is what it says on its website regulating e-commerce monopolies and duopolies is one of the biggest challenges facing policy makers the winner take all nature of e-commerce platforms has provoked regulatory responses breaking up one platform might solve violations but it will not fix a system that spawns them because of the technological factors and economic incentives that exist today the basic Plumbing of Technology needs to be fixed so this is actually a project of the Indian government um uh who seem to have uh observed the same problems with Commerce as it exists today as we have but they're coming at it from a slightly different angle so their protocol they've created an open protocol that
e-commerce platforms have to plug into that Merchants register on so it's kind of similar in its design to ours but it doesn't use a blockchain by not using a blockchain they are foregoing the fully decentralized governance that our architecture offers um and what ends up happening is that it's actually a permissioned system that you have to register with an Indian government approved registry in order to be able to use so it's an open protocol and it does create a shared data layer but it is permissioned and you have to register with the Indian government to use it it's a protocol but it's also not really decentralized so you can look at this as similar to like a comparison between DNS and email where DNS is an open protocol
it's decentralized but it does ultimately have root servers and it does have Gatekeepers um and because it doesn't use a blockchain the the last thing that it foros the third thing is that it foros all of the Innovative features that blockchains are allow are able to offer um which include what I went over before which is like Provence fractional ownership verified reviews reputation um which we are able to offer so those are the the three other architectures and attempts to solve this same problem um compared to ours all right I'm going to talk briefly about about um privacy and what we're trying to keep private um so uh the relays are authenticated which means um it will
only serve a certain set of events to users who have access uh and another set of events that are only meant to be public um messaging is and end crypted between the uh customer and the merchant mes are also stored on the relay so um encryption should just be default anyways uh public listings are always public so we're not worried about hiding those inventory amounts um are private so unauthenticated uh
users um can't get them but they're un encrypted so the relay could see those uh and in the future we could sort of investigate using zero knowledge or fully homomorphic encryption uh to hide these but they need to be currently they need to be public to the relay because the relay uh decrements the inventory amounts after something has been purchased um the other things that are encrypted are the order status and orders um those are actually part of the messaging and those are end to end encrypted um and all that stays offchain so uh the metadata of who who they're going to or the timing would also uh be
harder to see since only authenticated users in the Relay can see those messages the encrypted messages um so uh that's it for now um come like talk to us if you're interested uh on decentralized Commerce um and selling things for crypto or buying things for crypto we have a website uh we have some documentation we have GitHub everything is open source of course um it's a pretty pretty early stage uh but um yeah we have some protocol documentation already so um let me know if you have any questions thank
[Applause] you so we do have time for one question from the audience this sounds really interesting I'm curious on the uh ux for uh user uh how does the wallet interaction or is there a wallet interaction like if I want to sign up for an account and buy something and transact is it through like traditional like eoas or how does that work just out of curiosity um so as a customer um you're going to load the lisings from the relays of websockets they're going
to have a price they're going to have a payment endpoint which is uh an address um and then yeah you just use whatever wallet you want uh to send a payment to that address and then the relay watches that address for payment um so pretty simple one more and then that's it okay uh really nice talk thanks a lot uh do you already think about some arbitration mechanisms how do you deal with returns or non- shipments and so on um so yeah the payment so arbitration is a very interesting topic we do not
deal with arbitration directly but as I just was saying like um the listings have a payment address that you send the payment to this could be an arbitration smart contract right and you know you could imagine systems being built where like oh uh you might pay extra to have um you know this secure well-known arbitration system process your order or you could just you know trust the merchant directly and you might have a selection between the two all right thank you very much I guess if you have any further questions you can be available after the talk now all right thank you [Applause]