Developer Console: Learn, Create, and Operate All in One Place - Josh Quintal

ETHDenver 2022 · February 2022 · 16:58

Josh Quintal introduces a developer console built to let engineers learn, build, and operate blockchain applications from a single interface rather than stitching together separate tools. The talk covers what a unified developer experience changes for teams shipping smart contracts and monitoring them in production.

Speakers

Topics

From ETHDenver 2022, hosted by ETH Denver.

Transcript

Good afternoon everyone. Happy to see everyone here. Hope your East Denver is going well up to this point. Uh today I'm going to talk about the developer console for near where you can learn, create, and operate all in one place. First of all, who am I? I'm Josh Quintel. I'm a product manager on the developer platform team at near, which is rebranding as Pagoda. You may have saw at our booth. So what is near first of all? Near is a proof of stake sharded layer one blockchain.

Uh it has a couple great extra conveniences that are nice for developers. So we got like native named accounts and a unique access key model. So this is really great of course for your users. They get a named account like they're used to on their you know more traditional web two platforms. This is all built in. You don't need like ENS or anything like that. Access keys allow you to control access to your contracts in a more granular way than just simply you know allowing everyone to call everything but it also not requiring you to modify the contract. Which is very interesting. Gas fees, a portion of the network fees actually go to developers. So the contract that's responsible for processing a transaction actually

receives a portion of the network fees involved in that transaction. You can upgrade contracts in place actually as long as the state serialization doesn't change. You can do an in place upgrade of a contract and I'll actually demonstrate that here today in a little bit. The virtual machine on near runs web assembly so you can target it with languages that you might already be familiar with. Currently we support rust and assembly script but we're working on a vanilla JavaScript SDK as well which hopefully be super compelling to web two developers.

So talking about the developer console, you know how does it actually fit into the software development life cycle? And so, here taking a look at this very simplified version of it, but you know, you're going to make your DApp. Let's say you've planned it out, right? You know what you're going to build. So, you actually need to do the coding work. You know, you use our CLI, write your smart contracts. Then it's time to test them. You spin up a sandbox node. You have your workspaces. You test your smart contracts. Finally, they get deployed to a network. But then what happens after that point, right? You're going to need to be monitoring and managing these contracts, and that's where the developer console comes in.

So, with that, I'm going to go and do a little demo here. We're going to talk about analytics and some contracts aggregation that relates to the monitoring portion I just talked about. But another interesting thing is that being that this is an operations platform and your DApp's, you know, hopefully going to be using it once it's launched, we have an opportunity really to onboard people in an interesting way. So, rather than just sending you to a tutorial, there's actually like an interactive element on top of this where as you're going through it, you see feedback about what you're doing in a quick info card.

So, without further ado, let me just show you what I'm talking about rather than you continually having to watch me talk over bullet points. So, this here's the developer console. And so, what we're looking at right now actually is the tutorial. So, when you start it up, you know, you've signed up, you could of course create a blank project, which is just, you know, for your existing DApp or for a new DApp you want to develop, but there's also another option to create a tutorial project, this being one of them. You can see with that badge up there.

And this particular one is a really great one. It's an NFT zero-to-hero our devrel team put together. So, this takes you from knowing nothing about developing on NEAR all the way up to a a system of smart contracts for a full-fledged NFT marketplace. So today I'm going to look at the minting portion in particular. And we're just not going to You're not going to have to watch me live code or anything. We're just going to go right down here to the already built contract. And so you can see in the lower right-hand corner, there's this live contract data card here. And so this is what I was talking about as you're going through the tutorial.

This card's going to update, show you information about your progress and about the contract itself. And so it really makes it a lot more fun and engaging to go through these tutorials. So coming over here, I've already got the repo cloned. I've already checked out the correct branch. In fact, I'll show you right here. We're on the minting branch cuz I wanted to just deploy the completed version of it already for you. So with that, let's build it here. You don't need to worry about the warnings since it's part of a tutorial.

This is This code is unused because you'll use it in the next step, but in this case we're not. So now we've built our contract. We're going to actually go and deploy it here, but before we do that, we need to tell the network who we are. There we go. And in this case actually I'm going to do that one more time because I want to actually create a new account here so you can see this.

There we go. So let's see how I want you to log in. We go here to NEAR wallet. We'll create an account. Uh F Denver 2022-5 sounds good. We'll reserve that. Don't do this next part. Obviously, I'm not going to use this after this tutorial so it doesn't matter that the passphrase is here, but obviously never show your seed phrase to anyone, especially on stage. So, now we need to get word number eight here just to confirm. Looks like it's smooth.

Wi-Fi. Once the account's created, then here we go. Here it's just asking us to connect. Here's a list of the permissions. Since it's the CLI and we're going to be deploying contracts and things, it needs essentially full permissions. Just confirming the granting and here we go. We are now logged in, so let's pop back over to the CLI and actually deploy that contract. So, first things first, actually, we're going to set a variable in our console

here to make this uh or in our CLI to make this a little bit more convenient for us. There we go. And so now for the remaining steps, we don't need to type out that ETHDenver 2022 address anymore. And here just confirming, yep, that variable is definitely uh our name there. So, now to the actual deployment. So, once when we did that compilation step earlier, uh it created a web assembly file cuz as I mentioned, uh the virtual machine on NEAR runs web assembly.

So, we point it to that wasm file uh and then provide it an account ID. And look at that, that was very fast, even with the internet, so cool. That's already confirmed. We can see that transaction in the explorer right here. It's going to reach finality here momentarily. And then now this really comes the part where we can start to see some interactivity here. So, we go to ETHDenver 2022 -5 down here in our quick info card. And look at that, we can see that I created the account and it knows there's a contract there, but it also knows that it's not initialized. So, what we're going to do that next.

And I'll keep both of these on screen so you can see actually that the card's going to respond in real time here. And look at that, there we go. So, it sees that it's initialized. We get some metadata about the contract including the name, the spec, and the symbol. But oh, this is weird. When it's minted in this tokens area, there's we don't have this NFT function implemented, but you know what, no big deal. Let's Let's just continue through. We can We can ignore that for now. So, let's actually mint an NFT now that we've got this deployed.

It's calling the function here. And look at that, it's done, but oh, no. Oh, that's right. Oh, I needed the total supply in this tokens function to actually see my NFT down here and the one I just deployed doesn't have that. What am I going to do? Well, as I mentioned earlier, on NEAR you can actually upgrade this in place. Once again, the only here is that you cannot change the serialization of the state of the data. But luckily, in this case, we are just adding um accessor functions.

So, we will have no problem with this. So, I've switched over to the enumeration branch. That's the next step in the tutorial where you're actually going to be adding these functions that will allow you to, you know, show the tokens by user and also the you get an enumerated list of the total that are minted. So, we're just going to build that new version of it. And that is now complete. And so, now we'll simply rerun that deployment. And oh, and look at that, and it alerts me. Yes, there is a contract already deployed here, and it asks if I want to proceed. In this case, like we said, I know that it's safe.

I'm not changing any state. So, it's going to do that. And look at that, lo and behold, it now I can see the number minted and also the one that I had already minted previously is in there. So, we were able to upgrade that contract in place without, you know, anything going sideways there. So, I definitely encourage you to go back and go through the whole tutorial. Like I said, it starts from baseline, like I've never developed on NEAR. You start interacting with a precompiled contract, and then it builds up through the steps what kind of what we went through just now, minting and deploying your NFT contract, all the way up to Let me get this out of the way here.

All the way up to, you know, adding enumeration approvals royalties and then finally building it up into a full-fledged system of contracts for a marketplace. Oh, and actually, while I'm over here. So, once we've got this deployed, let's say we've completed this tutorial, we can actually convert this into a full-fledged project. But, there are similar things, obviously, that the console can do. So, I mentioned it's, you know, an operations-focused platform outside of this tutorial project. So, we have this contract screen here, which allows us to see like aggregate data about our various contracts. In this case, we just have one, but if you had multiples, you would see a emerged transaction list down here. You can

quickly link out to the explorer. So, you know, we're kind of building up toward this toward this vision where you were this is the nerve center of your DApp essentially. And then of course analytics over here. So there's an RPC service attached to this that has an API key. And so by using that we're able to actually give you now some insight into your usage of the RPC. Including your response codes, total calls. Calls by method breakdown, things of that nature. So super nice really on the bookends of your experience with NEAR, right?

Getting started through that tutorial and then monitoring and operating your application. So future looking a little forward, you kind of saw a bit of what was available today. But in the future so that included the RPC service. Some of those basic usage analytics around the RPC, the contract screen and those interactive tutorials. But in the future we're going to be adding things like an indexing service. So if you are have interacted with an NFT marketplace or something that's having to wrangle, filter and sort a lot of on-chain data. Typically you employ an indexer in between there to make that manipulation a little more easy. We're going to make that even easier by just giving you a turnkey indexer service.

On the monitoring side we'll be adding alerts and actions so you can actually trigger certain functions on your contract if a given condition is met. And then better analytics and visual deployments. And so finally to drive this all home, especially the alerts and triggers part, I'm going to just go through a scenario real quick or actually a series of scenarios kind of show you a bit of the future of this. So the first scenario, a DeFi smart contract's been hacked. How could the developer console have prevented this? So using those alerts and actions that I was mentioning earlier, you can see here we would set one up. In this case we've got our vault contract up here. We set some conditions. We want to know if the balance changes on the order of 20% and if this

transaction isn't coming from our allowed list. So you know, we as the owners of the DApp would potentially want to withdraw from the treasury. So, we uh mitigate that there. And then what's going to actually happen, we'll get a notification via email or text, but more importantly here, we're actually going to call a pause function on this contract and mitigate the loss of our funds. So, when that happened, you'd see something like this in your inbox. So, we know that the balance was draining on this contract. It went down 20% as we uh set that threshold. We see the conditions and then we also see the actions down there.

And I'll link out to the explorer so you can see exactly what happened. In this case, we just uh you know, saved your hacked DApp 80% uh of its treasury rather than uh losing all of it. So, then next up, talking more to the analytics portion of things, like an NFT marketplace wants to see their best performing collections and artists. How would we do that? Well, you'll be able to build your own dashboard in the future. It's currently like pre-configured analytics, um but combined with that indexer service, we're working on the ability for you to actually, you know, query any type of contract data, combine it, visualize it, etc.

And so in this case, we just had our top 10 artists by revenue and we're going to visualize it as a bar chart. So, just quick reminder before I leave you, what's here now, definitely go to console.pagoda.co and test all this out. We've got that interactive tutorial you saw me walking through, the RPC service with the operating analytics, that nicely aggregated contract screen, uh and of course that all links out very conveniently to the explorer. And there's a bunch of people from the dev platform team here. Uh you know, couldn't put everyone's name up here, but there you go. If you see any faces uh on this screen, definitely come to any of us uh and talk about all things developing on NEAR. And of course, we have a booth in the shill zone, uh P5.

And then lastly, I'll post these slides online on my Twitter uh and then NEAR will likely retweet it. So, then you'll be able to click all of these links here. So, I've got, you know, proposals about our new CLI, links to all of our tools, ways to get involved, uh and some uh nice applications down there like Astro DAO in the lower right-hand corner. All right, thanks everyone. That was it. Uh we actually have some time left, so if you would like to take some questions from the audience. I would love to do that, yeah. Anything?

Anything I presented on or just about developing on NEAR NEAR protocol even in general. I'm also happy to not answer questions. Um or maybe if there are a few projects on NEAR that you're particularly excited about that you want to mention briefly. Mhm, yeah, definitely. Uh so that one that was in the lower right-hand corner of my appendix slide here, Astro DAO, uh is the easiest way to start a DAO essentially. So you can yep, there we go. Thank you. In the lower right-hand corner, Astro DAO, definitely check that out. It allows you to spin up a DAO just using uh like a graphical interface and set a lot of different parameters. It's very flexible, nice system there. On the DeFi side, RefFinance, r e f dot finance, on

NEAR is really cool. And the two NFT marketplaces I would highlight would be Paras dot io, which is p a r a s, and Mintbase are the two prominent ones on NEAR. So definitely check them out. Well, if there aren't any more questions, you can always catch Josh at the NEAR booth, and thank you warm round of applause for Josh Quintal.