当前位置:网站首页>2. Create your own NFT collections and publish a Web3 application to show them start and run your local environment
2. Create your own NFT collections and publish a Web3 application to show them start and run your local environment
2022-07-01 18:47:00 【Han Ru_】
A little introduction to blockchain
First , We need to make the local Ethereum network work properly . That is how we compile and test our smart contract code ! Do you know how you need to start a local environment to work ? Same thing here !
Now? , You just need to know , A smart contract is a piece of code that exists on the blockchain . Blockchain is a public place , Blockchain is a public place , Anyone can read and write data safely for free . Think about it a bit like AWS or Heroku, Except that no one really owns it ! It is called by thousands “ The miners ” Random person management .
The general idea here is :
1 – We need to write a smart contract . The contract includes us NFT All the logic of .
2 – Our smart contract should be deployed on the blockchain . such , Anyone in the world can view and call our smart contract , This contract is that we will allow them to cast NFT The contract of !
3 – We will set up a customer website , So that people can easily cast from our collection NFT.
I suggest you also read these file . in my opinion , These are the best guides on the Internet to understand how Ethereum works !
️ Set up local tools
We will use the name Hardhat Tools for , It enables us to quickly compile smart contracts , And test locally . First , You need to get node/npm. If you don't have it , succeed in inviting sb. here .
Be careful : I am here node 16 On . I know that some people encounter on the old version of the node “ Out of memory error ”, So if this happens , Please get node 16!
Next , Let's go terminal . Here, first create a folder locally :epic-nfts, Go ahead and cd
Go to the working directory .
The terminal runs these commands :
mkdir epic-nfts
cd epic-nfts
npm init -y
npm install --save-dev hardhat
Run the last command and install Hardhat after , You may see messages about vulnerabilities . Each time from NPM When installing a software , Will carry out safety inspection , To see if there are any reported vulnerabilities in any software packages in the library you are installing . This is more like a warning to you ! If you want to learn more , Please be there. Google Search for these vulnerabilities on !
Then the local directory structure :
Run the sample project
cool , Now we have hardhat 了 . Let's start a sample project .
npx hardhat
Pictured :
Be careful : If you are in Windows Upper use Git Bash install hardhat, You may find yourself in this step (HH1) Encounters an error . If there is a problem , You can try Windows CMD perform HardHat install . Can be in here Find other information .
Choose the option to create a basic sample project . All choose yes , That is input y.
The sample project will require you to install hardhat-waffle
and hardhat-ethers
. These are what we will use later .
Continue installing additional dependencies , In case it doesn't install automatically .
npm install --save-dev @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers
You also need to install one called OpenZeppelin The library of , This is another library for developing secure smart contracts . Later we will learn more about it in detail . Now? , Just install it .
npm install @openzeppelin/contracts
And then run sample-script.js:
Execute at the terminal :
npx hardhat run scripts/sample-script.js
You should see the following :
If you also display this message , It means that your local environment has been set , And you also run on the local blockchain / Deployed smart contracts .
Next, let's discuss it in detail , What just happened step by step is :
- Hardhat Change your smart contract from solidity Compile as bytecode .
- Hardhat Will start on your computer “ Local blockchain ”. It's like a mini beta of Ethereum running on your computer , It can help you test things quickly !
- then ,Hardhat Will compile your contract “ Deploy ” To your local blockchain . That's the address you saw last . This is our contract deployed on the mini Ethereum .
If you are interested , You can check the code in the project at will , See how it works . say concretely , Check the smart contract file Greeter.sol
And the actual contract documents sample-script.js
.
After exploring , Let's move on to the next part and start our own NFT contract .
边栏推荐
- The 13th simulation problem of the single chip microcomputer provincial competition of the Blue Bridge Cup
- Solution: you can ping others, but others can't ping me
- Unity learning fourth week
- [noip2015] jumping stone
- 力扣每日一题-第32天-1232. 缀点成线
- After studying 11 kinds of real-time chat software, I found that they all have these functions
- What if the reliability coefficient is low? How to calculate the reliability coefficient?
- 磁盘的基本知识和基本命令
- Memo - about C # generating barcode for goods
- 主成分计算权重
猜你喜欢
Mysql database of easyclick
docker 部署mysql8.0
NSI packaging script add file details
Lumiprobe lumizol RNA extraction reagent solution
12种数据量纲化处理方式
创建您自己的NFT集合并发布一个Web3应用程序来展示它们(介绍)
3、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》在本地铸造 NFT
如何在自有APP内实现小程序实现连麦直播
为什么独立站卖家都开始做社交媒体营销?原来客户转化率能提高这么多!
Leetcode203 remove linked list elements
随机推荐
R language uses the transmute function of dplyr package to calculate the moving window mean value of the specified data column in dataframe data, and uses ggplot2 package to visualize the line graph b
实现一个Prometheus exporter
Search 2D matrix 2
11、用户、组和权限(1)
Regular expression
Reading notes series "modern methods of C language programming" -- Chapter 2
Leetcode-141环形链表
Lumiprobe lumizol RNA extraction reagent solution
Lumiprobe Lumizol RNA 提取试剂解决方案
How to manage 1000 anchors by one person?
搭建一個通用監控告警平臺,架構上需要有哪些設計
12. Design of power divider for ads usage record
R语言ggplot2可视化:gganimate创建动态柱状图动画(gif)、在动画中沿给定维度逐步显示柱状图、enter_grow函数和enter_fade函数控制运动内插退出(渐变tweening)
Mise en place d'une plate - forme générale de surveillance et d'alarme, quelles sont les conceptions nécessaires dans l'architecture?
How to find the optimal learning rate
Calculation of intersection of two line segments
Leetcode-160 intersecting linked list
Lumiprobe non fluorescent alkyne EU (5-ethynyluridine)
R语言epiDisplay包ordinal.or.display函数获取有序logistic回归模型的汇总统计信息(变量对应的优势比及其置信区间、以及假设检验的p值)、write.csv函数保存csv
R language uses the aggregate function of epidisplay package to divide numerical variables into different subsets based on factor variables, and calculate the summary statistics of each subset