Data Composability in Web3 Apps - Michael Sena
Ethereum Denver·Sun, Oct 9, 2022, 12:00 AM
Speaker
Transcript
there we go all right hi youth denver welcome to my talk it's called building decentralized apps with composable web 3 data i'm michael cena co-founder of three box labs and one of the inventors of the ceramic network so what is composability and what do we mean it's basically shared state between applications uh this is kind of just a dumbed-down version of what it might look like but you have two applications they're basically interfaces and they're relying on some kind of shared common backend um you know that can be a blockchain for example for finance and basically what this allows you to do is get rid of centralized services for running those back ends so you can get rid of your database you can get rid of apis and so when we talk about composable data what do we mean we really mean every piece of non-financial data or state that's used by your dap and most apps today don't really have that much non-financial data we've basically been limited to the functionality provided by smart contracts and financial blockchains and so when we think about this type of data we it really encompasses social information like a social graph or your posts and tweets your blog reputation systems that basically store provide storage for verifiable credentials that represent the actions you've taken or other activity that you've done it can store content like we said tweets blogs and all kinds of other things like dow proposals games and state that aren't on chain financially related but are just progress and achievements can store nft metadata all kinds of dial content and lastly account metadata so really when we talk about that we mean things like user profiles or mappings from accounts to some kind of identifier in a way that makes it cross-chain compatible so you can map all of your accounts from all your different l1s or l2s to a common identifier that you can then use throughout the metaverse and really anything else and so what's required to achieve composability we can break it down into really three layers we'll start with the bottom the first is state availability in transactions we really mean data availability and consensus right so you have some public infrastructure that makes data available and you can modify it by shooting transactions at it that get processed the second is application standards so these are really the things that allow many different applications to make common use of the platform we'll go into more detail on all these in the following slides and lastly open apis means that everyone in the world can openly access these services and resources without any centralization vectors or one-off api integrations so we'll dig in okay so the bottom layer you have network design so in a simplified version this is really just a decentralized database that provides shared state across applications so a shared database and for financial networks so blockchains as we traditionally know them they're really built for financial use cases you know maybe they need transactions per second in the millions you know it's basically everyone buying or selling assets or doing things related to money and what you need to achieve that is really a single global state and synchronous transaction processing right so you get this on ethereum today when you have a block and within that block all transactions have to be processed and then that state is updated globally and there's only one state and this is really designed to say who has how many tokens which really says okay we need double spend protection right the main innovation of blockchains but when we talk about data networks we think of designing them differently and they need to run on a different type of infrastructure so data networks are designed for data use cases and they need transactions per second in the hundreds of millions a data network needs to be able to simultaneously host decentralized versions of facebook twitter tick tock reddit all of our favorite applications running simultaneously on one platform and right now there's no blockchain design that can be able to support that and how you achieve this is you redesign the network from the way that blockchains have traditionally been designed to one where you have a collection of independent states so you can basically think that every piece of data is its own state and it's basically its own blockchain so that data has a state users can send transactions to that data which modify its state and the network basically just hosts those right so instead of forcing all transactions into a single block and needing to process them you're really processing transactions on a per data basis and so what that allows is asynchronicity right so now you can parallelize the processing of every single transaction over the network and you're not forcing all nodes to process all transactions every node can choose which transactions they want to process and they basically just replicate the state across the network and really these networks are designed to answer who has which data the second layer of this data composability stack is application standards so they allow similar apps to use the network in common ways the best examples of this are smart contract standards erc20 erc721 and what these really serve to do is give rise to a whole ecosystem of composable applications and tokens without them every application would be writing their own contracts deploying them on the network causing basically fragmentation in that ethereum would have then been just home to a whole bunch of tokens that have no utility with one another and non-fungibility but on data networks we adopt the same kind of principled approach to standards but it's really around data models for applications so not models for tokens and so examples of this could be a user profile a social graph your tweets in a micro blog your reputation or dow proposals and really when you think about data model standards is they should be equivalent to a logical application feature to enable composability it's not like you can take your application database put it on the decentralized web and say well now it's composable because a lot of the application logic is tied into your data models the relationships and how you're structuring your tables and so if you can basically break standards down to the feature level you can unlock composability two applications that say i want a social graph can just adopt the same data model and automatically interoperate on that and open apis so obviously we don't need to go into too much detail but they allow anyone to access the network in a standardized way regardless of the application standards that you're using on the network so an example of this in financial networks is the eth json rbc api and in ceramic the network that i work on it's a ceramic http api and so now that we have an understanding of how data composability is different than financial composability and the types of networks you would need to create to enable it let's look at how we're doing that with ceramic so we'll now start at the highest level and work our way down so for open apis ceramic provides some clients and apis that allow your app to connect to a ceramic node and on a data network these apis really need you to do three things create a state update a state and load a state and again these apis are data specific so you're really creating a single isolated state or you're updating an isolated state they don't need to concern themselves with interoperability across other states because the network isn't designed for that and we're yeah we're upgrading this api to bgsnrpc and the clients that basically implement these apis are written in javascript they work in browser and node and you can find them at that github repo but we'll get into the interesting stuff now so data models as we said they really define what an application feature looks like and on a database that's a set of schemas in relationships right you're defining your tables you're defining the way that your application will store and retrieve data from the system and so on composable data networks we break that down to the feature level and on ceramic we have a concept of we need to encourage data model reusability right to the same extent that on ethereum we're encouraging reuse and adoption of common standards similarly for data networks so there's an open registry anyone in the world can submit their data model that they're using for ceramic to it it enables discovery reuse by multiple applications and it's easy to use so basically we have the data model's name space on npm and every data model added to the repo automatically gets deployed and can be installed by any application using that path and the example here we're showing is for a social connections data model that was created by the community the developers of cyber connect built a social graph protocol on ceramic submitted their data model to the registry now other applications are installing that data model and able to reuse that same data you can also deploy your own so you can do it from the command line and you can do it from javascript and really the javascript package makes it easy to build complex models where you have many levels of nested schemas that have relationships between them and it takes the guesswork out of needing to deploy them to the network one by one and maintaining all those data mappings by yourself and lastly the network level the set of nodes that replicate and come to consensus about states and we've made it easy to deploy them you can just launch it from terraform scripts you can install it from docker hudder npm and you can connect to test net or mainnet mainnet today is available in a beta version it's called an early access program and in the coming weeks we'll be launching fully permissionless open mainnet and we all the communities also spun up some nodes so we at three box labs run some ceramic nodes to make it easy to connect your clients to the network without needing to go through the work of spinning up a node yourself and there's one more standard that i want to talk about specifically because i think it enables composability to the greatest extent more than the others and it's called identity index what identity index does is it basically provides an account based index of all data in the network that belongs to a given account so you can think of it like a key value store where the keys are identifiers for your data model and values are the current data for that data model and so what this does it provides a single place that is cross-application where data can be organized discovered and accessed in one place because you really don't want to be in a position where a user shows up to your dap and you say okay where's your data and that user needs to like store the identifiers of their data on their local machine or something you need an always available place to access that information which provides the backbone for composability when you combine identity index with data models you effectively are creating an open user table for the internet where the rows of that user table are user accounts the columns in that table are data models and the cells are the data that actually belongs to that user for that given data model so that is how most applications are being built on ceramic today and this is really how data is shareable and portable across applications you'll want to use this standard if you have returning users or multiple users right so unless you're creating an app where user shows up creates some content publishes it to the network and never returns again and your app never needs to access that content you don't need idx but you do need idx if you have an application where a user comes generates content then comes back the next day your application needs a way to find that data know the schema that it's in and then the apis to use to access it and that's a lot of tooling and packages so the community's created some frameworks around all of this that make it easy to drop in and the main one being the self id sdk which provides mod native modules for react next.js web node.js it includes web3 auth with normal blockchain accounts so your users don't have to install another wallet or worry about that works with common signatures from wallets like metamask it includes ceramic.js client includes an idx implementation called did data store and includes popular data models for things like profiles and it's also fully extensible for whatever data models your app needs whether you're pulling them from the data models registry or you're writing custom models for your app and then two other fun things that you can do with composable data ceramic supports accounts for nfts and gnosis saves so with an nft account you basically have any nft in the world that can that can function as a ceramic account that can own states on the network and send transactions to them and it works based on an ownership-based access control model where the current owner of the nft has access permissions to modify the states owned by that nft when that nft is sold or transferred to another person the rights to modify that data also transfer and this is used for all kinds of nft metadata extensions no longer are nfts limited to the media file that they're created with but rather they can begin to collect data over time where now you can think an nft could have its own social graph or it can have its own twitter feed or it can have its own reputation you can also do dynamic nft media itself so instead of putting a static ipfs file in the nft's metadata you put a ceramic stream id which stream is a piece of data in ceramic and that nft metadata can actually be mutable over time in a fully trustless way without a server and because of that openly available through the ceramic api rather than a centralized server api secondly gnosis safe accounts kind of function the same way in that ceramic is using state that exists on ethereum or any other l1 in order to perform access control within its network so membership based access control for gnosis safe so if you're a member of a nosa safe you automatically have permissions to update content and streams owned by that gnosis safe this is great for all kinds of dow metadata and dow own content so that's the end of my talk um i encourage you to try building with ceramic there's a lot of projects that are planning on hacking this week on it we've had thousands of developers building on the test net since we launched i guess beginning to middle of last year and you can find the docs at developers.ceramic.
network you can chat with us on discord chat ceramic network visit us at the booth on the third floor and if you want to work on this full-time we're hiring for every role across the stack thank you [Applause]
Automatic transcript — names and jargon may be misspelled.