CENTER STAGE - DAY 2 - Josh Quintal: Introducing Dev Console
Nothing is loaded from YouTube until you press play, and then without tracking cookies.
About this video
Follow the latest from NEAR Protocol on: Website: near.org Discord: near.chat Blog: near.org/blog Twitter: / nearprotocol GitHub: github.com/near github.com/nearprotocol #Blockchain #FutureIsNEAR #NEAR #nearprotocol
Transcript
3,802 wordsCaptions as YouTube publishes them, usually machine-generated, so product and people names can be misheard.
- 0:03
and uh without further ado josh uh welcome to the stage nice hello hello hello hello there we go good morning everyone after uh this last year of isolation and dealing with covid it's so wonderful to be here with everyone in person and really feeling the energy of this growing near community so let's just jump right into it uh today i'm going to talk about what's new in developer tooling and i'm going to give you a little sneak peek of something we started working on that we
- 0:41
for now call developer console but first who am i to be giving you this information well as michael so nicely introduced me i am josh quintel i'm the product manager of developer platform at near like you said i started pretty recently and have you been in the space for a while about five years uh did consensus and truffle previously um i'm also going to be exporting these slides uh after this so you'll be able to click on a lot of these links that you'll see so developer platform what does that
- 1:13
mean so we can really sum it up uh with this one sentence right here so developer platform we aim to empower all developers to build complex applications with simple tools across the entire software development life cycle or put another way we want to get those ideas out of your head into the near verse without getting in your way what's this software development life cycle all about well probably already doing this if you've doing or have done any kind of development
- 1:43
this is a really nicely condensed version of it that we have here focuses on this core loop of coding so this is developing your smart contracts developing your front end testing of course testing those things deploying them to a live network or to your hosting provider which is hopefully decentralized storage and then finally monitoring the usage of the application to then analyze that and plan your next iteration
- 2:08
so we're going to kind of use this to anchor the presentation and i'll go through like all the tooling updates and talk about that dev console so first up is near cli so near cli is having some big changes coming to it it's a ground-up rewrite and so first off interactive props are going to be part of this so let's say you're new to development or you just don't want to have to google all of the options that might be necessary for a particular method we're just going to prompt you for those if they're not
- 2:39
filled in so really nice upgrade to the development experience there next up structured logs these are really important if you're scripting this is going to let you digest the output of your logs much more easily no more having to parse strings or do any weird juggling like that of those results next up key management so this is going to be very much improved managing multiple keys
- 3:03
managing api keys for our pc providers things of that nature so also much more flexible experience and then kind of dovetailing off of that configuration files so these are things like setting the network you're going to deploy to setting of things like your contract output directory really just giving you that customization uh that is really important and then finally it's actually
- 3:27
going to be written in rust the current cli in javascript so running it in rust will give us some nice security guarantees and also you know kind of help prevent a supply chain attacks things like that but i didn't even mention the most exciting part of the new cli changes and that is that the new cli is going to be extendable so you can write your own extensions you can actually write them in any language and we at near actually first party going to work on two extensions right out of the
- 3:57
gate so the first one is a validator extension so this is really nice if you're a validator uh you're you know it's not going to be any like interruption in the way you currently work but if you are not this will give you a bit of a lighter weight cli since you won't be needing that functionality and then secondly there's going to be a project extension which i'm going to talk about here in a second but essentially allowing you to manage uh
- 4:19
your local near development environment uh in a bit of a better way than we currently uh handle it so speaking of that the project extension uh just a couple of examples here so there's you can initialize a new project uh you may have currently done this through something like create react uh create near app or something like that but this will now initialize a new empty project we're
- 4:43
going to go over the structure here in a second so really nice very easy way to get started and then second here i demonstrate there's this compile command and currently the way the workflow for development works is it's really just the language native tools so if you're building your smart contracts in rust you're using cargo for example and so this is going to allow us to kind of abstract over these languages and
- 5:07
deal with multi-language projects a little bit better but very importantly it's going to allow us to do additional things besides compiling to webassembly and in this case it's going to generate what we're calling an aci or an abstract contract interface this is really helpful for front-end development so that you can more easily interact with your contracts we'll talk about that in a little bit too so speaking of that project structure
- 5:31
here's an example right here within our project folder we've got that configuration file i mentioned so you know networks build folders things of that nature and then you have your contracts folder so a little bit more of an organized structure here in this example this is a rust project so we've got our greeter contract and then we have that extra cargo dot toml for the workspace there so you also see mentioned there that that's going to support multiple
- 5:55
languages that goes back to that compile command that i mentioned so if you've got some assembly script and rust contracts we'll just be reading that and use the correct compiler for that case so once again the kind of the big advantage of that other than you know that language abstraction is that we'll be able to do some extra things after that wasm compilation when specifically generating these aci files so what these
- 6:20
really have are all of the functions and function signatures that you can easily consume on the front end so you can pass this right into near api js and you'll just be able to get going very quickly as far as interacting with your contract and then you'll also have all your types and things there too which can be really nice for a typescript integration so speaking of additional languages as you may or may not know we currently
- 6:44
support rust and assembly script uh but the great thing about nir right is that our virtual machine is runs web assembly so any language that can target uh web assembly for compilation uh can potentially have a near sdk and to that end the teams at grain and zig languages are working on near sdks currently so i want to check those out if you are interested in new languages so now that we've done our coding we've built our smart contracts we've worked
- 7:14
on our front end it's time to start testing but you know of course you've been writing tests the whole time you've been coding like a good developer but in this case we'll call it a separate thing so there's been some really big changes and actually like a massive leap here an improvement of the experience of testing and also just what you can test and kind of how the environment works so uh we've just released uh or sorry
- 7:40
these tests actually now use something called near sandbox so previously there was these things called simulation tests but the advantage of near sandbox is it's actually just a near core node with some additional functionality that's really helpful for development so this gets you a lot closer to like what the live network is actually going to be doing with the addition of things like patching state so this is really helpful
- 8:04
for seed data in tests this allows you to massively update state without even having to send a transaction and then secondly there spooning which we are definitely going to highlight that is a very important feature that allows you to actually take a contract from a live network pull it down into your local environment and then of course you'll be able to integrate with that test against it without spending real near for talking about mainnet for example
- 8:29
more importantly you can write once and run on any network so these tests they'll run in the sandbox by default it's just one configuration option away to get them to run on test net they're going to be able to run concurrently so really great for speed of course having them run in parallel rather than one after the other and speaking of flexibility you'll be able to write these in rust or javascript so if you want that full
- 8:53
stack rust experience it's there for you if you prefer to write them in javascript because that's how your frontend's going to interact with your tests we've got you covered there too so that sandbox let's take a little bit more of a actual look here and how this works so you can see here in this first example this is a very basic example we're actually just patching the state of the greeter contract the variable status message there and you can see we're updating it to say state
- 9:19
but you can imagine that for something let's say you're like an nft ticket master type thing right you'd be able to seed you know 50 tickets into the system right away uh as part of setting up your testing environment without having to fire off 50 transactions so both a lot faster and a lot more readable right because you're just going to be able to see this in one command secondly here this one is incredibly important uh this is an example of
- 9:44
spooning here so you can see we've got ref finance and we're grabbing it from mainnet there's the account address there block id 50 million and we do want the state data so this is hugely important this is going to enable or make it much easier to make an entirely important class of dapps on there which is actually being able to integrate a lot of these protocols um especially
- 10:06
in d5 just right refs the example here um so let's say you wanted to make like a yield farm aggregator you'd be able to pull in ref finance you'd be able to pull in whichever other defy apps you wanted to include and you'd be able to have this all running in your local environment without as i had said having to spend any real near so hugely powerful there i cannot state that enough and then in the future we're actually working on time travel
- 10:30
for this as well so you'll be able to fast forward and you know manipulate time that way if you have any like time locked things now here's an example of writing those tests either in javascript or in rust you can see that it's quite flexible there you know we create the account we deploy the contract um yeah really nice there so here's an example yep of testing anywhere here you can see there's a couple different ways to change the network we've got you know you can pass it in as variable set it in the
- 11:02
environment or finally here if you're using ava you and we'll be able to actually generate a config file so these workspaces come in a couple different flavors we've got the rust workspaces as i mentioned we've got a base js version which is compatible with any testing framework and we also have this version which is already configured for ava so you'll be able to get started as quickly as possible if you don't mind using ava as
- 11:26
your assertion library and i should also it's also worth mentioning that this is a huge improvement on integration tests but your unit tests can be written totally the same way as before there's no disruption to that so now that we've got everything developed and tested it's time to deploy it somewhere this one's pretty nascent but i'll just mention that you may have noticed since
- 11:48
this workspace can actually deploy contracts this is going to be able to underpin a scriptable deployment system that we're working on i'll definitely want to talk to you any developers out there about how this should work so you've done all this now it's deployed on the network now what right where do we go from here well our dap is in the wild and we're going to want to do that monitoring step and that's where
- 12:12
developer console comes in really covers the operational needs of dapps so you can see a couple different features here it's going to include infrastructure management this is including an rpc service uh and also an indexer service you know many people don't want to have to many people don't want to have to deal with the time and expense right of maintaining or writing your own indexer
- 12:36
and so this is just going to allow you to stand it up and get going next very importantly monitoring and to get more specific this is going to include alerts of various happenings about your contract that you configure and very importantly for security executing actions depending on those conditions which we'll actually take a look at in a second here then you've got your that index or service so of course you're going to want to be able to visualize and you
- 12:59
know number crunch on that data and so there's going to be an analytics portion and really this entire experience really provides a lot of focus and context around your dap and really gives you that assurance and comfort like while it's out out and deployed in the wild gives you what you need to continue to improve it so i'm going to go through two scenarios here i've got some wireframes to show you like i said it's very early but i
- 13:22
want to at least give you a taste of the final vision of this uh so first scenario here our d5 smart contracts been hacked how could the developer console have prevented this scenario so in this case this goes back to the alerts and actions that i talked about earlier so in this example we're on the monitoring screen we're looking at our alerts here and just going left to right it's really readable how this is configured so you
- 13:47
can see our account here is just in this example it's like a vault contract for this and the conditions of this alert are if the balance drops 20 percent uh and this is also if that is caused by addresses not from our allowed list so obviously we want to be able to lower the balance of the contract uh so those the allowed list would include like addresses of anyone that you trust
- 14:11
and then finally those are the actions that would be triggered if those conditions are met in addition to actually alerting you so in this case we're actually going to call the pause method on this contract uh briefly if you're not familiar with the possible pattern this would just allow you to flip a boolean and essentially stop all functionality from the contract temporarily and then finally there how you want to be notified so email text things of that
- 14:36
nature so here's an example actually of what one of those email reports might look like so you can see here we're telling you like which actual alert was triggered when it happened we got some helpful links there that can go to the explorer or in that case help you view your allowed list right away and then finally we showed the actual actions that were triggered along with that transaction there once again you can get to the explorer really
- 14:59
quickly and see exactly what happened there so second scenario uh this one's an nft marketplace that wants to see their best performing collections and artists so how can we do that dare i say it's almost trivial actually compared to the last task we've already got the indexer service running so this is just a matter of displaying this data in a way that's useful for us so you can see our app nft horrific here the analytics screen is composed of a series of tiles for visualization and so
- 15:32
in this example we're creating a new one we want to visualize our top 10 artists by revenue here in this example this is written in a sql query but this is still very early so you know that may that may change and i'd love to hear other ways you might want to write this uh and then finally we choose our visualization here which in this case is a bar chart and so here's a nice example of what that could look like now you've got your
- 15:56
various tiles here and these are all charts and graphs that you've configured we've got our top five artists by revenue in the lower left there in the bar graph that we specified but we could also you know show a proportion of artist sales and then at the top just an example of some transactions right there so phase one of this what's going to actually be coming out soon is going to include project management portions so this includes adding your project
- 16:22
uploading the contracts the rpc service so this is going to be really great you won't have to obviously be managing your own node or anything like that to connect to the network operating analytics so you understand how you're using the rpc service and then finally explore integration so that as transactions are happening against those contracts you've added you'll be able to quickly see the status of those transactions and what's going on
- 16:46
and this is all going to be available at the end of this quarter actually so to summarize uh this is near's tooling as it exists today i won't uh spend too much time on that and this is what it's going to look like so we've got that new cli written in rust with that awesome extension system i'm really excited about that i really hope that could even power potentially even like micro startups around writing extensions
- 17:10
for near cli eventually and then additional language support there we got the grain and zig teams working really hard next up scaffolding there starting a new project mentioned that near project extension it's going to kind of be supplanting create new app there we've got dev console on the operations side and as far as our api libraries we didn't really touch on this much but it's definitely worth mentioning in addition to near api js we're also working on api libraries for rust and
- 17:36
for python so you'll be able to interact with near in those languages more easily and then testing that was the big overhaul so sim tests uh don't need to worry about those anymore you got in your sandbox and you've got your various workspace libraries just choose your flavor there based on what you prefer and oh and that unicode character didn't work but we want to hear from you and in
- 18:00
lieu of head shots because we didn't have them all i'm going to have everyone here on developer platform raise your hand in the audience and so so find one of us talk about your developer experience complain to us please actually i'd really love to hear negative feedback so we know where to improve uh so yeah find anyone who had a raised hand there and so as i mentioned at the beginning i'm gonna be uploading these slides
- 18:24
actually shortly after this and so you'll be able to click any of these links here that i've provided i'll highlight a couple of them actually because i've got a little extra time so in addition to all the things we talked about which is mostly on that left hand side there you can see the near cli proposal actually is an important one to highlight there that's the original governance forum post that led to the near cli that i spoke about so you'll definitely want to check that out and
- 18:49
then on the right hand side some really helpful resources as far as education so we've got a new zero to hero tutorial it's building a crossword our very own mike purvis has used this internally it's a really cool project so definitely check that out if you want to learn more about developing and rust that's part of our newly revamped rust sdk docs also really nice and then under that we've got near
- 19:12
university so your university's got a couple different options there depending on how you want to learn uh if you we've got live certified courses which are you know in person or you know live in the sense that you're with an instructor the whole time we've got courses offered by our partners and we also have self-paced courses if you prefer to learn that way as well and then finally other ways to get involved we've got the near governance forum there that's where you'll find that cli proposal as long as any other
- 19:36
like big like ecosystem shaping discussions we always make everything like as external and transparent as possible so you'll definitely want to follow that for any updates and then finally earn your discord as well so great place for general chat talk to devrel just get involved really with the community and with that that's everything so thank you