Smart Contract Deployment: Dame Mas Gasolina

S. Matthew English
5 min readAug 23, 2017

--

Interested in the idea of decentralized & anonymous (perhaps even autonomous) voting, I’ve recently attempted to deploy the Open Vote Network project to the Ropsten Revival testnet— but I didn’t succeed.

My go-to move for deploying smart contracts recently has been to use https://remix.ethereum.org, in conjunction with MetaMask. One gripe I have with Remix is that it doesn’t have a dark theme, recently I’ve been thinking of writing one myself.

Below we can see a screenshot of my attempt to compile and deploy ‘AnonymousVoting.sol’ to the testnet:

The Error I got when I tried to create the contract was:

callback contain no result Gas required exceeds limit: 3000000

The gas limit can be configured here:

After conducting an search[0], I realized that this gas limit was in fact much lower than the one enforced by miners, which can be seen here:

Going back to the original paper I looked specifically for gas limit and I found the following section:

Even after increasing the gas limit to the level indicated as acceptable by ethstats.net I was still confronted with the Error:

callback contain no result Gas required exceeds block gas limit: 6689731

If someone is keen to help me solve this issue, or if your interested in the idea of autonomous voting and would like to share knowledge, please get in touch.

Resources

Here’s what the compiled ABI for the contract looks like:

var contractAbi = eth.contract([{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"eligible","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"xG","type":"uint256[2]"},{"name":"vG","type":"uint256[3]"},{"name":"r","type":"uint256"}],"name":"register","outputs":[{"name":"","type":"bool"}],"payable":true,"type":"function"},{"constant":false,"inputs":[],"name":"computeTally","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"withdrawRefund","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"addressid","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totaleligible","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"getVoter","outputs":[{"name":"_registeredkey","type":"uint256[2]"},{"name":"_reconstructedkey","type":"uint256[2]"},{"name":"_commitment","type":"bytes32"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"endSignupPhase","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"commitmentphase","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"question","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address[]"}],"name":"setEligible","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"finishSignupPhase","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"endRefundPhase","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"h","type":"bytes32"}],"name":"submitCommitment","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalrefunded","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"endCommitmentPhase","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"finishRegistrationPhase","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"params","type":"uint256[4]"},{"name":"y","type":"uint256[2]"},{"name":"a1","type":"uint256[2]"},{"name":"b1","type":"uint256[2]"},{"name":"a2","type":"uint256[2]"},{"name":"b2","type":"uint256[2]"}],"name":"submitVote","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"gap","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalcommitted","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"votecast","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"deadlinePassed","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalvoted","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"params","type":"uint256[4]"},{"name":"y","type":"uint256[2]"},{"name":"a1","type":"uint256[2]"},{"name":"b1","type":"uint256[2]"},{"name":"a2","type":"uint256[2]"},{"name":"b2","type":"uint256[2]"}],"name":"verify1outof2ZKP","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"charity","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"endVotingPhase","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"commitment","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"registered","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_question","type":"string"},{"name":"enableCommitmentPhase","type":"bool"},{"name":"_finishSignupPhase","type":"uint256"},{"name":"_endSignupPhase","type":"uint256"},{"name":"_endCommitmentPhase","type":"uint256"},{"name":"_endVotingPhase","type":"uint256"},{"name":"_endRefundPhase","type":"uint256"},{"name":"_depositrequired","type":"uint256"}],"name":"beginSignUp","outputs":[{"name":"","type":"bool"}],"payable":true,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"refunds","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"state","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totaltorefund","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"finaltally","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalregistered","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"sendToCharity","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"voters","outputs":[{"name":"addr","type":"address"},{"name":"commitment","type":"bytes32"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"lostdeposit","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"addresses","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"depositrequired","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"xG","type":"uint256[2]"},{"name":"r","type":"uint256"},{"name":"vG","type":"uint256[3]"}],"name":"verifyZKP","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"inputs":[{"name":"_gap","type":"uint256"},{"name":"_charity","type":"address"}],"type":"constructor","payable":true}]);

After deploying it to my geth console and calling it:

> contractAbi{abi: [{constant: true,inputs: [{...}],name: "eligible",outputs: [{...}],payable: false,type: "function"}, {constant: false,inputs: [{...}, {...}, {...}],name: "register",outputs: [{...}],payable: true,type: "function"}, {constant: false,inputs: [],name: "computeTally",outputs: [],payable: false,type: "function"}, {constant: false,inputs: [],name: "withdrawRefund",outputs: [],payable: false,type: "function"}, {constant: true,inputs: [{...}],name: "addressid",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "totaleligible",outputs: [{...}],payable: false,type: "function"}, {constant: false,inputs: [],name: "getVoter",outputs: [{...}, {...}, {...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "endSignupPhase",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "commitmentphase",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "question",outputs: [{...}],payable: false,type: "function"}, {constant: false,inputs: [{...}],name: "setEligible",outputs: [],payable: false,type: "function"}, {constant: true,inputs: [],name: "finishSignupPhase",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "endRefundPhase",outputs: [{...}],payable: false,type: "function"}, {constant: false,inputs: [{...}],name: "submitCommitment",outputs: [],payable: false,type: "function"}, {constant: true,inputs: [],name: "totalrefunded",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "endCommitmentPhase",outputs: [{...}],payable: false,type: "function"}, {constant: false,inputs: [],name: "finishRegistrationPhase",outputs: [{...}],payable: false,type: "function"}, {constant: false,inputs: [{...}, {...}, {...}, {...}, {...}, {...}],name: "submitVote",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "gap",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "totalcommitted",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [{...}],name: "votecast",outputs: [{...}],payable: false,type: "function"}, {constant: false,inputs: [],name: "deadlinePassed",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "totalvoted",outputs: [{...}],payable: false,type: "function"}, {constant: false,inputs: [{...}, {...}, {...}, {...}, {...}, {...}],name: "verify1outof2ZKP",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "owner",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "charity",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "endVotingPhase",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [{...}],name: "commitment",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [{...}],name: "registered",outputs: [{...}],payable: false,type: "function"}, {constant: false,inputs: [{...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}],name: "beginSignUp",outputs: [{...}],payable: true,type: "function"}, {constant: true,inputs: [{...}],name: "refunds",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "state",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "totaltorefund",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [{...}],name: "finaltally",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "totalregistered",outputs: [{...}],payable: false,type: "function"}, {constant: false,inputs: [],name: "sendToCharity",outputs: [],payable: false,type: "function"}, {constant: true,inputs: [{...}],name: "voters",outputs: [{...}, {...}],payable: false,type: "function"}, {constant: true,inputs: [],name: "lostdeposit",outputs: [{...}],payable: false,type: "function"}, {constant: true,inputs: [{...}],name: "addresses",outputs: [{...}],payable: false,type: "function"}, {constant: false,inputs: [{...}],name: "transferOwnership",outputs: [],payable: false,type: "function"}, {constant: true,inputs: [],name: "depositrequired",outputs: [{...}],payable: false,type: "function"}, {constant: false,inputs: [{...}, {...}, {...}],name: "verifyZKP",outputs: [{...}],payable: false,type: "function"}, {inputs: [{...}, {...}],payable: true,type: "constructor"}],eth: {accounts: ["0xd7a9a61a480d458a1181e0563b07f944df4489a6"],blockNumber: 1269484,coinbase: "0xd7a9a61a480d458a1181e0563b07f944df4489a6",compile: {lll: function(),serpent: function(),solidity: function()},defaultAccount: undefined,defaultBlock: "latest",gasPrice: 93000000000,hashrate: 0,mining: true,pendingTransactions: [],protocolVersion: "0x3f",syncing: false,call: function(),contract: function(abi),estimateGas: function(),filter: function(fil, callback),getAccounts: function(callback),getBalance: function(),getBlock: function(),getBlockNumber: function(callback),getBlockTransactionCount: function(),getBlockUncleCount: function(),getCode: function(),getCoinbase: function(callback),getCompilers: function(),getGasPrice: function(callback),getHashrate: function(callback),getMining: function(callback),getPendingTransactions: function(callback),getProtocolVersion: function(callback),getRawTransaction: function(),getRawTransactionFromBlock: function(),getStorageAt: function(),getSyncing: function(callback),getTransaction: function(),getTransactionCount: function(),getTransactionFromBlock: function(),getTransactionReceipt: function(),getUncle: function(),getWork: function(),iban: function(iban),icapNamereg: function(),isSyncing: function(callback),namereg: function(),resend: function(),sendIBANTransaction: function(),sendRawTransaction: function(),sendTransaction: function(),sign: function(),signTransaction: function(),submitTransaction: function(),submitWork: function()},at: function(address, callback),getData: function(),new: function()}

--

--