"NFT Blockchain Advanced Guide II" Etherscan Verification Solidity Smart Contract (Remix Plugin Verification)

Pre-reference document: https://blog.csdn.net/sinat_34104446/article/details/130557703

1. Verification instructions

  1. Contract verification is the process of uploading contract source code to etherscan. In smart contract projects, source code verification is usually provided to increase project trust
  2. After verifying the contract, you can directly execute the acquisition and setting methods on etherscan, which is convenient for daily administrator maintenance
  3. The following uses remix for verification and uses more picture examples for illustration
  4. Each deployment has a corresponding contract, click the contract address to view the code example

Reminder: Etherscan needs a ladder

Two, Etherscan Key

  1. To verify the contract, you need to use the api key of etherscan
  2. After entering the etherscan login account, enter the personal center

image.png

  1. Keep personal api well to prevent leakage

3. Verify the plug-in

  1. Verification of the source code requires the support of the remix plug-in ETHERSCAN - CONTRACT VERIFICATION
  2. Add ETHERSCAN - CONTRACT VERIFICATION plug-in, the deployment environment needs to switch to the corresponding deployment wallet when verifying

image.png
image.png

  1. After completing the filling, click Save API key, then click the little house icon in the upper right corner of the filled api key to return to the plug-in home page

image.png

4. Source code certification

The verification of the source code must be consistent with the original deployment code, otherwise the verification will fail

4.1 Remix verification (recommended)

4.1.1 Contract verification without construction parameters

  1. No parameter construction only needs to be directly verified by the contract verification plug-in on Remix

image.png

  1. Select Verify Contract and wait for the verification to succeed

image.png

  1. For verification results, refer to Section 5, Verification Results

4.1.2 Contract verification with construction parameters

remix can verify single file and multiple files

  1. Click Verify and Publish in the contract information. The purpose of the operation here is to obtain the construction parameter information required by the remix verification plug-in

image.png

  1. Fill in the information as shown, then continue

image.png

  1. copy constructor parameters

image.png

  1. remix for contract verification, fill in the following parameters

image.png

  1. View contract verification results refer to Section 5

4.2 Single file verification (not recommended)

If there are multiple files, such as import, you need to use a plug-in to merge multiple files into a single file.
If you don’t use a plug-in, you can only manually merge the source codes of multiple files into one, and you need to redeploy the contract

  1. If there is no import in the ordinary contract, it can be manually verified after the contract deployment is completed.
  2. The etherscan deployment of single-file verification and remix verification is exactly the same, you only need to fill in the source code at the source code and verify it

image.png

  1. After filling in, click Verify and Publish

4.3 Hardhat deployment (as required)

Hardhat deployment requires network-friendly software and requires global configuration, so it is recommended to use Remix verification

5. Verification results

Contract without parameters: 0x9a9560272b12cd56b11f547c2f7092c274a9ff52

  1. After Remix verification, go to the contract menu of Etherscan to refresh the page

image.png

  1. View the read method provided by the contract

image.png

  1. View the setting method provided by the contract

image.png

Contract with parameters: 0xae8ee7b8355190b47665511e15824eed2b55b1d5

image.png

6. Article preview

  1. The above are ordinary smart contract deployments, and the proxy contract deployment and proxy contract verification will be held in the follow-up meeting
  2. The deployment and verification of the proxy contract is more complicated, and more diagrams will be used for demonstration

Guess you like

Origin blog.csdn.net/sinat_34104446/article/details/130575472