Skip to content
by Unity Nodes
NEAR Protocol

[REDACTED] 2024 | Building on NEAR the Complete Guide for App Developers

about 19:57 long

Nothing is loaded from YouTube until you press play, and then without tracking cookies.

About this video

Discover all the resources we have for building applications on NEAR. We'll cover everything—from templates, APIs, docs and support, to tokens, and some amazing community projects.

Guillermo Gallardo - DevHub

NEAR is the Blockchain for AI Website: near.org NEAR AI: near.ai Intents: near.org/intents Chain Abstraction: proximity.dev Sharding: nearone.org

For the devs GitHub: github.com/near Dev Docs: docs.near.org Devhub: devhub.near.page @NEARDevHub

Connect with socials Twitter:   / nearprotocol   Blog: near.org/blog Medium:   / nearprotocol   #NEAR #nearprotocol #nearai

Transcript

3,853 words

Captions as YouTube publishes them, usually machine-generated, so product and people names can be misheard.

  1. 0:00

    first of all thank you so much for having me here uh today I'm going to be talking about the complete guide for app developers the main reason for me to create uh or to apply to to give this talk is because lately we have way more and more and more tools in the ecosystem and when I talk with developers I realized that many of them don't know what we actually have to offer so let's

  2. 0:24

    start first of all hi uh I'm Gile I'm a computer science uh and researcher that has been joined here about like four years ago I started as a community contributor and then made my way up to currently leading deil uh where we focus on documentation tutorials examples and basically giving support to the whole Community now when I think about uh web three applications generally I think

  3. 0:54

    about two different worlds right one is smart contracts there are these applications that live in near accounts and they store data and that basically near accounts have to interact with them calling methods storing data on the blockchain ETC and on the other side we have the front end backend classic applications right that is your everyday Ras JavaScript go python but what happens is that now you want to interact

  4. 1:19

    with Neo right and these two things they the these two different type of applications are very different and they actually use different kind of tooling uh so for the smart contracts you're going to be talking about a near SDK work spaces to test it near CLI to deploy your smart contracts meanwhile for the front end and backend applications you're going to be talking about near API near CLI and Community tools and as I said these are two different worlds and therefore these are two different talks the they talk about

  5. 1:49

    smart contracts and and and deployment and building a smart contracts and Etc is going to be given tomorrow at 3:30 by Vlad so I it's going to be in the same stage so I encourage you all to to come and see it and today you are basically here we're going to be talking about front end backend applications and everything you need in order to create them so this is going to be like a fairly pack talk and you're going to be see me passing through a lot of information I will make

  6. 2:21

    all the slides available and please just pay broad attention to what I'm saying and then uh luckily we have the do documentation that is going to allow you to to to come back to all of these things so let's start talking about the CLI the CLI is basically what you're going to be using when you want to interact with near from a terminal or basically create bash scripts now I don't know if you are all

  7. 2:45

    all aware uh but very recently we have released a new CLI which is super friendly and interactive allows you to create near accounts import one if you already have it uh check the balances of your account call smart contract send near and Etc and the nice thing about this CLI is that first of all it is interactive so it will be going and asking you what are you trying to to do right now and you can choose okay it's not passing but

  8. 3:15

    doesn't matter and after you end up saying like I'm going to be handling an account to send near to this account etc etc it's going to tell you what command you need to run next time so you don't have to go through the whole interactive session and it will just allow you to uh create the bash script right like it's just going to give you the bash line that that that you need to run so in this case I was calling like some function in a smart contract and I was

  9. 3:40

    doing it by inputting parameters and then it just tell me like ah by the way next time if you need to run this again just copy paste this line and modify it so it's very nice something else that you can do which is super useful is if you find a transaction on the blockchain and you wonder how it was created it will literally give you the command you will just paste the transaction it will tell you what command you need in order to create that transaction and do it

  10. 4:04

    again and another nice way is that it will automatically handle all your keys for you in a secure way uh the new CLI it's allowing you to use pass keys so you basically are going to be authenticating every action with your fingerprint so anyway if you're still using the old one I will strongly recommend you to my grade uh but yeah I want everyone to know about this because some of the people still using Us in the previous one now what happens when you want to create a web application that basically allows people to log in and

  11. 4:37

    interact with near well if you're starting from scratch the best idea is to not start from scratch and instead of that using some form of template so one of the main options that we have right now is uh create near app which is usually usually the most upto-date template to use uh it's very simple in the sense that it's just a next shade s template like the Bare Bones nextjs template and we added just the integration with near with a Hello World

  12. 5:07

    example uh so we didn't try to modify it that much it only has interaction with near and the nice thing that it has is that it already comes with the wallet connections so the wallet selector which means that you press a button and now suddenly you can select between many of the wallets of of near and your users will be able to log in and that's it and the other things is that this application and one of the reasons why I recommend it is that it also implements a wrapper around um one of our main

  13. 5:37

    libraries we're going to be talking about it in in a while which is a near API JS uh which many people kind of hates including myself and so we have a wrapper on top of it so it's easier to to use it so I would strongly recommend to you know like take a look at least uh at uh MPX Crea new app now something else is that sometimes the hello world is kind of not enough right and then we have what we call the canonical examples so the canonical examples are not so

  14. 6:09

    much production ready but they're a great way they're like a great educational material so if you're trying to do something for sure we have a canonical example that shows exactly how to do it and can help to get you un stock uh for example we have like another donation example that shows how a user can connect and transfer near into an smart contract while saving data we have a coin flip a coin flip example which shows you how to handle random numbers on on the blockchain uh we also

  15. 6:40

    have a factory contract that shows you how a contract can deploy other contracts and something that a lot of people like keeps asking and I keep sending them to exactly the same way which is a front end that can interact with multiple contracts because when you're building applications this is something that generally you will want to do like you will want your uh your front end to talk with two or three different smart contracts and I don't know if you were aware but like right now for example in this example you have

  16. 7:06

    the greeting like the hello smart contract and you have the guest book and you can ask people to sign a transaction and sign one transaction for both of them like so people can only people is only redirected once uh and you know you bother the the user way less because then it just one click they end up hitting two smart contracts so that's important to know that we actually have it because because people keep missing

  17. 7:31

    it uh but for those that are searching for more production ready uh we actually have templates that were contributed by the ecosystem huge shout out to uh B which is the one of the main drivers behind this and we have these templates that you know like you can spin you want to spin up an nftd Marketplace we have a template for that an nft Minter we have a template for that onchain blog

  18. 7:58

    scafolding projects made by build out we have that so I would say like try to never start a project from scratch first go and check if we have the template for it because chances are that we actually do have it now what happens when you already have your application right like I have an application uh sorry for the color if it's just burning your eyes but uh you have an application right and now you want to use near into it well if it is a web application

  19. 8:30

    the one of the first things most probably that you will want to do is uh to use the wallet selector because this is like a very simple mpm package that you just added and now it allows you to basically connect with every single wallet out there in in in nearer I think that actually all or almost all of the wallets are implemented and it's just adding a package and that's it now

  20. 8:52

    suddenly your application has access to minor wallet metal wallet bit wallet etc etc and even more like all of the new ethereum's wallet that now are compatible with nearer now if you're in any other type of application uh you will have to use basically near API near API is the motor behind all of the near applications uh almost all applications will use a form or like a flavor of near API under the hood uh because this is

  21. 9:24

    basically the library that allows you to interface with the with the near RPC so basically when you have like any kind of application no matter if like it's a web app using the wallet selector or like you go to near CLI actually everyone is using one form of the of an API either near API JS which is the most downloaded and the most hated uh IPI that we have right now in the ecosystem uh or the

  22. 9:49

    near API RS which is very new it did not exist until one week ago so please go ahead and check it it's actually quite amazing and the python one uh for all of you making like AI projects now the near API is kind of super nice because it give you all the Primitives that you need in order to query account information query blockchain information read functions uh read state from the blockchain create

  23. 10:14

    transactions but be mindful that uh if you're not going through a wallet like if you're just implementing an application using the API when you will most probably need to handle the user keys but if you're going directly for the API this is most probably something that you want to do and something else that is important to say is that when you're building web applications most probably you be going to be using a mixture of these two like the wallet

  24. 10:39

    selector and the near API and that when you're building uh for example like non web application like backend applications most probably you're going to be also using like a combination of something of this so it's not one or the other it's most like many times you're going to be wanting to use both of them now something that you don't want to do but you have the is that uh you can actually just talk

  25. 11:03

    with the near RPC uh if you think about it like the near apis that we were talking about are just a very nice abstraction on top of the near RPC because the near RPC is the one that is the Gateway towards near all of this is a nice way a nice packet Library so you can talk with a near RPC but what happens if you're building in gold and you just don't have that near APC API goal well then you will have to talk with any your RPC is it still possible it's just like a very simple endpoint

  26. 11:33

    that talks mostly in encoded bites kind of annoying sometimes to create those because you will create a transaction object and code it in B sign it with something and then encode it with sha to 1556 but it's not impossible I have I have done it so it's good to know that if you're building something and you don't find an API well most probably you are just you will be able to talk with the with the RPC directly but if there is an API please just use it it's going

  27. 12:05

    to be so much simpler now something that I and that I want to talk about and actually the whole reason why I I end up deciding to make this talk was about this section is about like ecosystem apis which are like the simplest way to monitor chain activity and I I think that is important like to introduce this topic like at least with one slide like it's very common when you're building an application uh that you will want to do something more than just connect and talk with a smart contract directly right like and say

  28. 12:35

    like okay store data give me some information store data give me some information many times you want to track user actions on on the Chain because that's relevant for your application and such information is not available in the RPC and therefore it's not available through like the near apis so if you want to know you know who interacted with my contract and what methods do they call and what parameters did they use did did the transaction succeed or

  29. 13:01

    like even if you want to just say like hey give me all the nfts of my user my user just connected I want to know all their assets uh this is not something that the nearer API will will will give you and again this is something that very common and that I uh hit when we were building the example of a biding application where people can just come and like bid on a specific product and

  30. 13:24

    now you want to know the past bits like how do you do it without storing them on chain because storing on chain you know if you're going to be storing 300 bits can get like very expensive so there are three APS that I'm going to be talking about like the first one is like the near blocks API uh which is actually great to keep track of actions on a contract you can just hit a simple Endo like B1

  31. 13:48

    account the then the the near account transactions from someone and what method and basically here what we're doing is like give me all the all the calls to create token that gagas near made on token primitive. near and you just get this very nice like response in adjon right so this is super useful and this is something actually that we were using on one of our applications to know like how many people created a funable token on one of our apps uh you also

  32. 14:20

    have fast near API shout out to fer right there uh and which is actually amazing to gather data on users and we are also using it in one of our applications so for example you can hit an endpoint and say like okay GDs do/ and suddenly you get all the assets nfts FS near tokens from a single account and you know if you have to think like what's the other way to do this is like you should know which nfts the user has

  33. 14:50

    or at least which contracts they have interacted with and then go and ask if you know like what are the nft for those users this simplifies your life so much much more so just you know much better and then you have P speak API which is a complete API to query information such as like transaction history current gas price balances Etc now to be honest like if you ever want to you know track information of your application and your users those apis

  34. 15:20

    are going to get you like 90% of the time there uh if they don't cover your case then sadly enough you will need to build your what we call your own index and an indexer is just like a simple service that you're going to be running that is going to be literally constantly listening to the blockchain blocks and being like okay what transactions are here okay these are all the transactions is any of this interesting for me okay

  35. 15:43

    perfect now I have to store it somewhere or do something about it but to be honest if you can avoid it just avoid it like the apis have become so much better that like it's just better to use them um and if you have to build an indexer well I'm sorry it's possible but you know like I rather stay away from it um and now one last thing that I want to talk about is like ecosystem tools in general uh which are tools and resources from and made by developers which you know like with the ecosystem growing

  36. 16:14

    sometimes we can of lose track of what is there out there and not uh so one of the first thing I want to talk about is like in order to keep track of those like it's very nice to actually go to near catalog which was created by build out so huge shout out to to build out uh and it's an amazing product it's an amazing place to discover all of the projects that are right now in near and it keeps growing like we have 500 and

  37. 16:38

    keeps going on I use it many times in order to discover you know what's new and like if I need something I first always go and check if something already exists so I don't have to reinvent the wheel now in terms of like tools of the ecosystem that are very useful uh one that I want to like explorers is a whole Cath ategory and Pikes PE is an Explorer and near blocks is another Explorer but I want to talk particularly about near blocks because besides allowing you to

  38. 17:08

    like just explore accounts transactions it also allows you now to look at Contract metadata and this is actually super interesting and very useful and I use it a lot and the other day I discovered that it's not so common that people know that this exist so if you will go to right now near blocks iio and go and check hello near you can go into the tab of contracts and contracts

  39. 17:31

    methods and see that my contract has like get greting and set greeting and if you go into an nft contract you can actually go and see all of the methods of that nft contract so it's honestly super useful because generally you will just see a contract and like have to figure out what is happening here you will have the information and many other times you will be able to see if uh if the contract was compiled in a specific

  40. 17:54

    way you will be able to see like what where the gith have code of that specific contract lies and a lot of information from the contract so very useful hope you're paying attention this is going to become uh very useful for your for you as developers now another amazing thing and I'm saying amazing because I build it right is dogs. near dark no I did not build it but I I contribute a lot to it and it's

  41. 18:17

    basically the best place to learn about all of this if you were looking at the slides you might have noticed that on top of every single title I also included like the direction where you can enter in docks because everything that I just said everything right now is in docs. n.org so I will encourage you to go and check it we have there the documentations the tutorials the templates the explanation of how to use the CIS the apis etc etc

  42. 18:44

    etc now something else that we have been working and we recently released a new version is the dev portal which is a One-Stop shop for all the developers and we really want to make this portal in such a way that you want to be on board on near and you want to discover something on near you will find it here so you will be able to and right now you can already like find resources on how

  43. 19:08

    to get started it has links to the docs it has links to the near catalog and everything uh it shows you where to get support and where to find re relevant apps and tools and talking about tools something that we have done is that right now the dev portal has a whole section about tools and if you go there you can mint functionable tokens mint nfts create link drops everything from

  44. 19:34

    like one single place so these are just like one click solutions for one for the most common cases and it's constantly growing so soon we will add more methods to handle Dows and Rel layers and more importantly is that all of these tools are using actually Community tools because we didn't want to reinvent the wheel and we also give links to those tools to to those projects so you know

  45. 19:57

    like if you need anything you can find it finally always remember you're not alone on this journey uh we have an amazing community that is more than willing to support you many of us are there so join our our Telegram and you know just join us and start building together and by the way beyond the Outlook because uh the community spaces on de.org is going to land soon thank you so much and have a great rest of your conference