22

Im trying to verify an ETH contract, but I complete the etherscan form to and i receive this message:

"Error! Unable to verify source code Missing Constructor Arguments for function JL(uint256 initialSupply, string tokenName, string tokenSymbol)"

My contract was created using https://remix.ethereum.org/ On this link are my smart contract code - JLC.json - JLC.sol https://gist.github.com/5067bbba4b0640e5679d85f8625c198e

Im new on this and im just testing how smart contracts work.

I hope your support guys.

Thanks.

PoetaKarate
  • 221
  • 1
  • 2
  • 3

4 Answers4

18

You can use simple online tool to get abi-encoded constructor parameters https://abi.hashex.org. Just paste in abi and enter parameter values. Abi-encoded parameters would be automatically calculated.

Then just copy and paste result into etherscan.io constructor parameters input.

Here is an example of using this tool enter image description here

Gleb Zykov
  • 639
  • 5
  • 10
  • 1
    do you an idea how that can be done programmatically using web3 ? – abed Dec 07 '18 at 11:08
  • 1
    It could be done programmatically with this library: https://github.com/ethereumjs/ethereumjs-abi. Or you can take a look at this method: https://web3js.readthedocs.io/en/1.0/web3-utils.html#soliditysha3 – Gleb Zykov Dec 11 '18 at 16:03
2

If your contract was created by another contract, the transaction detail may not have an easy way to get the constructor arguments in ABI-encoded form. In this case I recommend using the web3 abi functions for this purpose like web3.eth.abi.encodeParameters.

Mister_Tom
  • 121
  • 2
0

to verify your contract you just need the JLC.sol exactly the same when was deployed. by the way, you can see your ABI code in the remix click in on compile > details button

Vultur
  • 84
  • 6
  • 2
    I try. But i cannt identify the constructor arguments on ABI code. I have understood that constructor arguments should be something like this: 00000000000000000000000000000000000000000000000000000002540be400000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000044e4154410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044e41544100000000000000000000000000000000000000000000000000000000 – PoetaKarate Mar 01 '18 at 02:40
0

You can get the constructor arguments from the deployment transaction. For example, I deployed my contract at https://ropsten.etherscan.io/tx/0x3b0110386e5409a81548beed2020ab3d12f221357905802a2eaf5f7a9d594e52 and last 64 chars of Input Data have the right Constructor Arguments (ABI-encoded).

This rule is valid in my contract because constructor requires just 1 parameter: an address => function Asset(address _SCIssuers) => https://ropsten.etherscan.io/address/0xefb27d9eaa381e958319052dd274c9866f5abc8c#code