You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We run the `npx hardhat` command to create a basic project:
152
+
We run the `npx hardhat` command to generate a basic project:
153
153
154
-
<SideDrawerbuttonText="What on Earth is Hardhat?">
155
-
Since we’re flying to Jupiter, we need safety apparel! And that’s what Hardhat is. It provides a blockchain for us along the way, where we can have lots of ETH in our wallet, and we can waste as much as we want, and get hit on the head with
156
-
asteroids without getting any scars.
157
-
158
-
Hardhat lets us do all the things we did in Remix, but instead of clicking
159
-
‘Deploy’ and ‘Compile’ buttons, or reading our logs from inside the browser
160
-
IDE, we will be writing our commands in the console and debugging our errors
161
-
from a code editor on our ‘local’ computer.
162
154
163
-
Hardhat is simply a set of tools that includes a local mini blockchain that
164
-
can run on your machine.
165
-
</SideDrawer>
166
-
167
-
After you enter your `npx hardhat` command, what information can you see? What
168
-
are those ten lines and what is?
169
155
170
156
```less
171
157
// 888 888 888 888 888
@@ -186,6 +172,19 @@ are those ten lines and what is?
186
172
Quit
187
173
```
188
174
175
+
<SideDrawerbuttonText="What on Earth is Hardhat?">
176
+
Since we’re flying to Jupiter, we need safety apparel! And that’s what Hardhat is. It provides a blockchain for us along the way, where we can have lots of ETH in our wallet, and we can waste as much as we want, and get hit on the head with
177
+
asteroids without getting any scars.
178
+
179
+
Hardhat lets us do all the things we did in Remix, but instead of clicking
180
+
‘Deploy’ and ‘Compile’ buttons, or reading our logs from inside the browser
181
+
IDE, we will be writing our commands in the console and debugging our errors
182
+
from a code editor on our ‘local’ computer.
183
+
184
+
Hardhat is simply a set of tools that includes a local mini blockchain that
185
+
can run on your machine.
186
+
</SideDrawer>
187
+
189
188
We choose `Create a Javascript project` and Hardhat will create an example
190
189
project for us. It will give us 3 prompts for options. Choosing the defaults is
- After these selections, you can expect to see some messages regarding vulnerabilities, npm warnings for deprecated files and prompts to audit. No need to worry, this is to be expected in development, and we all got a shock the first time too! However, if you get messages that say 'ERROR', then jump into the forum and ask for guidance.
216
+
- After these selections, you can expect to see some messages regarding vulnerabilities, npm warnings for deprecated files and prompts to audit. No need to worry or take action, this is to be expected in development, and we all got a shock the first time too! However, if you get messages that say 'ERROR', then jump into the forum and ask for guidance.
218
217
219
218
In a Hardhat project, the default folders are:
220
219
@@ -370,8 +369,8 @@ contract ProjectNFT is ERC721 {
370
369
}
371
370
```
372
371
373
-
We made our totalSupply variable private and it will store exactly how many NFTs
374
-
have been minted so far. In the next step we will use this variable to identify
372
+
We made our totalSupply variable private and it will store the exact number of NFTs
373
+
that have been minted. In the next step we will use this variable to identify
- An API Key from an Ethereum RPC Node Provider e.g. [Infura](https://app.infura.io/),
842
+
[Ankr](https://www.ankr.com/rpc/eth/eth_sepolia/), or [Alchemy](https://dashboard.alchemy.com/)
848
843
- A minor change in the Hardhat configuration file
849
844
850
845
First and foremost, **security**. We are exploring new grounds, experimenting,
@@ -866,18 +861,14 @@ To be able to deploy our contract, we are going to use that private key, that's
866
861
we recommend, yet again, to use a separate wallet containing only test tokens for developing.
867
862
868
863
We need to inform Hardhat which node we are using to connect to the
869
-
blockchain/network.
870
-
871
-
Once you have your wallet funded with test ETH, you'll need sign up for one of the
864
+
blockchain network. Once you have your wallet funded with test ETH, you'll need sign up for one of the
872
865
Ethereum RPC Node Providers. Alchemy and Infura are the most used. And Ankr has a 'community endpoint' which doesn't require a dedicated sign up, to list a few options.
873
866
874
-
Once you sign up, you'll be asked to create an App, be sure to select the
875
-
Sepolia network there.
876
-
877
-
When the app is created, you'll see a "View Key" button, or similar. Press it
867
+
After signing up, you'll be asked to create an App. Be sure to select the
868
+
Sepolia network there. When the app is created, you'll see a 'View Key' button, or similar. Press it
878
869
and copy the HTTP link, we'll use it in our next step.
879
870
880
-
Once you have funded your wallet with fake ETH, we can go ahead and change our
871
+
With our wallet funded fake ETH, we can go ahead and change our
881
872
Hardhat configuration file. Go into your project's main directory and open
882
873
`hardhat.config.js`.
883
874
@@ -917,7 +908,7 @@ password (the one you use to open it, NOT your seed phrase). It also shows you a
917
908
notice so you know that you are entering the danger zone. Confirm and you'll be
918
909
able to copy your private key. Paste it in to our `hardhat.config.js`
919
910
920
-
Please, if you are already a developer and you plan to use git to store your
911
+
Please, if you are already a developer and you plan to use Git to store your
921
912
project, don't store your `hardhat.config.js` on it, because you will have your
922
913
private key there.
923
914
@@ -930,11 +921,11 @@ private key there.
930
921
</SideDrawer>
931
922
<br/>
932
923
933
-
Ok. We are ready, let's deploy to the Goerli testnet!
924
+
Ok. We are ready, let's deploy to the Sepolia testnet!
934
925
935
926
Now we need to run our deploy.js script and the deployment is going to cost us
936
-
some eth (test eth, don't worry) from our wallet, since we are storing
937
-
information (i.e. our contract) in the blockchain. We only have to add 2 words
927
+
some ETH - test ETH, don't worry - from our wallet, since we are storing
928
+
information, i.e. our contract on the blockchain. We only have to add 2 words
938
929
to the command to let Hardhat know we are doing the real thing now. Remember
939
930
our deploy script will create our contract AND mint one NFT. If you only want to
940
931
deploy, delete all the lines we added to test the minting.
@@ -952,29 +943,29 @@ This is the output i got in my console:
952
943
Remember we are deploying to the actual blockchain, a testnet, but a blockchain
953
944
nonetheless.
954
945
955
-
Now that we have run the deploy script, delete the private key and the RPC API
956
-
key from `hardhat.config.js` to minimize the handling of the wallet. In the next
946
+
Now that we have run the deploy script, **delete the private key and the RPC API
947
+
key from `hardhat.config.js`** to minimize the handling of the wallet. In the next
957
948
project we will learn about tools to collaborate and store your projects online.
958
949
959
950
So now we can go and explore the chain to find your contract (and mine too!).
960
-
Just go to [Goerli Etherscan](https://goerli.etherscan.io/) (or
951
+
Just go to [Sepolia Etherscan](https://sepolia.etherscan.io/) (or
961
952
[Opensea](https://testnets.opensea.io/)) and search for the address of our
962
953
deployed contract.
963
954
964
-
You can view my links as an example on [Etherscan](https://goerli.etherscan.io/address/0x166A82F7cD8F7BA9D8C10b2cc792C1A20084564d)
955
+
You can view my links as an example on [Sepolia Etherscan](https://sepolia.etherscan.io/address/0xc2c2Ae7Ba222384352ED022D8D1b53Ee7edc52AB)
965
956
and [Opensea](https://testnets.opensea.io/collection/d-d-academy)
966
957
967
958

968
959
969
960
Wow, you have created your own NFT collection from scratch. What a superstar! You have learned tonnes of new concepts and code - that is really impressive! And now you're almost ready to test yourself a little bit more.
970
961
971
-
But first, we want you to go and 'touch some grass'. So why don't you scroll to the top and set the pomodoro timer, and when you come back after your well earned rest, take the quiz. Breathe and enjoy.
962
+
But first, we want you to breathe and enjoy. So go and 'touch some grass', and when you come back after your well earned rest, take the quiz. <br/>
972
963
973
964
<br/>
974
965
<Quizquiz="lesson-2-quiz" />
975
966
<br/>
976
967
977
-
Congratulations on your results. You're now a supreme open-sourcerer! See you in the next lesson, where you will be adding to your knowledge of creating ERC721s, by creating *tiered NFTs*. See you there....
968
+
Congratulations on your results. You're now a supreme open-sourcerer! In the next lesson*tiered NFTs*, you will be building on top of what you did here, adding more functionality to your contracts and to your knowledge of creating ERC721s. After that we'll be doing some automated testing, and to wrap up, we'll be connecting everything up to a front end, so a user can easily interact with your creations. Lots of fun in the pipeline! See you in the next one and in our community [developerdao.peeranha.io](https://developerdao.peeranha.io)!
0 commit comments