Using Remix
Overview
This tutorial will show you how to compile and deploy an existing smart contract using Remix.
Remix IDE is a no-setup smart contract development tool with a GUI. Beginners and experts alike will benefit from Remix. Remix plays well with other tools, and allows for a simple deployment process to the chain of your choice. The Remix Project also can serve as a learning lab for teaching and experimenting with EVM-compatible chains.
Pre-requisites
Install Metamask
Configure DoCoin Community Chain Testnet on Metamask
Get Testnet token
What you will do
Create a file on Remix
Upload or code the smart contract to the IDE
Compile the smart contract
Connect the application to DCC Testnet via Metamask
Deploy the smart contract
Verify the smart contract
Getting started with Remix IDE
To start building a smart contract, click on New File and name it as HelloWorld.sol
.
Writing smart contract
Copy the code given below to HelloWorld.sol
file
The first line, pragma solidity ^0.8.15
specifies that the source code is for a Solidity version greater than 0.8.15. Pragmas are common instructions for compilers about how to treat the source code (e.g., pragma once).
Compile smart contract
Switch to the Compiler tab
Select compiler version 0.8.15
Now, compile
helloWorld.sol
After successful compilation, it will show a green tick mark on the Compiler tab button
Configure DCC Testnet on Metamask
引用其它部分的文档即可(pending)
Deploy Smart Contract to DCC Testnet
In both Testnet and Mainnet, you do the below to deploy your smart contract using Remix.
Navigate to the Deployment tab
Select Injected Provider Metamask in the Environment dropdown, and your contract
Accept the Connect request received in MetaMask. You can also manually launch MetaMask if the popup doesn't open by default
In MetaMask, once a transaction is deployed, you will receive another MetaMask pop-up that requires you to confirm the transaction. You just need to confirm the transaction
Congratulations! You have successfully deployed the HelloWorld
Smart Contract to the DoCoin Community Chain Testnet. You can start interacting with your Smart Contract. Check the deployment status at https://explorer.docoin.shop/
Verify smart contract
Our deployed
HelloWorld
contract address is0x29786e249C5471ecD53FC02794F894E9a6c70A58
Navigate to the HelloWorld smart contract address in the DCC Testnet explorer
Find the Code sub-tab and click on Verify & Publish
Choose the
via flattened source code
and continue to the Next
Naming the smart contract
Select the appropriate compiler version
Copy and paste the flattened source code
Click Verify & Publish.
DCC Testnet will take a few seconds to compile your contract, verify, and publish it.
Last updated