3

This is really annoying I have tried putting in the ABI. Keep getting a constructor error. I have tried many combinations, nothing seems to work.

Following is the source code I deployed to Testnet 0x34a03193f88ceb2b3ac3ea32b47f7d25544d5f5e:

pragma solidity 0.4.8;
contract mortal {
    /* Define variable owner of the type address*/
    address owner;

    /* this function is executed at initialization and sets the owner of the contract */
    function mortal() { owner = msg.sender; }

    /* Function to recover the funds on the contract */
    function kill() { if (msg.sender == owner) selfdestruct(owner); }
}

contract greeter is mortal {
    /* define variable greeting of the type string */
    string greeting;

    /* this runs when the contract is executed */
    function greeter(string _greeting) public {
        greeting = _greeting;
    }

    /* main function */
    function greet() constant returns (string) {
        return greeting;
    }
}
BokkyPooBah
  • 40,274
  • 14
  • 123
  • 193
GK1
  • 129
  • 2
  • 10
  • Please provide more info, eg, contract address, source code, txid, compiler version, deployment environment. – BokkyPooBah Feb 10 '17 at 07:53
  • greeter at 0x34a03193f88ceb2b3ac3ea32b47f7d25544d5f5e (blockchain), Solidity version: 0.4.8+commit.60cc1668.Emscripten.clang, Transaction 0x75bd6721cedfd574ccda2f2d5c5e741900213fc2233f77dff7118ca0eba1b521, not sure deployment environment how would i check that, I am using solidity browser with meta mask to deploy, Gist: https://gist.github.com/anonymous/638969e3ceff12fabc7e7604970cbdad – GK1 Feb 10 '17 at 21:03
  • This question should be reopened as there is a problem with verifying source code for Solidity versions after 0.4.6 on Etherscan. – BokkyPooBah Feb 10 '17 at 23:19
  • I voted to re-open given the source code is there now and BokkyPooBah is hinting at an answer. – Rob Hitchens Feb 11 '17 at 00:43
  • Can you verify source code that is under 0.4.6? – GK1 Feb 11 '17 at 01:44
  • Ok so got it to work. Here is what you have to do, take the input code given from etherscan past it into just a text document, than copy the bytecode given from solidity browser, do control find to search for what part of the input code is the actual bytecode. There will be a small amount at the end that is not found, that code is what you need to input into the ABI field on etherscan. Not what you would think, but it works. – GK1 Feb 11 '17 at 02:12
  • What version did you get it working with? I could only get it working with 0.4.6 and below a few days ago. You may want to self-answer your question to document how you got it working, with screenshots, and taking the last part of the deployment code. I also had to use Browser Solidity instead of Ethereum Wallet as you can control the compiler version in Browser Solidity. – BokkyPooBah Feb 11 '17 at 20:23
  • I am only using 0.4.6. Have not tested others. Yes I had to use the browser too. – GK1 Feb 16 '17 at 03:28

1 Answers1

1

Tx 0x75bd... created the contract at that you could not get verified as stated in your question above. This was deployed with the source code in your question at compiler version 0.4.8.

Following is your transaction input data:

0x6060604052346100005760405161037c38038061037c833981016040528080518201919050505b5b33600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b8060019080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100b557805160ff19168380011785556100e3565b828001600101855582156100e3579182015b828111156100e25782518255916020019190600101906100c7565b5b50905061010891905b808211156101045760008160009055506001016100ec565b5090565b50505b505b6102608061011c6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806341c0e1b514610049578063cfae321714610058575b610000565b34610000576100566100ee565b005b3461000057610065610182565b60405180806020018281038252838181518152602001915080519060200190808383600083146100b4575b8051825260208311156100b457602082019150602081019050602083039250610090565b505050905090810190601f1680156100e05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561017f57600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b5b565b602060405190810160405280600081525060018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102295780601f106101fe57610100808354040283529160200191610229565b820191906000526020600020905b81548152906001019060200180831161020c57829003601f168201915b505050505090505b905600a165627a7a72305820d47556e11c69fb0ceea694505049f1706cf290268907e3bf9300ca621190a0f100290000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000a68656c6c6f776f726c6400000000000000000000000000000000000000000000

And following is your contract bytecode:

0x60606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806341c0e1b514610049578063cfae321714610058575b610000565b34610000576100566100ee565b005b3461000057610065610182565b60405180806020018281038252838181518152602001915080519060200190808383600083146100b4575b8051825260208311156100b457602082019150602081019050602083039250610090565b505050905090810190601f1680156100e05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561017f57600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b5b565b602060405190810160405280600081525060018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102295780601f106101fe57610100808354040283529160200191610229565b820191906000526020600020905b81548152906001019060200180831161020c57829003601f168201915b505050505090505b905600a165627a7a72305820d47556e11c69fb0ceea694505049f1706cf290268907e3bf9300ca621190a0f10029

As you stated in your comment, the constructor argument in the source code verificatio screen is the difference between the two bytecodes that is bolded in the first lot of bytecode:

0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000a68656c6c6f776f726c6400000000000000000000000000000000000000000000

I tried to add the verified source code as shown in the following screens:

enter image description here

with a continuation of the same screen:

enter image description here

but it was unsuccessful. Note that optimisation was Enabled in the screen above.

I tried verifying the same code, but this time with optimisation Disabled and got a successful result:

enter image description here

So in your case, the problem was cause by deploying code with optimisation Disabled.

(I have been having trouble over the last week getting the source code verified and I could only get my source code verified by downgrading to 0.4.6, buy your issue seems to only be the optimisation switch.)

BokkyPooBah
  • 40,274
  • 14
  • 123
  • 193