Check out a free preview of the full A Tour of Web 3: Ethereum & Smart Contracts with Solidity course
The "Web3 Terminology" Lesson is part of the full, A Tour of Web 3: Ethereum & Smart Contracts with Solidity course featured in this preview video. Here's what you'd learn in this lesson:
ThePrimeagen explains some common terminology like Web3, Ethereum, provider, contract, and wallet. The ethers library is abstracting the communication between the application and the network. The hardhat library provides the compiling, testing and deployment support.
Transcript from the "Web3 Terminology" Lesson
[00:00:00]
>> So let's go over some basics, some things that will hopefully make more sense. Often when people say Web3, they mean blockchain technology, right, being able to do something specific with blockchain, right? And so, of course, that means for us, that's gonna be the Ethereum blockchain, which means we're developing smart contracts on the Ethereum network.
[00:00:17]
Boom, Web3, fantastic, right? A Provider, I keep saying this phrase, Provider, which we saw with MetaMask. Straight from the ethers documentation is a Provider abstracts a connection to the Ethereum blockchain for issuing queries and sending state changing transactions. So meaning that ethers does not know where your network is, I've said this before, but it does not know where your network is.
[00:00:41]
It effectively needs the pipe. And so your provider is a pipe, effectively. It says, okay, you make your request through me. I know where to request it to, I will forward your request to that network and return the results. And so there's kind of a specific API that they already have set up for provider.
[00:00:59]
Web3 or MetaMask, they have a little helper function that we did execute that actually transforms the MetaMask object into an ethers Provider that we used to contact for our Hello World. A contract is just code written in Solidity that has been compiled and deployed onto a network. It has an address that is no different from a wallet address.
[00:01:21]
You cannot look at a contract and go, that's a contract address, that's a wallet address. They're identical in all shapes. You can send money to a contract just like you can send money to another wallet. The only difference is, is that it also has functions you can call on it.
[00:01:35]
A wallet of course is just a public private key combo. You really just need the private key, if you have the private key, you can have everything back. By the way, the ability, let's see it. There's also really one more important thing. By the way, I don't know if I've covered this yet, this is a key piece of terminology.
[00:01:52]
It's the ability to tell someone that you know something that they probably don't know, or that you're proficient in obscure piece of technology. So now that you all are learning about Web3, you will shortly, after this course, be able to go out and be like, by the way, I did learn about Web3.
[00:02:10]
And they're not even gonna know what questions to ask you. It doesn't matter. You got to by the way them. So for example, I can say I use vim, by the way. I type in dvorak, by the way. And also I write CLI programs in Rustling, by the way.
[00:02:23]
Rustling, obviously, a feature, not a programming language. And so, very important, so as you go on, you're gonna to be able to do this and it's fantastic. I don't have the ultimate, by the way, which is using Arch. Unfortunately, I have kids, you're not allowed to use Arch Linux and have kids.
[00:02:37]
It's kind of a rule. You can't by the way people. So it's very complicated. I wish I would have been smarter in my 20s, could have already done that, but I didn't. All right, so some technology we're using is ethers. Ethers is the main kind of abstraction for the Ethereum network.
[00:02:53]
And so it provides all the ways for you to be able to call, it creates your contract from an interface. So it's just like a JavaScript object, we've already seen that, we're kind of familiar with that. Hardhat is the testing backbone, right? It is all the infrastructure you need to be able to launch out your smart contract, right?
[00:03:09]
It has those extra methods attached to ethers for being able to read a contract off of a disk and get a contract factory, be able to take that contract factory and deploy it to a network. So it is very beautiful. It actually abstracts a lot of things. It also has that nice network.
[00:03:24]
It's fantastic. MetaMask is obviously the browser plugin. It's the defacto standard. It is a both a provider and a signer. A signer is the ability to make a state changing transaction. Whereas a Provider only allows the ability to call to the network and read functions that don't alter state.
[00:03:46]
You'll notice that on the web, I never referenced hardhat. Again, that's because hardhat is purely on the infrastructure side, it's not on the website thus far, at least. I'm sure there's a way you could make it on the website or there might be some benefit, but right now, I see no benefit and I'm pretty sure it just won't even work at all.
[00:04:04]
So let's jump over to the whiteboard, which is right here. And I'm gonna kind of go over the whole process again, but let's use boxes and arrows cuz sometimes that just helps a lot. And so one thing right away you'll notice is that we wrote a contract, right?
[00:04:17]
It's in Solidity. We called out to hardhat. And with hardhat, it takes this and produces out a JSON file that actually has the bytecode in it and, of course, the interface. Then we created the deploy script that actually uses the hardhat information to grab all this and deploy it out to a network.
[00:04:39]
Now, this network, it doesn't have to be local, it can be anywhere. We use hardhat to create said local network. And so now, it has all the exact same features as a full fledged network except for it's on our local machine. Then we created a browser little script here and we used MetaMask and we pointed MetaMask to this local network.
[00:05:04]
We used our little JavaScript to call into MetaMask, which called into this cloud, returned the results back out, and returned us those results. And we were able to display, Hello Frontend Masters. So that's effectively what is going on. Does everyone kinda have that same picture in their mind, right, the kind of the set of steps?
[00:05:28]
I just wanted to make sure we really have these foundational steps cuz as we go forward, if you don't have these, it just is difficult. All right, we do have one question
>> How does ethers differ from web3JS? Would you ever wanna use Web3 instead of ethers?
>> So Web3 has much more functionality.
[00:05:52]
Ethers is really, really simple. And so that's one reason why I just like it, is that it's limited in its functionality. Web3, obviously, you can do a lot more with. And probably long-term, is the better con or a better library to use. It's just ethers is specifically focused on one thing, Ethereum, and it makes it very, very easy to use.
[00:06:11]
Honestly, I mean that's why I primarily use it, is it just works very, very well. There is a nomiclabs/hardhat-web3, you can have all the same niceties with Web3 as opposed to ethers. I just like ethers for now. It just makes everything straightforward. Plus, there's a lot of really great tutorials on it.
[00:06:31]
It just seems to be a very simple one to use. It's kinda like the jQuery at one day. You could just search up anything on jQuery. You can solve math with jQuery, it's beautiful.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops