Building Polkadot Ready Blockchains with Substrate - Dan Shields
Ethereum Denver·Sat, Oct 9, 2021, 12:00 AM
This talk is from ETHDenver & ColoradoJam , the world’s largest Web3 BUIDLathon and Community Gathering. ETHDenver’s content is crypto and blockchain focused. Learn more: ethdenver.com Subscribe to our channel to learn more + connect on Twitter: https://twitter.com/EthereumDenver. Speaker: Dan Shields This talk was recorded Sunday, February 7, 2021. ETHDenver 2021’s content themes included DeFi & Money Legos, NFTs & the Creator Economy, ColoradoJam & the Next Frontier of Statehood, Protocols & Interoperability, Open Source & Public Goods, The Ownership Economy & Digital Orgs, Usability Design & Adoption and Legal, Privacy & Identity. Industry experts also weighed in on topics like decentralization, privacy, identity, non-fungible tokens, scaling, governance, diversity, and arts and culture in blockchain technology. The 2021 event was February 5-12 and hosted virtually in 2021 with 5000+ blockchain enthusiasts, developers and community members from 80 countries and 50 U.S. states. 🔴 SUBSCRIBE ETHDenver’s YouTube https://www.youtube.com/channel/UCgz9NU06t_FkT0Py1Vadczw 💡 LEARN ETHDenver’s Official Website https://www.ethdenver.com/ 👋 CONNECT ETHDenver Twitter https://twitter.com/EthereumDenver 📖 READ ETHDenver News on Medium https://medium.com/ethdenver 🛍️ SHOP ETHDenver Official Merchandise bufficorn.com 💬 CHAT Telegram https://t.me/Ethdenver Discord https://discord.gg/AxFmNdCVnU 📱 FOLLOW LinkedIn https://www.linkedin.com/company/ethdenver Instagram https://www.instagram.com/ethdenver/ Facebook https://www.facebook.com/ETHDenver/
Transcript
okay up next we have homegrown dan shields he's going to be presenting um some looks like we're going to be doing some blockchains with substrate you ready dan yes sir can you hear me i can hear you can you hear me yes i can can you see me i might be frozen on my end uh you are frozen as far as i can tell yeah i think i'm gonna have to do a reset here and so i'll be right back so we get that stream going okay while we have just a second to get his uh technology reset we'll re we'll run through a couple of this afternoon's activities uh the the virtual castle is closed as of now so um holy shmoly it was busy in there today um but we have a lot of other cool things happening the chess tournament is at five o'clock we do have a grand master or excuse me an international master who will be doing commentating with josh lepidus our very own and um there may even be some interesting um call them highlighted spotlight matches that are happening you're welcome to tune into the live stream for commentating on um things that are happening in the chess tournament so that will be happening this evening at five to seven pm don't forget the live stream dj chill room that's twitch.tv slash dj chill room that's happening all the time so background music mood music for just doing your coding and building your project it's really pretty cool stuff they've integrated the art and the music which leads me to the virtual art gallery at cryptovoxels and the art auction at openc so go to eatdenver.com check out the entertainment tab and make sure that you hit those things today uh we've got several more days of you know time of time with these things open so don't feel like you have to be in any rush normally it's sunday and like we're winding down east denver typically because it's usually a weekend event and here we are with five more days so like it's going to be a marathon you guys ready uh we're good okay dan's back back unfrozen on frozen dan shields we we got we we pulled a return of the jedi and got him out of the the carbonite all right i'm glad to be here john yeah thanks for having me yeah you're welcome take it away awesome well hey guys my name is dan shields and uh i've been at denver since the very beginning here i've been a huge fan boy and uh i've been so i guess blessed to have such great people here in the denver area to work with because uh in my mind eat denver is like the cream of the crop of all things like cryptocurrency or blockchain event wise now i think innovation festival we've heard thrown around is the is a word this is the place to be so thanks for joining me on it and uh just so you guys know a little bit more about me um i'm here in colorado and uh the local community that is all kind of uh involved in the cryptocurrency and blockchain space as cryptorado so that's where uh i would invite you guys if you're here local to reach out to me i'd love to get to know you we do fun stuff in person when we can and online for the most part this year but i think we'll get outside some more together soon but with that what i'm really here today what i'm really excited to tell you about is polka dot in particular and building with uh substrate which is a framework to be able to build blockchains that hopefully can get you set up on polka dot so i'm going to go ahead and share my presentation now let's see if you all can see it that looks like yes rock on so building block chains with polka dot or building block chains that are ready for polka dot with substrate right and i'll i'll go ahead and give you a little bit of an overview but before we we really dive into it i think it's good to have a quick review of like what is a blockchain if we're going to build this thing like what are the components that go into it so the the first and most important thing is blockchain is really just a database right that is the chain it's just a data structure it has some peculiarities right we link to the one that was last in the chain to make sure that nothing has changed in the history but that's all it really is all the rest is to ensure that uh it is immutable over time right that's what blockchains are supposed to do so we have a blockchain and then how do we secure this is immutable across multiple um nodes on this blockchain network well we got to have some kind of peer-to-peer networking layer to make this happen right we also need some way to come to an agreement right consensus over who can author blocks and how they get added into this data store right and finally then if there is any uh contest of any kind we need to be able to choose which fork of this database we want to follow what is the truth right is over time and then we need to be able to ingest new transactions or as we call them extrinsic things outside the database and get them intrinsic inside the database and all of this revolves around a state transition function the time right this is the thing that is what we're operating on to get the new present state in each new block so that's that's blockchains right that's the core of them and parity the the company that i'm working with and particularly is behind the substrate framework that we'll go into has built a lot of blockchains like you guys might be aware of uh was parody ethereum and is now open ethereum and this is one of the i believe behind geth the second most popular by far uh implementation of an ethereum node also are the guys behind uh parity bitcoin and i believe it's also a zcash implementation that we have available and then finally what we're here to talk about today at least somewhat is polka dot right so there's a lot of work that has gone in to understanding how to build this blockchain mechanism and all the parts that you need for very many different systems and then in building polka dot substrate emerged right they've built so many blockchains here at parity so why don't we build a framework to help other people build blockchains themselves and i don't want you guys to miss it i'm going to be talking specifically about substrate but polka dot itself is really interesting and i'll talk a little bit more that later and so will dan forbes here and at 3 p.m so just about an hour's time from now as well so don't miss that one stick around but substrate let's focus back on that is an open source modular and extensible framework for building blockchains and if you guys are familiar in the rust ecosystem because this is what substrate is built in you might have seen other frameworks for building web websites so specifically like uh actics is for web servers uh rocket new or things like for uh websites right this in particular right we're talking about is for building blockchains so this framework what is core what really makes substrate what it is and what comes with it it provides here all of the core components that you need to build this blockchain we discussed that blockchain based uh database layer as well as the networking layer to make everything connect between your nodes this transaction queue and sorting and processing transactions that are coming in and a consensus engine and on top of that the most important part that i think we can talk about and what we really want to dive into is this library of runtime modules so all of these things that substrate provides for you are totally modularized and customizable and but the the key when we're thinking about what makes your blockchain special more than whatever is out there already that you could just go and fork off of right is this runtime what makes what makes your blockchain unique so here's kind of a general overview of what a substrate node looks like what components come inside of it right and as we're looking at this node from the outside world we have an ingest so this is all these extrinsic things to this node coming through primarily a an rpc server this is uh what you might be familiar with in the ethereum space you've got a json endpoint that you're talking to these nodes and trying to put things in like for instance the transaction pool or maybe you want to query for something that happens to be in the block blockchain database so this is what we're looking for in there and then from this runtime that's talking to this transaction pool and then deciding upon how it wants to go about processing these new blocks into the blockchain database it also needs to be able to communicate out of the world through what we use as a lib p2p networking at least this is the default module to be having that peer-to-peer networking stack and then when we're communicating then with the nodes on the network we can come to some consensus and then finally ingest and make that block stick throughout the network and also that's included is a prometheus by default telemetry server so that you can monitor these nodes really actively and get some real-time useful information through for instance grafana if you guys are interested in dataviz for what your node is doing so really though i want to focus on this last part so we're talking about this little highlighted thing in green this is the blocks and the block store itself and the run time that's operating on that block store because it's a runtime engineer this is the thing that's the special sauce that's going to make your blockchain unique right so the runtime defines the possible state transitions and the apis in which you can initiate those state transitions so specifically you're defining all of the things that you can and cannot do so in like smart contracts right this is effectively your public interface would be these apis and uh these state transitions are what you're going to go ahead and produce at the end right when everything is validated and cement in a block so when these things are validated correctly now they they sit and they block well when we come to consensus about it the definition of the run time here is also really interestingly an element within the storage itself so to give you a sense like in this diagram here the runtime all of it is contained within a block somewhere in the blockchain and in fact this enables a really interesting property that we can get into is you can have forkless runtime upgrades so one very novel thing that substrate introduces is the ability to at any time as part of the runtime you're able to initiate a runtime upgrade and this will actually be written into the block store and everyone on the network will come to consensus about that new block and realize that it's a runtime upgrade and start operating with it so that's it's a pretty amazing powerful tool here you don't have to necessarily force everyone out there on the network to upgrade manually themselves and when it comes to runtime stuff at least you can push out to the entire network after they come to consensus on it so for instance in polka dot and potentially mr dan forbes can talk a little bit about that we have a governance system that comes to consensus around this before any run time gets initiated but however you want to do it this is totally up to you how do you customize it and how you can use this interesting feature and then so all of these cool things how do you access this and this is where frame comes into play this is our modular framework that allows you to develop this runtime in a very easy way and a whole bunch of helpers to make that really streamlined so what is frame what is this thing right this is this is all the things that you can plug and play into what it makes your blockchain special this runtime specialization so it has a trait configuration interface if you guys are familiar with rust here effectively we are abstracting all of these interfaces through traits through rust rates so as you get into the code you'll see this comp quite a lot this provides a whole bunch of storage abstractions so when you want to write something into the box store you're going to be going through these trait interfaces in your runtime modules to be able to do things um pretty in a pretty seamless and intuitive way once you start learning about it it also provides an interface to report errors and events so you might in from the solidity world you might be publishing out events in your smart contracts here in your runtimes you can do the same kind of stuff for the network to become aware about things that are going on in the runtime as it's operating and this is where you'll be able to specify the dispatchable extrinsics right so you can think of them as transactions stuff coming in ingesting into the run time and being processed over time you can specify these here so you can also then very easily create these public interfaces through public accessible functions as well as hooks into that rpc layer that we have available and then there's a plethora of primitives so things that you really want to be able to access for instance um who is sending something and ways to work around validating like is this a signed message do you have uh some authentication and ability to for instance send funds from one account to another so uh that that's all baked in there in those primitives as well as scale which is our uh encoding specifically to store things deep into the database this is effectively a binary format you we've got really handy helpers for you to do things like serialize and deserialize into that particular codec so that's all available in frame and if we have enough time i can show you a little bit about where those are located for you but this is the core of which you as you're coming into substrate will get a lot of experience about learning what's out there and how to interface with palettes so these are totally all-in-one plug-and-play modules that you can put into your runtime and so they're all based on frame they use very similar syntax frame v1 you'll see we use a whole bunch of declarative macros the the macros that have a little uh exclamation point in rust for declaring your storage declaring your errors declaring the specific things inside your runtime the functions that you want to run in the public interfaces to them those are all supported in frame b1 and frame v2 is is right on horizon it's going to be launched here i believe officially in substrate 3.0 in the next few weeks which fingers crossed that'll be really exciting it simplifies some of this macro syntax and makes it much more um idiomatic rust it's it's very very much more simple simplified but regardless these palettes right this you can decide what you want to plug into so for instance we're looking at this diagram maybe you want some particular consensus engines so in this uh in this example you've got aurora and grandpa that are coming together out of those two that will decide on block production and then finally block finalization so how do you who gets to decide on what blocks should be decided on and then finally how do those get cemented and immutable over time and then things like if you're playing around testing maybe you want a pseudo palette this is effectively admin level you can do whatever you'd like you can pretend you're anybody on the system and initiate whatever you'd like um so this has been purposefully removed via a runtime upgrade in polkadot so that only governance for instance as you can see the things that aren't selected in this example like elections and democracy are actually highlighted and selected in polka dot to enable this um collective decision making around runtime upgrades there's no sudo right but you can also do things like uh you plug in assets and have treasury management and do things like um have uh collective decision making on there so you decide what you want your blockchain runtime to have into it and we've got a lot of pallets to get you started as well as there's a great and expanding open source community that is developing these things out there in the wild one popular library is the open runtime module libraries that are out there orml you'll see on github and so if you don't look directly in the substrate ones that come included in our code base there's plenty more to look from and lots more to develop so hopefully i've sold you on like the idea if you want to build a blockchain substrate is probably the best tool to do it i would say hands down so substrate.
dev is a place where you're going to learn a lot more than just why you want to do this stuff but how you can actually dig in we've got tutorials that are there and we've got i believe six or seven different ones to get you started and then once you've got those under your belt go ahead and check out recipes this is much more targeted specific things in examples to really do more advanced functionality than just just understand how substrate is structured and then every week and dan forbes leads us right now uh is we have a substrate seminar so this is more for practitioners people who have seen and been working with substrate and done some tutorials maybe played with some of these recipes and want to know what's the present state of the art that's going on and how to how to get in sink their teeth in deeper also eat denver we've got a lot of great stuff so if you go to uh my slides which i believe i put up on twitch and i put now in the east denver discord as well there's this great resource guide there's a lot of information about what else you can get access to here specifically for eat denver including our bounties so if you aren't decided yet on what you want to work on we've got open track boundaries specifically to anything that involves substrate or ink or smart contracting language if you're developing a parody some really awesome stuff and pretty much free form like uh i i'm excited to see what you guys want to do more than have you focus on one particular thing to tackle so check out the denver guide there's some really awesome stuff there and connect with me right i'm going to be around pretty much uh all the rest of the week i'm going to be helping as a mentor uh hanging out on the vertly platform specifically for east denver and the discord as well you can hit me at this email here i'm on discord and then really i i prefer matrix if you guys haven't checked it out yet uh distributed federated system to be able to connect to people over the matrix protocol so that that's the one you should hit me at but i'll be around anywhere hit me wherever it's convenient for you so with that i i talked a lot about okay you can build a blockchain right but one thing i haven't really talked about is okay you've got this thing how do you make sure that is secure and distributed right because right now all i've got is a single node that is sitting there and processing blocks all on its own right i want to have a distributed network across the world and make sure that it's rock solid immutable and guard against attack so substrate enables you to modularly very easily become what we call a parachain or a parathread a polka dot so if you decide to go this route you can plug into polka dot and have polka dot not only become this distributed network for you on your behalf but also help you ensure that the validity of your state transitions not just your state but the state transitions from block to block are valid so instead of uh i i guess the right way to think about this is uh a cloud service provider might provide something like infrastructure as code and here polka dot allows you to immediately plug into a very robust very secure blockchain network that is bigger than you are and also provides these security guarantees that a distributed network that you would have to bootstrap yourself otherwise would have so there's a lot of cool stuff going on with polkadot and parachains and we're just starting in this in this world so i invite you guys to play with substrate understand it because this is the gateway into what i believe is a much better future for interoperable blockchains all over the place and to hear more about this you talk with dan forbes he's going to be presenting at three three o'clock here so in just about 40 minutes from now and that i think is about all i've got for my slides but i wanted to give you a brief introduction to what you can look for here on some of the resources that we have available online so wiki.polkadot.network in particular as you guys are learning about concepts there's some really great technical explanations here that are all documented out for you to go ahead and look at because this is a big thing to grasp the the vision of what polkadot wants to become i think is is really uh something that dan will touch on but it gets dense very quickly so check out we've got docs here that are available for you and then for substrate in particular substrate.dev is where you're going to want to be going to find all these resources that i was mentioning we've got tutorials we've got a knowledge base that is specific to substrate development these recipes for the examples as well as an api reference if you guys have seen anything in docs before from rust docs this is all compiled from this so the substrate code core base uh that's all we're going to rust so these are auto documented um in the code in the excuse me the core code which you can find here on uh github so if you go to github slash parity text substrate to give you a sense this is all of those things that i was talking about that you can plug and play this is the library that you can compose into a substrate-based blockchain in particular if you guys are looking around at this i want to highlight a couple of things that are here uh those pallets that i mentioned those all live within this frame uh frame doc directory here so substrate frame this is where you're going to find these things like aurora authorship the balances palette things like democracy and elections so those plugable modules you'll find in here as well as we were talking about these primitives so a lot of the things that are associated that you might need to get like for instance arithmetic if you want to be able to play with that scale and coding you're going to look in here for some of that stuff and of course your first stop is going to be these docs and you can do some great search about whatever it might be and keywords that you want to be looking into and learn about the palettes for instance balances could be something you'd be looking for right so we can look for all the stuff that's associated with it and then for an example right if you're looking here in the uh the substrate code base under the binary directory we've got a node template which is basically the bare minimum that you can use to get started that's a fully running has all the modules you need to start running that node right there and then kind of the the whole like uh the what is it the uh the whole kitchen plus the uh everything you could possibly need in fact more than you probably would ever want is in this node just to make sure that everything could be plugged in to your blockchain that you want to for this template though i would encourage you under the substrate developer hub we've got the substrate node template this is the same source but it's been pulled out so that you can use it as a template directly very easily so if you want to get started go ahead and use this template and fork it over and get yourself started and you'll find all the documentation in these tutorials really very helpful as you're moving through and progressing along your journey in substrate so i think with that that's all i got for sharon and i'm hoping that i can get some questions from you guys on the twitch so i'm going to be looking there now and hopefully we can help you either now presently or also on discord and so join me there after this talk so we can get you set up so i'm looking is there any questions that have come up i've got one on the screen right now if you want to take that sweet yeah can we do nft projects on polka dot uh open hackathon yes absolutely um and in particular there's some really interesting work going on on kusama the cousin network of polkadot if you will and yes as dan forbes is saying check out kusama that they're in the maker space they've got a large set of nfts that are built on kusama that you can you potentially uh buy in the auction that's going on a little bit later in the uh what when is that john do you know i don't know yeah it's coming up check out ethner.com schedule and uh you'll see stuff there so the crypto voxels area is full of a lot of um the these kusama nfts can you build them yourself yes uh rmrk i believe is the remark is where these nfts a lot of them are living right now and um bruno i believe gave a talk earlier that you can look back on to go ahead and uh refresh on some of the innovations that are happening in the nft world in the polkadot space cool so hopefully that helped so now i'm at scene from justin from new cypher here as uh what does it feel like to throw down the gauntlet and do a polka dot talk at an east conference so i'd say it's it's great i love this you know i've i've never been a maximalist for any particular one thing or the other the thing i am a maximalist about is the decentralized web community and i think that east denver really embodies this sure that it in the name's sake it's about ethereum but really i think that this is about building innovative products that help bring about a better world right the technology is great and wherever it is i think so here's my opinion is that polka dot really is about building bridges right it's it's really about enabling you to connect to other blockchains that live out there in the world whether they're built on substrate or not and i envision a feature where there is no competitive space it's really about us all having the optimized blockchain to do just what we need so ethereum is one definitely and connecting through polka dot to others that do cool stuff for instance like we say nfts maybe that'd be the next one to be its own chain so so we're looking at another question here party started in the east community we love the community oh yeah yeah like uh for sure i i don't see there any direct competition it's about being collaborative here to me so cosmos and polkadot they seem to have similar aims can i provide a quick summary of the differences and i can tell you what i should know more about cosmos but i'm relatively new to cosmos so that's something i'm going to be learning more about as i move forward here in my journey but i definitely got to say i'm i'm still mostly in the brain space of polka dot because it's my job so where can you buy a polka dot hoodie this one this one came from the uh git coin hello world hackathon so you couldn't buy it you could get it though for participating we'll have more events much like we're at now for east denver where you can get swag and we have swag available that's i believe um you can come to our booth in the virtual castle and i'll post a link in the uh discord as well for people to get some free polka dot swag because we got some good stuff for sure but yeah guys so i'm i'm excited and if anything for the opportunity to collaborate with the ethereum community more and more uh in whatever you guys are doing and substrate in particular really i think is an interesting thing for anybody who's interested in getting outside of the just a smart contracting space the cool part i think that is so powerful about substrate is it enables you to build your own specific runtime instead of deciding that the evm is the one runtime that everyone needs to use so if you want to do something that the evm is kind of about or solidity might not be the right tool for you might be able to make your own perfect tool with substrate so i'm looking will there be a polka dot to ethereum bridge absolutely um so if you want to see some of the the first bits of this i believe frontier is the right uh place to go and in the discord i'll be making sure i put up links to all this stuff so you guys are awesome i'm glad to be here i think i'm running out of time and uh yeah we definitely will pay you in some swag to hack with uh substrate and polka dot
Automatic transcript — names and jargon may be misspelled.