I'm using Remix, Metamask, ROPSTEN and can not deploy any contract...always getting the same message...it used to work...not working any more...happens in different machines, happens with Chrome or Firefox...seems to be related to the estimation routine...


Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? Error: gas required exceeds allowance or always failing transaction at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background.js:1:1723632 at chrome-

Let me know if you have a similar setting and it works...or any known issues...

Thank you !

Here's the Code:

pragma solidity ^0.4.20;
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 = 3;

    /// 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;
            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;

Gas Limit: 3000000 Value: 1 Ether

See if you can deploy this to ROPSTEN...

  • It is likely a problem with your code that results in a permanently failing tx. Share the contract code, and the transaction parameters. Commented Aug 15, 2018 at 21:26
  • I deployed your contract successfully to ropsten without ant change.
    – Ismael
    Commented Aug 18, 2018 at 20:58

2 Answers 2


Your code is missing the constructor() function, see here.

  • 1
    It is using the old syntax function Ballot(), but even in that case that should not cause a failure.
    – Ismael
    Commented Aug 18, 2018 at 16:15

your code works fine on my machine.

1) I guess the Remix compilation is having some problem, creating a new solidity file with the same code and re-deploying it might help. 2) also, try to reload Chrome(Remix tab) 3) otherwise, reinstall Metamask.

hope it helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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