3

Having issues verifying my token contract on etherscan.io.

Receiving the following errors: Note: Contract was created during Txn# Result: Does not match the input creation bytecode found at this address

Error! Unable to generate Contract ByteCode and ABI

For some reason, the end of my Input Data does not give me a working Bytecode to use where others do. Here's the transaction which made the contract: 0x776159bbc0f6e624e92a812ee98c1674e67a2ea3

Compiler Warning(s):

myc:1:1: ParserError: Expected pragma, import directive or contract/interface/library definition. [ ^ Any help is appreciated, I've been stuck at this point for some days, and completely clueless.

Cheers!

pragma solidity ^0.4.0;
contract Ballot {

    struct Voter {
        uint weight;
        bool voted;
        uint8 vote;
        address delegate;
    }
    struct Proposal {
        uint voteCount;
    }

    address chairperson;
    mapping(address => Voter) voters;
    Proposal[] proposals;

    /// Create a new ballot with $(_numProposals) different proposals.
    function Ballot(uint8 _numProposals) public {
        chairperson = msg.sender;
        voters[chairperson].weight = 1;
        proposals.length = _numProposals;
    }

    /// Give $(toVoter) the right to vote on this ballot.
    /// May only be called by $(chairperson).
    function giveRightToVote(address toVoter) public {
        if (msg.sender != chairperson || voters[toVoter].voted) return;
        voters[toVoter].weight = 1;
    }

    /// Delegate your vote to the voter $(to).
    function delegate(address to) public {
        Voter storage sender = voters[msg.sender]; // assigns reference
        if (sender.voted) return;
        while (voters[to].delegate != address(0) && voters[to].delegate != msg.sender)
            to = voters[to].delegate;
        if (to == msg.sender) return;
        sender.voted = true;
        sender.delegate = to;
        Voter storage delegateTo = voters[to];
        if (delegateTo.voted)
            proposals[delegateTo.vote].voteCount += sender.weight;
        else
            delegateTo.weight += sender.weight;
    }

    /// Give a single vote to proposal $(toProposal).
    function vote(uint8 toProposal) public {
        Voter storage sender = voters[msg.sender];
        if (sender.voted || toProposal >= proposals.length) return;
        sender.voted = true;
        sender.vote = toProposal;
        proposals[toProposal].voteCount += sender.weight;
    }

    function winningProposal() public constant returns (uint8 _winningProposal) {
        uint256 winningVoteCount = 0;
        for (uint8 prop = 0; prop < proposals.length; prop++)
            if (proposals[prop].voteCount > winningVoteCount) {
                winningVoteCount = proposals[prop].voteCount;
                _winningProposal = prop;
            }
    }
}
0

Try this.

Check your compiler version at "verify and publish" step, if it is the correct compiler version.

You can check it by running :

truffle version

Source

In my case the output [version] was :

Truffle v4.1.8 (core: 4.1.8)

Solidity v0.4.23 (solc-js)

So the compiler version I selected from the list was :

v0.4.23+commit.124ca40d

If you don't have truffle or unaware of it, you can refer this link.

Hope this helps someone!

0

Adding to @Harshad answer.

These are things you should check:

(1) Compiler version as @Harshad saying.

(2) Optimization is enabled or not. If you are using remix, then you will find in compile section.

(3) If you are using any libraries (which it does not seems you are, from your code. But just to double confirm), then you should input those libraries as well.

(4) Lastly, the solidity code must be exact code which you used to compile ;)

Good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.