BlockHeads Workshop 1: Intro to NEAR Part 1
Nothing is loaded from YouTube until you press play, and then without tracking cookies.
About this video
Do you want to jump into the world of blockchain as an up-and-coming web developer, but don’t know where to begin? If so, this workshop will steer you in the right direction to start building your blockchain applications! I focused on the essentials that an incoming developer would need to know to get started right away.
If there’s anything I missed or anything you want me to go into more detail with, please let me know in the comment section.
One of the pain points I had, when I was starting out, was understanding the differences and use cases of access keys. Check out the link here for a deep dive of access Keys by NEAR’s very own Mike Purvis!! • (Part 1/2) NEAR accounts & keys: full acce...
Happy hacking!
------------------------------------------------------------------------------------------------------------------------ Time Stamps: 00:00 Intro 00:43 NEAR Wallet Setup 02:00 Terminology Summary 05:08 NEAR Wallet Overview 07:54 Create Near App 16:00 NEAR CLI 17:12 NEAR CLI Account 19:06 NEAR CLI Keys 20:11 Sending Tokens 21:22 Contracts & Code Id's 27:13 Full Access Keys VS Function Call Keys 28:27 Requesting Full Access 32:30 Designing A Blockchain App 37:36 Blockchain App VS Regular App 41:47 Prototyping Tools For Development 43:30 RECAP 45:47 Outro ------------------------------------------------------------------------------------------------------------------------ Resources:
To get connected, join the NEAR Discord: - near.chat
Videos to help you get started on NEAR: Understanding What Blockchain Is: High-Level understanding of Blockchain and smart contracts -https://www.youtube.com/watch?v=SSo_E... Blockchain JS Example - https://www.youtube.com/watch?v=zVqcz...
To learn the language used to create your own contracts like the one in this video: TypeScript Crash Course by Traversey Media - https://www.youtube.com/watch?v=rAy_3...
NEAR Documentation used for this application NEAR Orientation - https://docs.near.org/docs/roles/deve... Smart Contract Introduction - https://docs.near.org/docs/roles/deve... AssemblyScript Overview - https://docs.near.org/docs/roles/deve... Create-Near-App GitHub Documentation - github.com/near/create-near-app Contract Structure -https://docs.near.org/docs/tutorials/... Using Contract JS - https://docs.near.org/docs/developmen... Understanding NEAR JS implementation https://docs.near.org/docs/roles/deve...
Let me know what I can improve on, what you would like to see next, or any questions you might have in the comments below!
Thank you for watching!
Coding done by Dorian Crutcher, Editing done by Chad Lamon
Transcript
8,395 wordsCaptions as YouTube publishes them, usually machine-generated, so product and people names can be misheard.
- 0:00
hey everyone dorian crutcher here welcome to the first near blockheads bootcamp video series in this series i'll show you everything you need to know to get a head start on developing applications on the near platform so in this first set of videos we'll be going over all the fundamentals in regards to the near platform and the near blockchain going over things like what are new tokens how to develop smart contracts in the near environment and just overall how the near platform works we'll be doing
- 0:23
all this while working through examples to kind of help you solidify these concepts all leading up to a project at the end which would nicely tie up everything together for you said and done i'm really excited i hope you are too so i say we jump in and get started so if you've seen any of my videos before you will see that i've come to this page rather frequently so i want you guys to go to wallet.testnet.near.org
- 0:51
and create an account then they'll give you an option um or a list of options once you do phone recovery you're gonna get a verification code okay so there we go we've actually created our account but i mean what is this for like what why do we need this the one allows you to make contract calls to the blockchain except your local node send and receive funds to other users and the wealth also acts like your account to um two
- 1:17
third-party applications made on the newer platform so you can actually use this to log in to your account so i know the term wallet is kind of weird i found this id in this wallet and if that's the case this must be your wallet that makes sense to me then take it it's not my wallet oh you wallet and kind of like change your definition of it it's like it's essentially like your key to um different blockchain platforms in this case it's the key to our near um blockchain
- 1:52
platform allowing us to send tokens log into thirdplay applications and just do much much more this is how you create your wallet so i know went over a lot of terms so i thought a big idea to summarize them up into a nice little cheat sheet for you guys so the first term is wallet which is just essentially your blockchain account it's not to be confused with a conventional wallet it's not my wallet i thought you might think of just like holding your
- 2:20
credit card to money it actually it does that but does a lot more so on the near platform the wallet does manage your cryptocurrency like you might think it would it also manages your access keys and it can even be used as the account that you use to log into your third party applications so you can actually use as your means of logging in logging out imagining all your applications kind of like the way that facebook lets you log in or log out onto a slew
- 2:45
of third-party applications across the internet so you know when it says want to log in with your facebook it's kind of the same thing with the near wallet account on cryptocurrency accounts created on the near blockchain so it's a little more than just your conventional wallet um nft which is not fungible token it's just any unique asset that is recorded on a blockchain so think of a personally signed baseball card or kind of like a serial number
- 3:10
that you might find on some item uh this can be digital or physical and even though it has the word token in the name this is not a form of cryptocurrency i want to be clear about that uh it is just means a unique item or asset so again because you know we have near tokens we're working in your environment so you hear near tokens a lot a non-fungible token is not cryptocurrency like a near token is it just means a unique item or asset so think of the cryptokitty examples i mentioned earlier
- 3:45
a smart contract is next is a unique is a set of instructions that executes when some conditions have been met on the new platform that is written in typescript or rust uh next up is blockchain this is the super short simplified version this is obviously a little more involved but the short version is as a linked list that's on that exists on a distributed peer-to-peer network in which validators must agree to
- 4:09
initial additional blocking added onto the blockchain uh that last little bit of the valder is agreeing to add an additional block down to a blockchain that is called proof of stake that's a short version of what proof of stake is the other version is proof of work which is essentially what bitcoin runs on when you're trying to mine something uh but for now on the near network we utilize the proof of stake method so next up you
- 4:33
have gas gas is the fees calculated by the cost of computation for each addition for each addition to the blockchain or to the network so a gas does incur fees meaning that like to say add information onto the blockchain you have to pay some sort of fee to a validator and that fee is calculated by the cost of gas near tokens is essentially just cryptocurrency new tokens is cryptocurrency that exists on the near blockchain um so here's your cheat sheet uh take a screenshot download it i'll
- 5:05
make it available for you guys if you want and yeah let's move on let me give you an overview of what's actually happening here so here you have your account name your total balance the minimum balance needed to keep your account open and your valuable balance if you ever need to go back to any of these definitions you can hover your mouse over the little eyes here little information buttons here again this is your account page you can navigate to here by clicking on profile
- 5:30
the data on this account is actually is stored and accessible on the um near blockchain meaning it's on um there's no central server that's actually holding this information for you so it's on a distributed node a disputed network of nodes that's actually pretty cool you can request tokens from other account holders uh so you can give them this information to then have them send tokens to you
- 5:55
here's a winner you can use to send tokens to other near account holders i'm going to send uh send like two tokens to blockheads.testnet confirm and send and these are just test tokens again i'll go into tokens a little bit later go dashboard and you can get to this dashboard by hitting on the summary button um so you can see that like i've actually sent and transferred two new tokens to blockheads.test.net
- 6:21
it's been recorded and added to the blockchain and get a more detailed view of the transaction here i remember so that so that your wallet is essentially your account managers again it's not like a normal wallet so when you kind of like make that dissociation in your mind it comes to blockchain applications so if i go over to authorize applications you can actually use the wallet here to
- 6:48
manage um applications you have authorized to use and access your account so you have two different levels of access like function call access and full access here this other window you can see the accounts that you've given full access to meaning that like these third-party applications can actually send in your tokens on your behalf so you want to be mindful of what you give full access to in terms of the accounts if you see that you have a third party application you no longer want to give access to you actually hit this button hit
- 7:19
deauthorize uh this will all make sense once we actually make our own application our own third party applications and sync them to our near wallet the final thing i want to show you before i move on is if you hit on the um help button you're gonna launch to the near discord or you get like a discord invitation link so if you don't have a discord account i encourage you guys to make one so you can get plugged in with the near
- 7:43
community so now we have the wallet out of the way i think it's time to jump into the development tools and nearest great day to make it easier for you guys to develop your blockchain applications so with that i say we jump into create new app and creating your app is a tool that will give you a head start on developing your blockchain application just like great react episode tool that will like essentially
- 8:07
give you a setup it sets up your network configuration settings so uh essentially you can think of like mainnet versus test net which is essentially the two different networks that the blockchain is being hosted on mostly functioning and test net for this project in this course your app configuration settings so connect it to your wallet give you um some really cool functions so log in and log out and just kind of like set you up with the basics you need to at least run your application
- 8:31
um also you have to write your contracts and semi script to rest we'll go to more of what each of those are later and it will even give you like i said an example application so you can kind of see how everything's wired up and like you can even use some of those like functions that are already built into the application in your main app so you head over to node.js website and
- 8:55
download the lts version the one that's recommended for most users it tends to be more stable than this other one i would recommend downloading via a visual studio code um this is my preferred text editor this is the one i'll be using for the examples in this workshop but you can use your own preferred text editor if you if you'd like but i do recommend downloading this so when you open up vs code and then
- 9:19
type in npx create near app and give it a name so let's give it the name example one cool and there we go upon running this application you're going to see um your example one folder appear here so you can navigate into it by typing cd within the name of your project folder go to source um you can see all these files here uh this is all just vanilla.js no framework involved um but we will include a framework in a minute but right now we have index.html um
- 9:59
in index.js and what this is actually creating is actually creating an example application so you can actually open and check out that example application by typing in yarndev nature is amazing okay there we go so it's running at localhost1234 so you have um this example application what does is you can change your greeting to your own little application your own name so i'm logged in currently as
- 10:24
blockheads.testnets just kind of stayed logged in after i recreated the wallet create our wallet account um so you just change the greeting hit save and it changes this hello to something else and saves it on the blockchain which is kind of cool uh gives you some cool notes about um where with some where things are located in the create in your app so you can find your contract calls your um you can it tells
- 10:47
you like how to start and how to initiate your um your scripts that come with creating your app but we can go over this in a minute so i want to head back over into create new wrap kind of give you an overview of what's happening here so first thing i'm going to do is go over to youth utils.js this is kind of the central connecting hub for a lot of this application so um a lot of these functions that you see here
- 11:11
such you as near config get config like all these um all these like kind of like unique app unique variables that are here are coming from the uh near api js package so you have connect contract key storage and wall connection we'll be working with these and adding even more to these later on i'll drop the github link in the description below to the near api.js as well as some new documentation for you all so what's cool about creating your app is that it sets
- 11:44
up a lot of the stuff for you like as early as mentioned earlier so you can go into your config folder to see the information of each of the different networks that the configuration folder is connecting you to as a user again we're working in the test net so luckily lucky for us the testnet is the default case for the configuration heading back to utils you're going to see over here we have these two things called new
- 12:07
methods and change methods these are actually um how you make and make contract calls to your custom contract functions um before i move on with what these actually mean i'm going to show you where the contract functions actually are so go over up to the assembly folder and down to main.ts so this is written in assembly script which is a dialectic typescript so essentially within typescript
- 12:32
again warrant a little bit later uh they have two example functions here the get grading and segregating function i'm going to read these to see what they're more about but these are just for the applications we can just move on from these essentially all you need to know for now is that your contract functions exist in the main.ts folder inside the assembly folder get back to youtube.js any like contract call you any contract
- 12:55
function you create will then be placed as a string into the methods and change methods arrays here so the difference between view method and change method is that the view method will return some value or some information that you want to pull from the blockchain to for your application while the change method actually adds or changes the state of the blockchain so it's important to know that um that like distinction so
- 13:21
this is essentially all you need to know for just the the raw vanilla version of creating your app so now i want you guys to hit command or sorry control c i'm right on the mac but control c to stop the development server from running and i want you to navigate back up um one folder to the near workshop folder or whatever your directory is but just navigate out of the example one fully recreated so do cd dot dot now we're back in our directory above it
- 13:57
so now i want you to type in uh create i'm sorry npx create near app dash dash front end is equal to double colon i'm sorry colon uh react to the name of our application which we're going to call example two so let's just call this um example two that makes sense to me so we can go into example two uh we'll first navigate into it so type in cd example two um you can run yarn dev again
- 14:44
so let's refresh your page you should see the exact same application oh yep you type it up here it's good so uh it's the same example um that we had before um the only difference is that this is structured for react so you can go into your source folder you can see you have your app.js file here in your index.js files just referencing this app from this app js file here as a component so just a normal just theorem around the middle react
- 15:15
setup um again this is exactly what we're going to be mostly using for application um and everything other than you know the initial setup of like going from index.js to um your app.js is the same so we go to utils.js we find the same functions we saw before we see the same login and logout features the same v method and change method arrays config and then your api js library go into assembly and go to main.ts and this is exactly the same
- 15:49
so essentially on the step is exactly the same but the front end m and all the packages installed include react so you can develop in the react environment so now let's enter into the world of near cli i know that terminal like stuff sometimes seems pretty scary but it also gives you a lot of control a lot of like ease of access to um be able to control the near api so what is the new cli so the new cli is a fully featured node.js command line interface
- 16:24
that acts as a wrapper for the new api gas so it gives you full control and full direct control of the near apiges wrapped up neatly into some nice terminal commands so with that you can create accounts delete accounts log into an account view public keys view account state which is like the metadata for your account and then send your tokens and also state tokens and honestly much more past that
- 16:47
so why should you know about it so again it allows for direct control over the near api uh provides a better better understanding of like how the creating your app works create you know by creating dev accounts and deploying contracts which is another thing you can do with the new cli and this will also allow you to write your own scripts in the package.json file for development as well as like in the ad bash terminal so yeah i mean this is a very powerful tool
- 17:10
and i definitely recommend people like learning it so now that you have your environment installed i want you to head over to your terminal and we can go through some basic examples of what you can do within your cli so first thing what you do is type in your login it's going to spit you out to the near wallet so okay so should spit you out to this page to the near wallet i'm requesting full access to your account so what full access means is being used to ally to deploy and redeploy contracts on your account's
- 17:42
behalf uh send your tokens and allow you um full control over your account and your access keys so you're going to be um careful with what you allow folks at full access to but um with the new cli that's kind of what you want you want full access full control of your account so type allow or click allow and retype your name so block heads dot test net so you get to this window i'm like no you're logged in so you can close you
- 18:11
can go ahead and close this window head back to your near terminal and here's some cool things you can do with your um with the uh near cli so you can type in near state and type in blockheads.testnet you get your account information so the amount of new tokens you have um in the auctioneer the locked tokens the code hash right now these are all ones because i have no contract deployed to blockheads.testnet storage usage storage paid ad the current block height of the blockchain
- 18:44
the current block hash of that block and then the formatted amount of your near token so this is yacht down here and this is just um your near tokens in near so again unit measure is the octave year for this one which is why it's so big which is like 10 to the 24th and then like the uh you have your format amount which is your normal count for your near tokens with the near cli you can also get information on the keys paired with an account so let's type in near
- 19:16
keys block heads dot test net oops you can see all the keys that i have i'm paired with this account so all these so all of these um it's all these function call keys you see here are like limited access keys that only allow for non you know financial um transactions or contract um calls uh you can also see the accounts that the contracts are are deployed on so this is the account that this contract
- 19:49
has been deployed on that i'm allowing this function called key to interact with there are also full access keys from several other contracts that allow actual um financial or in the words like cryptocurrency exchange with my account or with blockheads.testnet yeah you can see all this information here so remember that we have full access to our newer account so i'm within your cli after we logged in so i can actually use this to send tokens from one account to
- 20:24
the next so i can say near send block heads dot test net which is the sender account to the receiver account which will be block shop.testnet an account i created for an application i made in my other videos i'm going to send them two new tokens so then you get the transaction id and a link leading to the near explorer so i'm going to copy over this link move into my browser paste it right in and here you see the new explorers and see the transaction fee the deposit value
- 21:02
the gas used for this transaction and the data occurred as well as the hash and some other information so you can actually see that the transaction has been recorded on the near blockchain it's on live so now i think would be a good time to take a high level look at smart contracts because you're going to hear about the this phrase a lot or this idea of smart contracts a lot with blockchain applications so a smart contract is essentially a file that consists of lines of code that execute once some predetermined conditions have
- 21:42
been met and that's really it that's all they do so again it's just code that executes once some precondition conditions have been met moving on so a smart contract compiles down to webassembly so the new smart contracts are written in an assembly script um which is a dialectic type script which is a lot like javascript it does a lot of scripting and rust you use assembly script for essentially like non-uh
- 22:06
financial exchanges that you would use more like russ which is a systems levels language to write contract for actual like financial transactions so both these will compile down to a dot as in file and first what is webassembly right so webassembly is a new low-level byte code format for the web stack based virtual machine so essentially takes your code and compiles it down to low-level binary which is supported by all of our browsers
- 22:30
to perform which is also very high performance so it's a very efficient language it's pretty new and it's actually fairly exciting and commonly used in the blockchain world for mining gaming and whatnot so what is a code hash right so in the cli examples i showed you guys how to show the state of your account so you can see your mount the locked and then you get to this thing called a code hash so a code hash is created using the sha 256
- 23:03
cryptographic hash algorithm didn't i tell you i was actually born on a sha-256 cryptographic hash algorithm so essentially this is a unique signature generated from that dot wise and file that i mentioned earlier that your contract gets compiled down to um so your dot wise and file gets thrown into this hashing algorithm and then spits this out um so why should you care about this is
- 23:27
that this will allow you to verify that the correct contract is being used for the transaction you're conducting um just a quick note remember that hashing is different than encoding so with encoding you can encoding is typically reversible so you can encode something take that code version and if you know what the encoding algorithm was you can you know theoretically just like work backwards with hashing you can't it's a one-way stream being like
- 23:53
you have to have the original file to know where this hash came from you can't go backwards so that's like hashing is so secure so um this is what a code hash looks like when an account has no contract deployed on it so each contract needs a place on the blockchain to live so it gets deployed to an account so it lives in an account so whenever you deploy you're creating your app here if you're on yarndev and it take it takes your contract creates a dev account for it which is just like any other account that has
- 24:24
its own amount it has its own storage as its own gas um and then it'll like give that contract a place to live in that account so even the accounts you make in your near wallet like mine like blockheads.testnet i could deploy a contract to that but right now my block has said that testnet does not have any contract deployed to it so it's just a string of ones so now this is what account looks like
- 24:47
when it has a contract deployed onto it ooh or that little clip there um so you can see that uh this dev account which is essentially like a temporary account that's been made to host this contract so again this account has his own amount near has it has option for locked tokens here's the code hash you can see that this is actually populated with some contract um so yeah and it has all the other information and the format account because you actually do
- 25:19
need tokens to run these um dev accounts even but yeah that's essentially what it looks like when one's populated so again let's go through example of like why this is important to know like why this is a good thing to keep in mind this thing meaning the code hash or the code id so let's just say you purchase an item in this example you purchased item from an online store uh in the original contract that the
- 25:45
application or the store was made it was built on top of um let's just say it has the account name the store being that this store has the account name block shop at this is the receiving account for the near tokens that you want to send the store for your items u.testnet meaning you the user will post the account that is receiving the items that you want to buy some hacker bro 23 manages to somehow
- 26:10
replace the contract in the governing application and switches out your name for his own so then like you pay the money but then he will receive the items uh once the transaction begins meaning once you hit that like send money button hacker bro 23 um you hacker bro 23 will see if the transaction will fail because his new contract that gets compiled to a wasm file will get compiled to a new hat sorry we'll get will generate some different hash that it's like that's not
- 26:42
that's not the hat that's not the original hash of the original contract right so you have some code or some logic that can verify the original contract's hash so the transaction does not execute and it fails so he does not get your items so that's a cool thing about knowing about these um these like code ids or like these hashes because then you can add this like level of security into
- 27:06
your application to prevent someone from like switching out contracts on you on like big important uh transactions in the near cli section i touched on the idea of full access and function call keys and i want to dive a little bit deeper into that so you make sure you have a full understanding of the difference between two so full access key allows the application to act on the accounts behalf meaning that
- 27:36
this application can now send near tokens or deploy new contracts onto that account typically if you're working with an application that of course that works with the near wallet as like a means to log in or log out you will see this window here to your left if the account is requesting full access uh whereas in the function call key or whereas for the function call key it provides only limited access to the account enables sending only non-monetary function call transactions from the owner's account to the receiver
- 28:09
and allows a new user to use your contract on chain without having to have an account of their own so on the right this is this is typically what the wallet will show you when you're logging in to a application that's utilizing only a full or sorry a function call key now you have an idea of what the difference is between a full access key and a function call key i'm sure you're all wondering like i was how the heck do i
- 28:42
implement that into my application have i how do i request access full access to my wallet when i want it so i can send near tokens which is a completely fair question so for this application i have open on screen this is the application i made called block shop which i made in a tutorial for block heads if you're interested in finding that where you have some items here it's like little
- 29:07
digital store where you can add items to a cart and purchase these items um for this many year tokens right it's pretty pretty straightforward um so i'm going to log in immediately see that this is requesting function call access to my account meaning that i cannot send your tokens with this so let's log in and see what happens so i log in you can see i'm logged in up here you can see my inventory of items and let's say i want to buy butterfly
- 29:43
so hit submit and immediately you see this error appear it says area saying that this is not this does not have the right correct permissions or correct access key to be able to send your tokens off to the blockshop.testnet account so what's wrong how you fix this this looks super complicated and super scary i'm sure but let's go into into vs code and see what we can do we can alter to change this so here i'm in utils.js if you run create in your app this is a file that's automatically created
- 30:14
in the create new app up so yeah creating your app uh boilerplate or set or you know starting template um simply go down to in utils.js to the export function login again utilization and you'll find this um this line right here so this is already written this is already like included in your code including the example code that comes with creating your app so i could do is like go inside these parentheses and place an empty string as the argument for this
- 30:46
function so this dot window.wildconnection.org signed a function just place an empty string here hit save now let's go back to our application you can see everything reloaded um so we're still logged in so let's log out log back in and now you can see this window appear requesting full access to my account so i'm being like this provides access to all of your tokens to proceed with caution right but that's kind of what we want for this example for this application
- 31:17
um again uh this is not remember this is for going into like levels of security it's not really like covering any um like like code id hashes your hash verification so um but this is just an example application to give you an idea of how to how to grant full access so i'm going to hit allow it's going to ask you to verify hit confirm sound back to my um to my blog shop see my inventory loaded now i'm going to try to buy another butterfly hit submit
- 32:00
just wait a minute and you can see the receipt for that transaction and my new inventory so if i refresh the page you can see my count for my butterfly went from five to six so i gave the shop my near tokens and it gave me my butterfly in return and put it in my inventory so that's how you actually um that's what you do to set to change your settings to allow your application to request full access to your new wallet
- 32:36
here we are at the part where i'm sure you guys are super excited for how you're actually about designing a blockchain application so i put together a star pack for you guys to kind of go over the use cases of blockchain applications uh some design tips and some structural analogies to compare a blockchain application to a normal application so how do you actually model a blockchain application well first i think it's really useful to go over what you can even do
- 32:59
with this technology with blockchain tools so um some use cases for blockchain applications would be for tracking transactions of any kind so say you're making a digital store and you're selling um assets for cryptocurrency uh you can you know facilitate that exchange of goods using crypt smart contracts and blockchain tools you can also make a decentralized bank to make to keep a ledger of every transaction between users and you know you can even exchange information using blockchain
- 33:31
applications that's just one example um ensuring that an item is unique so this breaks into the world of non-fungible tokens so uh i'll go over an example of non-functional tokens so that makes for a sense of what i'm talking about before i super deep dive into that definition uh decentralization so uh this is kind of like a high level philosophical idea but um philosophical and practical so instead of like having
- 33:55
one core location for your service or your product um say like facebook everything's kind of like all your data goes to facebook and facebook say has a control over their own some servers or entities uh blockchain applications exist on a peer-to-peer network which is a decentralized network so that this service exists on multiple nodes multiple computers around the world it's a decentralized thing so like
- 34:20
it's extremely difficult to break it's not as fast as a centralized network but it is is going to last for a long time and no one necessarily owns the data in this sense so it's kind of that's kind of super fun and we can have we're also going to talk about the world of decentralized games so here is the example of non-fungible tokens the thing i mentioned earlier uh so if you guys have heard of blockchain you've most likely heard of cryptokitties and if you haven't you're going to know so cryptic kitties
- 34:50
are a lot like baseball cards we can do these cryptic kitties you can breed them you can create them you can make your own little cryptokitty um and what makes these cryptocutes special is that they have like different traits that go along with any of them that can be brought into other cats so these traits these like specific properties of the cats make them rare so literally digital cats are rare and how they kept rare is that they exist on the ethereum
- 35:14
blockchain so the code that actually generates these cats are what are what brings its value so not necessarily this picture but the code that exists on the blockchain that is that is like that belongs to one single person at a time so they can trade these just like baseball cards so here's like a baseball card and here's this like rare magic card called the black lotus i think it's worth like 100 000 or something like that something crazy
- 35:38
but it's rarity can now be implemented into the digital and into the digital space which i think is kind of fun here's something i made recently uh for the halloween special blockheads this is the blanco lantern application this is my version of the implementation of non-fungible tokens so each of these are custom unique pumpkins their code exists on the blockchain on how they're actually created or developed
- 36:02
and they only belong to one user at a time so this is the user that owns this particular pumpkin but they can freely trade or exchange this pumpkin with other users so this is something i created and let's go over to here some more examples i created so here's a common application it's a voting app so i have two candidates here featuring parks and rec nature is amazing so you can either vote for one candidate you can get a description of what they stand for and like what their platform is um and you know i thought this is very fitting
- 36:32
for voting season so um each vote is recorded and kept secure on the blockchain uh you can't change it you can't go back and undo it it is there and it's not going anywhere so it's like an example of like you know how like blockchain could be useful for something like voting blockchain has even broken its way into the world of gaming so this is called zed run so these horses are unique these horses have their own properties they
- 36:56
they're they're raised and bred on like on this on this blockchain network this actually runs on near on the near blockchain so a smart contract is put in place to actually exchange money like based off like based off of which horse you bet on a deal is part of your horse or i think you can like bet on other people's horses after like watching a game so the smart contract will facilitate that exchange of money um you know and bets after this race is finished so
- 37:25
these are a few examples um there's so much more this is literally just like scratching the surface so we can do with blockchain applications but here's a few examples of what you can do once you get really good at developing a blockchain application so how does a blockchain application compare to a normal web app i'm going to go over some of the key similarities and differences between two types of applications so you guys can hopefully better understand what's actually happening for
- 37:52
this comparison i'll be speaking in terms of the new platform not other blockchain platforms that exist in blockchain space for a front-end development both are essentially the same using javascript html and css you're stable to use some sort of framework on top of that if you'd like such as react view or angular for both blockchain applications and normal web apps the backend is really different so the backend for blockchain vacation we'll use it we utilize assembly script and rust to develop smart contracts on
- 38:15
you to communicate with the blockchain or the near blockchain to store and retrieve data to and from blockchain there's a similar type of normal web app will communicate with a database such as mongodb by using something like node or php to communicate with the server moving on what is a blockchain so this is a super short basic version of what a blockchain is just to give an idea of what's happening behind the
- 38:39
scenes of your application uh much more technically that will be provided in later videos but this is just to demystify and like hammer the abstraction of what's actually happening behind your application the blockchain's comp is commonly thought of as a linked list and the linked list is just a chain of nodes that hold some sort of data within each node such as a reference to the as well as a reference to the node directly preceding it or succeeding it
- 39:02
continuing on the blockchain holds some sort of data and a key to access this key can be used to access the date with itself an additional key is held within the chain to access the key of the preceding block so every block has a key to access the data within itself and a hash to access the data within proceeding block to add a new block to this chain you have to have a fully verified copy of the blockchain
- 39:26
different validators on the new platform but you will have to come to agreement or consensus that your addition to the blockchain is valid this process is made less intensive through a process called sharding so like for the stage you really need to know what sharding is but essentially it's just breaking up the entire blockchain to little sections or chunks except people don't have to copy the
- 39:48
entire thing but copy a smaller chunk of it is the short and sweet version so what are things you actually need to know to build a blockchain application um so what you need to know we need to keep in mind that you can store and create data on the blockchain you can use smart contracts to communicate with the blockchain the smart contracts are kind of like your bridge to the blockchain just don't retrieve this data
- 40:12
uh the blockchain can act as a backend to your database not that it always should uh but like it can uh the consequences of using your backend is like a place using the blockchain to store exclusive your data is that it can get expensive so it's important to keep that in mind but for this early stage and for like these like beginner applications you should make it's perfectly fine to use the blockchain that places storage data
- 40:36
gas is used to run contract calls gas again is the total computation cost of adding something or changing the state of the blockchain and gas is paid for by cryptocurrency on the master account so some use case examples for applications that utilize the blockchain are a voting application for example that will store candid vote counts on the blockchain so you can see and have a full ledger of everybody who's voted and what they voted for or can keep it anonymous with
- 41:01
them if you want depending on how you design your application a pumpkin drawing outlook that one i showed you guys earlier will store the pumpkin drawing instructions as well as the pumpkin id and transaction records as well as the owner details on the blockchain so that all this information is kept stored and tracked on the blockchain to ensure each pumpkin is unique and to ensure who owns pumpkin who has previously owned that pumpkin
- 41:25
a digital store can also is a pretty valid and pretty common example that of something that can like exist on the blockchain so you have the store that uses smart contracts and the blockchain to keep track of transactions and facilitate the exchange of goods on the blockchain so these are a few basic concepts that will help you develop your application and help you move forward
- 41:46
in your process so here are some prototyping tools that i've used that i found to be helpful with developing my blockchain applications miro and jamboard are both collaborative whiteboard apps uh balsamic's a web prototyping application and i even use google slides to design some of my web apps that makes sense to me to show you some examples uh here's jamboard uh for designing um the or just like brainstorming the pumpkin carving app i showed you guys earlier
- 42:17
here is miro it's something similar so you can draw shapes i haven't used this one too frequently but you know you can collab with your team to actively draw and create your web application to ideate that and here is balsamic so balsamic has these cool built-in tools to help you design and lay out your web page so you can make a new browser window by dragging and dropping this here type whatever like block heads web page you can get the title for that
- 42:47
web page you can add buttons charts some filler text just to get the idea of the layout for your application and i've even again like i said use a google slides to lay out my tiles and get my give myself an idea of how i want my application to go and like what i want this page to actually look like so what's cool about google slides is that they actually do a pretty good job of just having these little alignment features alignment tools um you can copy and paste these little tiles and add these little stickers whatever so
- 43:19
you know here is my block of lantern uh framework so these are just a few tools you can use to prototype and ideate and shape out the front end of your application it's a great job guys i know there's a lot of information packed into one video and i want to thank you guys for sticking with me so far i think it'd be a good idea to do a quick recap of everything we learned and also give you some next steps moving forward so uh we went over the near wallet and established that's not only a place to
- 43:50
uh keep track of your new tokens but also a place to manage your access keys send and receive new tokens and it can act as your um your users account uh login for any blockchain or third-party blockchain applications that you or another developer may make we also whatever some cool useful tips and tricks you can do with the new cli for development and went over the create new app structure and overview for both vanilla um js and react.js
- 44:15
we also took a dive into smart contracts and how they work in general in the blockchain world and how they function on your platform to facilitate your exchanges uh with uh to and from the near blockchain uh and we also kind of took a quick little look over on typescript particularly but whenever the idea of like typescript reps and rust being used to create these smart contracts i also took a quick overview of cryptography and how it relates to
- 44:41
smart contracts and we also went over some key differences between the full access keys and the function call access keys and then finally we went over the differences between a normal application versus a blockchain application to see how they're similar and different uh so you can get an idea of like what analogies you can kind of tie between the two to hopefully help you develop your applications a little better moving forward also went over some real-world blockchain use case examples such as
- 45:05
cryptokitties uh the voting app and the pumpkin carving up i should i showed you guys as well as some uh design and prototyping tools you guys can use uh to get started in creation development of your own application moving forward i definitely recommend to check out the next section section two uh where we'll be building this application which is called block view it'll kind of be a nice tie-in together for all the concepts we learned today
- 45:29
to uh go over some of the information that's displayed and provided to you from the near blockchain um as well as how to create and structure uh your smart contracts and make smart contract calls and log in and out of your account it'll nicely tap everything we've learned in this first section and hopefully get you guys started on creating your own blockchain applications hey guys thank you so much for watching this video i hope you enjoyed it was there anything i missed was there anything i should go deeper into or do you have any questions that you want to ask me let me know in the comments below and
- 46:01
i'll get back to you guys as soon as possible i want to make more of these videos in the future so i definitely encourage you guys to give me as much feedback as you can because that's going to help me make this content better for you all that makes sense to me then take it it's not my wallet go check out section two of this two-part series to learn how to create block view because that's gonna really tie in everything we covered in section one and put in fighting shape to make some really cool knockout applications
- 46:25
in the future i can't wait to see what you guys create uh thank you guys so much for watching like and subscribe and share with your friends and with that have a good day you