Verifying Your Polygon or Ethereum Contract: A Detailed Walkthrough

Published on
May 25, 2022
Written by
Carlos Gordillo
Read time
10 min
Category
Resources

How to verify your contract created with Ambition.so on Polygon or Ethereum

Ambition.so has a very easy way to create NFTs contracts in both Ethereum and Polygon, and keeping those smart contracts is important for several reasons. For instance, if you want to perform read and write actions directly from Polygonscan or Etherscan, it’s possible thanks to a contract verification.

For the sake of this post, we will be using Ethereum on the Rinkeby test network to verify my contract, but this is also applicable to Ethereum main net and both Polygonscan on the main and test networks for Polygon ERC-721 Smart Contracts verification.

1. Grabbing your contract address from Ambition.so

Once you deploy your contract on the blockchain directly from Ambition.so, you will get your contract address, that is this alphanumeric string, starting with a 0x… mine starts with a 0x3c0 and ends with f972.

The address highlighted in blue is my smart contract address. Find yours in your Ambition.so contract page after deploying to the blockchain.

2. Finding your contract on Polygon or Ethereum transaction scanners

Once you got your contract address, go to the transaction scanner of your desired network (where you deployed your contract):

For Polygon main network use https://polygonscan.com/, for Mumbai Polygon test network use https://mumbai.polygonscan.com/. In the case of Ethereum, go to https://etherscan.io/ for the main network and https://rinkeby.etherscan.io/ for the Ethereum Rinkeby test net. This last one is the one we'll be using here.

Once in the scanner, use the big search bar to put your contract address and click the button. This will search for the unique contract address and direct you to your contact page.

Paste your contract address in the search bar and hit the enter key or click the purple button.

Here you will find all the information about your contract, all the related transactions, who and when deployed it, and the section that is important to us for the purpose of this tutorial: the contract verification tab.

This is the main page of the contract. It has all the information regarding your contract, as the contract creator.

Also, you can easily identify if your contract is already verified or not. The verification symbol is the green checkmark next to the “contract” tab.

The green checkmark ✅ says that your contract is already verified.

3. Getting the code to verify (ABI)

The verification of a contract is a process that demonstrates to the blockchain or the network that you have the code of a deployed contract. The purpose of that is basically to demonstrate that you are the owner of the contract and allow you to make write and read transactions directly in your contract.

ABI stands for Application Binary Interface, but in general terms, it is a JSON formatted code that contains details and instructions for the deployed contract.

As your contract is deployed through Ambition.so, you will need access to the code that actually deployed your contract. In the case of Ambition.so, they give you the option of verifying the contract using the ABI code, which is a code that will allow the blockchain to “re-compile” the contract and compare it with the deployed one. If it is the same contract, then, you demonstrated you are the owner.

4. Understanding your ABI file

A JSON file is not hard to understand. It’s structure is easy to read by both humans and machines. The ABI File provided by Ambition.so is a JSON File, well structured, and where I got all the information I needed to verify my contract in the blockchain.

As there is a lot of data in the ABI file, I came yo https://jsonpathfinder.com to find the correct paths and specific information I needed. So I opened my ABI file in a text editor, I copied all the content and then I pasted it into https://jsonpathfinder.com tool.

In the left pane, you can see the ABI source code, without modifications. In the right pane, you can see a more readable form of the same content. As you can see, both red squares show the same data.

From the right pane results you will need the information about the compiled contract. This will be mainly in the metadata key-value pair. Take note of the following values so you can use them when verifying your smart contract on the blockchain:

a. Compiler version: highlighted in blue on my example, it shows the version of the compiler used. Will be proceeded by the “version” attribute.

b. Compiler language: almost all the blockchain contracts deployed in Ethereum are written in Solidity. This is also highlighted in blue on my example.

c. License: multiple licenses can be used on the solidity compilers and codes. In this case, there aren’t licenses used, so we will use the No License option in a further step.

d. Source code: this is a tricky part, as we have been talking about the ABI for a while. Select the whole section that follows the deployedSourceMap, that’s a big section with names and codes. This is the source parameter within the ABI and will be used to verify your contract.

Select and copy the code within the source piece.

Select the source code and copy it.

5. Verifying your contract

The first step to verifying your contract is to click the contract tab next to the transactions tab. Then go to the Verify and Publish link where we would start our process.

Click the Verify and Publish link to start the process

5.1 Fill the basic details of your contract

On the Verify & Publish Contract Source Code page, you need to fill the basic details of your contract, that you can pull from the ABI file shared by Ambition.so team. To get the required data follow the step 4.

For matter of simplicity, I’ll be showing you the details for my ABI file, as those are the standards used by Ambition.so folks at the moment of writing this tutorial.

The Compiler Type is Solidity in a Single File. This means that the contract is compiled in Solidity language, and all the information is within one single file.

The Compiler version is v0.8.4 as we saw on the ABI understanding.

No license was used, so we can select the No license option.

This is all the information we gathered on the previous steps.

Click continue, and then you will get to another page where is the moment to use the code from the ABI (step 4.d). Paste the code within the highlighted field, and then click Verify and Publish at the end of the page.

Paste the source code from your contract within the solidity source code field.
Click Verify and Publish to complete the process.

Once the scanner finish to do their things, you will get a message about the verification of your contract.

CONGRATULATIONS! You have verified your contract in the blockchain.

If everything go well, you have already verified your contract on the blockchain!

ambition's no-code tools

Launching an NFT collection can be smooth and easy. Try out our no-code products today.
We have the right tools and plans you need.

Subscribe to our newsletter

Thanks for joining our newsletter
Oops! Something went wrong while submitting the form.