当前位置:网站首页>Under the pressure of technology, you can quickly get started with eth smart contract development, which will take you into the ETH world
Under the pressure of technology, you can quickly get started with eth smart contract development, which will take you into the ETH world
2022-06-30 16:01:00 【Windy Walker】

Install wallet
install Metamask、 And create a good account
Metamask It is an Ethereum wallet in the virtual world , Also because of its LOGO It's a cute little fox , It's also known as “ Fox wallet ”.
MetaMask Many clients , Including the mobile terminal : The android mobile phone MetaMask The client is based on Google store , Domestic Android phones do not support , This one may be a little more troublesome , How to install , You can search for . The same goes for Apple phones , There seems to be no android in Apple stores in China , You need to register a U.S. account to download .
Then the most commonly used one is PC End , In fact, this is also the simplest , And now the mainstream Google Chrome,Microsoft Edge And other browsers can support installation , So let's start with Google Chrome Take as an example MetaMask( Fox wallet ) How to install and register .
First of all, our network is the scientific network , If you don't understand , You can search and solve by yourself .
And then we use Google Chrome open MetaMask,https://metamask.io/, We can see MetaMask Home page for client downloads , Because there is no Chinese , We can solve this problem through translation software .
But with chrome When it's opened ,Download The plug-in of the corresponding browser version will be automatically selected , Click download . Click to jump to chrome The store , Click Add to chrome
After installation , Will jump to MetaMask The welcome screen , In the middle is a little fox that will follow your mouse , Isn't it interesting .
Click to start using , Will let you choose whether to use it for the first time MetaMask, The first time you use it, you will create a new wallet account and account mnemonic , If it already exists , Use the account mnemonic to import the existing wallet .
Here we choose to use for the first time .
Here you can choose whether to give MetaMask Provide usage data , There are similar regulations in modern software , You can choose as you like , So here I'm going to choose “ No , thank you ”.
next step , Will let you create a password , Password at least 8 Characters , For the safety of the wallet , Make it as complicated as possible . 
After creation , Jump to a tutorial interface , Tell you what account mnemonics are , And his role . about MetaMask, You should keep your mnemonics well , And avoid using mnemonic words in clear text , Avoid leakage , The wallet was stolen and empty .

After reading the tutorial , Click next , Will let you manually turn on display mnemonics , And remind you again of the importance of mnemonics . Write down and keep your mnemonic words
next step , Will let you enter mnemonic words manually , To see if it's right .
Click ok ,MetaMask Your account registration is complete ,MetaMask Will remind you again of the importance of mnemonics . Write down and keep your mnemonic words
Here are your MetaMask Wallet page , In the middle is what's left in everyone's wallet ETH balance ,
Then we can choose some intermediate platforms to buy ETH, And then everybody goes through MetaMask Go to Opensea To buy NFT There are other blockchain things to do , Next, we will perform a transfer .
in addition :MetaMask After the installation , It can be opened through the little fox icon in the upper right corner of the browser MetaMask wallet , Small and mini .
Perform the first transfer
This time I will use the test currency to perform a transfer , Due to the present ETH The faucet is running dry , It is already very difficult to get ETH Your test coin , But there are many compatibility options ETH To test the transfer , Here I use OKTest( Orco test network ).
Test currency acquisition
Open orco test network address https://www.oklink.com/zh-cn/okc-test, take OK Test network added to MetaMask.
After clicking , The little fox will jump out of the connection prompt window , Follow the prompts step by step .
After adding the test network , There is still no test coin , Now it is difficult to get a test coin . Open the address :https://discord.com/invite/B5nMs6qK5F, Another series of verification succeeded , Finally, I can get the test money . In the chat window , Send your wallet address , The robot will be you 10OKT 
First transfer
Now you can transfer money , Click Send , Enter the wallet address of the other party , Enter the transfer currency , If the fuel price is high , It can make the transfer faster and the transaction successful , Faster generation of blocks .
You can see the transfer status here
Wait for a while , Transfer succeeded , You can see the transfer details on the blockchain browser .
I'll introduce you to , Introduction to smart contract development .
First smart contract
Use Remix Create the first contract
Remix https://remix.ethereum.org/ Is an Ethereum smart contract language Solidity The browser version of IDE, A great development tool for beginners , And there are many official documents , Because abroad , It will be slow to open for the first time .
Here is a simple smart contract for storing input values ,store Receive a number and save ,retrieve Returns the saved number .
contract Storage {
uint256 number;
/**
* @dev Store value in variable
* @param num value to store
*/
function store(uint256 num) public {
number = num;
}
/**
* @dev Return value
* @return value of 'number'
*/
function retrieve() public view returns (uint256){
return number;
}
}
Use Remix Test the first contract
First, let's compile , Click the toolbar button on the left , Make sure that the compilation passes
Click on Deploy Button , Deploy smart contracts , Here we choose JavaScript VM Environmental Science , Develop and test in the local virtual machine environment , If deployed on the network , Every transaction costs gas Of .
After successful deployment , At the bottom Deployed Contracts If the smart contract has been deployed, the smart contract with successful deployment will appear , So let's test that out .
Test input 1 After storage , Get 1, Input 2 After storage , Get 2, The smart contract local development test was successful , Then it can be deployed to the test network . 
Use Remix Deploy the first contract
The same is Remix, Select... From the virtual machine environment drop-down box Injected Web3, At this time, the installation will pop up MetaMask wallet , link Remix And wallets , Follow the steps .
We deploy the smart contract to OKTEST The Internet , Click on Deploy, The transaction confirmation window pops up , There will be an estimated fuel cost , You can choose to edit or default , Confirm the deal .
Again , After successful deployment , Little fox will pop up a reminder ,Remix Of Deployed Contracts There will also be deployed smart contracts , Let's test it .
so , Every time a stored value is written , Will generate a transaction , But no transaction is generated when reading the value of .
Here we go hand in hand ETH The smart contract tutorial is over , about Remix Some simple and not very complex smart contract development is enough , The latter is what you need to learn Solidity Language , And continuously skillfully use tools and languages in the process of learning and development , So we can deal with some real projects .
If there's a chance later , We will introduce the development and testing of complex smart contracts , I'll see you again .PM:2022 year 6 month 30 Japan 03:15:52
边栏推荐
- Flask-SQLAlchemy----sqlalchemy. exc.InvalidRequestError: SQL expression, column, or mapped e---ORM(9)
- Container common commands
- Policy Center > Deceptive Behavior
- With as subquery in Oracle
- 《网络是怎么样连接的》读书笔记 - 汇总篇
- Oracle 导出视图的创建语句
- Policy Center-User Data
- ASP. Net core Middleware
- 边缘计算平台如何助力物联网发展
- ASP. Send information in sinalr controller of net core
猜你喜欢

Data governance Market: Yixin Huachen faces left, Huaao data faces right

iMeta | 叶茂/时玉等综述环境微生物组中胞内与胞外基因的动态穿梭与生态功能...

智慧风电:数字孪生 3D 风机智能设备运维

【算法篇】四种链表总结完毕,顺手刷了两道面试题

ASP. Net core signalr series hub tutorial

ASP. Send information in sinalr controller of net core

Swagger's asp Net core web API help page

Message queue ten questions

Finally understand science! 200 pictures to appreciate the peak of human wisdom

互联网研发效能之去哪儿网(Qunar)核心领域DevOps落地实践
随机推荐
Pointer understanding
360数科、蚂蚁集团等入选中国信通院“业务安全推进计划”成员单位
如何得到股票开户的优惠活动?在线开户安全么?
Parameter optimization - bias and variance
LeCun指明下一代AI方向:自主机器智能
消息队列十连问
容器常用命令
Message queue ten questions
IIS无法加载字体文件(*.woff,*.svg)的解决办法
Swagger's asp Net core web API help page
[附下载]渗透测试神器Nessus安装及使用
iMeta | 叶茂/时玉等综述环境微生物组中胞内与胞外基因的动态穿梭与生态功能...
BYD is more and more like Huawei?
实时渲染和预渲染有什么区别
String common API
交调与互调的区别
Policy Center > Google Play‘s Target API Level Policy
Mysql事务/锁/日志总结
String connector
About pickle module - 6 points that beginners must know