Dev & Tell | Matthew Davis - Ceramic Network Overview

Developer DAO · 17 Jun 2022 · 27:23

Matthew Davis, developer advocate at 3Box Labs, explains how the Ceramic Network provides decentralised, composable data. Using sign-ups across social apps as the example, he shows how shared data models let users keep one profile that many applications read. The talk covers streams as append-only commit logs on IPFS, blockchain anchoring, TileDocument streams, authentication through 3ID Connect, key DIDs and Sign-In with Ethereum, the lack of native encryption, and the planned GraphQL revamp.

Speakers

Topics

From Developer DAO; community: Developer DAO.

Transcript

gm gega everybody welcome to what's going to be another great devontel uh if you didn't know devontel is a 30 minute window for members of the dow to showcase something they're passionate about or have been working on this can be an awesome project you've been working on demonstrating unit testing best practices automation goodies smart contracts how to structure a project etc basically if you've got a passion for something this is your opportunity to share with the community and today i am happy to introduce to you matt from the ceramic network who will be going over composable data with us take it away matt excellent thank you for the introduction hi i'm matthew i'll share my screen really quick and we will get going all right

why is screen sharing always a challenge okay you think after doing this so much that it'd be easy but no i feel so we're gonna talk what's that i said i feel it yeah but go on yeah right so funny uh okay we're gonna talk about ceramic a little bit um i'm not sure if you guys are super familiar with it or not so hopefully after the end of this you'll have an understanding of what we're doing over on our side of things and how you can fold it into your app um if i breeze through this quickly i have a couple demo apps that i can pull up and show you um but outside of that let's talk about who we are first and foremost my name is matthew you can find me over on the ceramic discord um i'm the developer advocate for our team and so i kind of run around

and hopefully drum up enough excitement to get you guys to adopt what we're doing over here the rest of our team however is way more exciting than i am we have a crazy group of developers that come from a large-scale enterprise web 2 companies so we have people who are working on this protocol from facebook from from github as well as other financial institutions like deloitte they're all there bringing the best minds possible to web3 which is pretty cool a couple of key points too is some of the engineers on the team developed uport which was the first web3 identity solution um we've got people that have authored core web3 standards such as

decentralized identifiers and outside of those accolades there's been a ton of developer-centric products that have been shipped um and available to use across web3 applications by our team so we've definitely been well versed in um the old way as well as the new way of doing things and we couldn't be more excited to to looking or to be solving uh this data problem that exists so getting into what ceramic is uh easily we could just say hey we're a decentralized network for composable data that's somewhat helpful somewhat not i think it's more helpful to break this into two parts uh the first part will be composable data right so for a

decentralized network for it talk about the data a little bit the best way to do this is to think about our user journey especially in social space i think this makes a whole lot of sense to a lot of people everybody's pretty much living their lives through social media nowadays um imagine i'm a brand new end user and i land on twitter first thing i need to do is create an account right and when i do that i'm asked to enter my name my phone number my birthday but then i also want an instagram account because you know 140 characters of text just isn't as good as a picture of somebody's really bad plate of food and i want to see that really bad plate of food so i sign up to instagram and i'm asked for my phone number my name a username and

password and then i realized well if i'm gonna go down this this rabbit hole of social media i might as well um be in the most evil of social media companies and now so i signed up for facebook too right and it asks for very similar information and you can see there's a lot of area where we could very easily just reuse old information that is still valid information the name is a good one or phone number is a good one they all ask for it but as the end user i've had to put it in three different times so this is problem number one is where as a user i have to do this too often problem number two is once i do that where does it go uh the moment i put my

information in whether it's form oh sorry gank uh if yeah thank you cool um the moment i put my information into twitter's forum where does it go it goes to twitter's database right the moment i do that with facebook it goes to facebook's database so these these pipelines of end user to application are all kind of housed and locked away inside of an application specific database so problem number two is it becomes twitter's proprietary property the moment i give them my data then we have to kind of trust twitter and trust facebook and trust all these other applications then when we request

a view that uses that data that we're actually getting the proper view or something that's true and that they're not manipulating it on the way or doing other things with it right so there's a lot of trouble with that then it does the developer problem right not just the end user problem but the developer problem of if i need to integrate with one of these applications i have to implement some sort of one-off api in order to do so and if my application starts depending on that api and all of a sudden twitter says nope we're going to cut you off you're no longer going to have access to the api like what are the business effects on my application the moment i lose the ability to interact with these other these apis that somehow get closed down

right so there's a lot of different problems that that are boiling up with the current web 2 system in data and it all points to the same thing and that's the moment you provide your data somewhere it's no longer yours you you have no agency over it and we've seen this a lot with how like data is sold and how it's used and uh for to manipulate all sorts of ad campaigns and stuff right it's it's not yours anymore even requesting to delete your data isn't an easy thing um and you then still have to trust that it got deleted so it's ceramic we're trying to say hey like how can we solve some of this if not all of this all these problems that we just

talked about so we look at this from a composable data point of view so we can take our our little developer here and maybe that developer creates a schema for what a profile looks like and we call it a data model currently and this contains data that a user would enter right their name their birthday their phone number everything we just looked at and then whatever applications are built aren't reading or logging that in their own database rather they're querying the ceramic network for that profile data and then filling the page or the the sign up forms or whatever it might be with that data as as the application then needs it what we get out of this is the user now

has a central place where if they decide to change their name or they change their phone number they can update that in one central location which is on the ceramic network um not that it's centralized but just like that's where they would up update that and then that immediately gets reflected across all the web 3 applications they use that that read from that data model and we're not limited to one data model per application we could pull in 100 different data models per application and we also keep the apis open they're not going to get shut down it's an entire decentralized network so this data is also always available and we store this data in something called streams so if you're digging into

the documentation you're like i want to implement a data model what i keep seeing all this stuff about streams well this is kind of where stream is we'll we'll talk about it briefly you can think of a stream is this a pen only log of commits right it's and they all get reduced down into a stream type so it's the history of changes to that data i've i've updated my name i've changed my phone number i've added a new field that didn't exist before all of that gets gets captured and and lives alongside of that data interaction in that data model forever which is kind of cool and it's append only right so we can't can't remove stuff out of it we can't or

we can very definitively say like this is the history of the data so each one of those commits is actually um a content identifier that is it's an ipld object right so you can start to see now that ceramic layers on top of ipfs you need to be running ipfs in order for the ceramic protocol to kind of interact with that these stream types aren't just a series of commits like the stream is they also provide logic for like what can happen with that stream currently we support two different types of stream types the most common one is it is a tiled document and you can think of that as like a mongodb like document style database big object of key value

pairs right um there's another one uh that that deals more with like k-10 links and then there's a couple that are in the works stream types are extensible so if you find that what you're building doesn't kind of fit in with the current stream types that we offer you can always create a stream type and have a custom stream type that works on the ceramic network and then all of those things uh get combined right we get the the log of commits and at some point um when a change happens we make what's called an anchor commit and we say all right let's go ahead and write those updates down to a blockchain so we're keeping track of the commits on chain not necessarily the

data on chain so this is really small on chain interactions um and again the the things that are being anchored to the blockchain are encoded using ipld so again on top of ipfs um all of that is great uh but it kind of like sets us in this weird realm of all the streams that exist are globally readable which is kind of cool and also kind of scary at the same time and something to be aware of if everything is is globally readable then it's probably not a good idea to store uh credit card numbers on the ceramic network right it's not encrypted by

default you would need to add some sort of encryption layer to it like lit protocol in order to get everything to be encrypted um it's globally readable which means i just need to know the name of the data model and when somebody connects a wallet if they have data associated with that data model and that that decentralized id that they have then we can read that in but applications can't change it only the owner of the stream the controller of the stream can change it and we get that control through this authentication mechanism that exists we typically authenticate one of three ways right now if you're an end user the most common or for your end users the most

common way to connect is through something called 3id connect this is a little modal that will use your your like metamask to create a decentralized identifier which is then used as the controller for a stream it's a little clunky uh you have to sign a couple messages so it takes a little bit more time than we'd like it to but there's a solution for that the second common way is a key did method which is you're setting that up more at build time developers are probably going to use these as they create and publish the data models for themselves or if i had a service that needed to read and write more so write to the ceramic network i might give that service its own key

it's not gonna have a wallet to interact with right so i would use this type of method and the most common and preferred way right now uh that we want you to use going forward is the whole sign in with xflow so right sign in with ethereum sign in with solana um these authentication flows are are coming becoming more and more prominent and we have factored them into something called cacao which is a chain agnostic capabilities object which will allow you to use your wallet sign less messages you authenticate into the application that way and then the application gets to act on your behalf for a dedicated session time right so you can set that as like

three hours or whatever and then that the id that the application's using is ephemeral and it will be destroyed and you would need to re-authenticate to write changes again oh globally readable but we have different ways to authenticate so that we can make updates you cannot make updates to a stream you don't own so that kind of protects it so it all kind of looks like this at the end of the day we have a developer using a did probably he did to create the definition of a data model in this case it's a basic profile and he's got a schema outlined and it's just a basic json schema then we have two users they've created dids most likely using cacao or three id connect

in which case they can write data to um their own version like a copy of this this object for them so they can write their individual records and everybody can read these individual records but only the controller can can make changes so the entire table of a user's data is now with a user rather than with the application and every application they go to could potentially read from that what we get out of this is user agency now users own the data it's not stored in an application specific database and i need a did or to use it as a controller to make any changes to that

data so applications can't change the data um unless we're using cacao and we're giving the application a very specific capability to be able to change that data so that's the data composability piece let's talk about the the network side of it so we're decentralized network for composable data we talked about data here's the network traditional blockchain stuff in a very high level view right blockchains give us this single global execution environment think the evm right every transaction that we want to take or that we want to carry out on ethereum or every smart contract we want to execute goes through this evm and it's kind of a single point of failure to some degree there's a there's a

limited number of transactions evm can process at any given time and the more congested it gets the more expensive it is to perform one of these actions uh and really what it's responsible for is taking the state of like this single global ledger and publishing it out to everything that's that's participating in its network so we can kind of think of this as the traditional way and we by understanding that we can kind of understand what ceramic's doing so instead of there being one giant global ledger that needs to be broadcast out to everything or every node that's participating each of our nodes like when you run a ceramic node it's really small package that you download

when you run a ceramic node each individual node has its own individual execution environment so there is no global ledger to keep track of and a node becomes responsible for validating all the commits and transactions that take place on the streams that it cares about this allows us to scale horizontally if we need more processing power we just add a node to the network um so there's less uh there's not a single point of execution on this we can add more points of execution by by adding those this gives us the ability to increase the number of processors working on the problem right all of this works because it's kind of

offline first so a ceramic node it does all of its stream transactions locally to itself and then it syncs those updates with the rest of the network it does that over libpeter p so that's what all the communication between the notes uses to take place as a pub sub topic that they all kind of subscribe to this is awesome because if it means for any reason you lose connection to the network it doesn't mean your application that is connected to your node needs to stop working uh it will work and then when the node comes back online everybody gets gets that update available and this works because everything is done in a global namespace um so even though we might be running a node in aws and then

a node locally in my house or whatever it might be we can still communicate node to node and nodes can broadcast stuff out to each other and make sure that everything gets updated it kind of looks like this each node has some responsibilities and a very key characteristic um the first major responsibility of a node is to like manage the state of a stream like is to keep track of of that so they a node only keeps track of a stream that it cares about it's called pinning so if you look in the documentation you're seeing stuff about pinning a stream it just means you're telling a node like i want you to pay attention to the stream that means if there's five nodes they might not all care about the same

streams so one stream can be the state can be maintained by all five nodes or are two of those nodes maybe update or keep the state up to date so stream states can be maintained by multiple nodes or multiple nodes can maintain a single stream state as well so if you needed some sort of like redundancy you could say hey these three nodes are going to manage the basic profile stream state um this commit log storage what they're responsible for is just really maintaining a local copy of all the commits that happen to the streams that they care about uh so again this might be one-to-many it might be manual one but this is the main purpose of that ceramic node is to keep track of the

stream we're working on something called persistence connectors and this will allow you to say hey i need to back up that log like we have this commit log it's very critical to the application and i want to back it up but i want to do it in a decentralized way um very soon you'll be able to plug in like file coin or r weave or something in there to do all your backups of your commit logs the last two things that nodes are really responsible for is that query and response and like broadcasting those transactions so again when you're a client like when your application says hey can i get matt's basic profile the ceramic node goes oh let me see if i care about that stream if i care about it then i return the stream and if i don't have it pinned then i broadcast

out that i need that uh and some other node on the network will deliver it to me and then i can show it in my application and same thing when changes happen and again all of that happens over the p2p the final kind of characteristic to this is nodes can exist on multiple networks not at the same time but um there's a lot of different networks that you can use when working with ceramic the first one is a local network you can run a node locally in your terminal it doesn't take a lot of resources to do so so you can do development locally we have the test net which is called clay clay testnet you'll be connected to other ceramic nodes um this is the preferred way for you guys to jump in and get started with ceramic is just do your dev work on testnet it'll give you

access to the data models that currently exist as well as make any data models you're working on available to all the other apps in the ecosystem and we get the composability by by doing that we do have a main net um common misconception is everybody tries to get on main net super early there's a bigger process to getting on mainnet so i wouldn't struggle with mainnet until you have like a really solid project up and running so that's kind of like a node in what a node does and is you can dig into running a node these can be in the cloud and these can be local can be wherever you want them to be um lots of docs on that so that was a lot but that covers decentralized data for our network for

composable data right so the all the nodes are the decentralized network composable data is what it is it's a stream right so how do we get started we've provided a couple suites of tools for you um so if you're going through a docs or landing on our github or talking to us in discord you might be trying to do something called self-id or maybe glaze or the ceramic stuff as it as it stands and this is kind of the difference between them if you want your low level interactions with ceramic like a raw http client or you want to interact with file document stream types directly then you're going to use the the core ceramic package that exists

if you want to abstract that out a little bit and use data models rather than like one-off structures of data um then you're gonna need to step up to to this package called glaze and honestly this is a really nice wrapper around the low-level stuff glaze is probably the easiest one of these to use it offers a really nice blend between customizability and usability if you really don't care about how any of it works because you're just writing an app that only needs to consume then self id might be the place for you uh this is kind of like a package we got a bunch of like react hooks and everything already pre-built for you so if you just want to plug that into an application and get reading data from the network you can write with self id but um

if you really wanted to get started and didn't care about the implementation self id is your your answer for that so this can kind of get confusing because you might see a blend of these things if you're you know doing some google searches to try to figure out how to implement this so having the understanding that these are three very separate things that all kind of do the same thing with different layers of abstraction will help you along that road the final thing i can throw at you is uh we got all these resources here for you i know it's hard to click a link on the screen it's hard to do so in a video as well um but if you want to see what's up next for ceramic this road map is super important it's up to date we keep it um it's a live living document

so you'll be able to find out everything that we got going on um now and in the near future for the protocol documentation is always your friend then i want to point out that we do have our discord we welcome you over there so come join us we can answer your questions directly we uh do everything in our power to spend a lot of time with the community and help you guys out for example i spent some time engineering uh cosmos related solutions with a community member over the weekend it was a lot of fun so last and certainly not least before i open it up for questions um is we're hiring so if you're interested have data background have devops background you if just go look at the job postings that

exist they change frequently but we're looking for all kinds of talent both technical and technical um so even though the the market's doing what the market's doing we are still actively looking for team members and that kind of wraps it up with about five minutes to go so i will leave it up to you guys for questions um for those five minutes rather than jumping into some crazy demo awesome matthew thank you so much for that wonderful overview yeah again does anybody have any questions for matt if not i have a question oh yeah yeah so go ahead

oh sorry um and my mind kind of wonders so i may have blanked on this but you were mentioning that everything is global reads um and you have to do your own encryption to make the data private um is that correct yeah we we definitely don't suggest that you store sensitive stuff on ceramic uh there is no native encryption when it comes to that however you can tie in like lit protocols the best example i have for you on this uh super easily to encrypt things prior to to getting it stored on ceramic if you really needed to but as things stand right now like i would highly suggest against storing super sensitive things uh at the moment awesome thanks

great question uh anybody else in the crowd have any questions okay i guess i could ask mine uh are there any plans to introduce a uh graphql uh component to being to be able to query some of the data on ceramic yeah um right now that is the biggest change that is taking place so um that's probably the number one thing that's going to stand out on the roadmap if you do take a look is we are working really hard um to release very soon an entire revamp on how ceramic queries happen to all be graphql um so i know i mentioned like data models

and data models are the way we do it today data models are changing uh in a good way right now they're a little bit clunky and hard to work with unless you really understand the the differences between build time and runtime with ceramic there's a big graphql change that's coming that's going to make data models a million times easier to use and to develop and to integrate with all because it's going to be native graphql awesome also can't wait can't wait to play with it yeah me too uh we have about two three minutes left here gang any final questions for matt going once going twice

sold well all right gang uh again matthew thank you so much for coming on and giving us that awesome overview of ceramic uh i know i'll probably be uh taking some time over the weekend to go play around with it it's been on my list for a long time as i'm sure the rest of the gang here is and uh yeah i just want to wish everybody a happy friday happy saturday happy weekend whatever it may be for you and uh i'll be posting a link to the attendees perhaps in the developers voice text and matt i'll forward you uh your uh special dev and tell speaker poe as well excellent thank you guys for having me and uh enjoy your weekend all right gang all the best cheers