1

Can someone take a look the issue below and help me understand the reason of this issue?

Ethereum Go returns the following error when I trying deploy my contract into dev network using loadScript function:

loadScript("file.js") null [object Object] true Error: The contract code couldn't be stored, please check your gas amount. undefined

The file contains:

var first_sol_firstContract = web3.eth.contract([{"constant":false,"inputs":[],"name":"close","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_bets","type":"uint256[3]"}],"name":"play","outputs":[{"name":"_resultCode","type":"uint256"},{"name":"_valuePayout","type":"uint256"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"hand","type":"uint256[]"}],"name":"hand_value","outputs":[{"name":"_total","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"}]);
var first_sol_first = first_sol_firstContract.new(
   {
     from: web3.eth.accounts[0], 
     data: '0x6060604052341561000c57fe5b5b5b60008054600160a060020a03191633600160a060020a03161790555b6100326100e4565b60405190819003906000f080151561004657fe5b60028054600160a060020a031916600160a060020a039290921691909117905561006e6100f4565b60405190819003906000f080151561008257fe5b60038054600160a060020a031916600160a060020a03929092169190911790556100aa610104565b60405190819003906000f08015156100be57fe5b60018054600160a060020a031916600160a060020a03929092169190911790555b610114565b60405161023a806108cd83390190565b60405161034180610b0783390190565b604051610af980610e4883390190565b6107aa806101236000396000f300606060405263ffffffff60e060020a60003504166343d726d681146100375780635478dbb714610049578063787e98c714610094575bfe5b341561003f57fe5b6100476100f9565b005b60408051606081810190925261007b916004916064918390600390839083908082843750939550610126945050505050565b6040805192835260208301919091528051918290030190f35b341561009c57fe5b6100e760048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061066395505050505050565b60408051918252519081900360200190f35b60005433600160a060020a039081169116146101155760006000fd5b600054600160a060020a0316ff5b5b565b60006000600061013461070c565b61013c61070c565b60006004819055808080808061015560058d600361071e565b50600254604080517fb0a3beaf0000000000000000000000000000000000000000000000000000000081529051600160a060020a039092169163b0a3beaf9160048082019260009290919082900301818387803b15156101b157fe5b6102c65a03f115156101bf57fe5b505050600095505b600286101561030357600254604080516000602091820181905282517f553df0210000000000000000000000000000000000000000000000000000000081529251600160a060020a039094169363553df0219360048082019493918390030190829087803b151561023457fe5b6102c65a03f1151561024257fe5b505060405151895190965086915089908890811061025c57fe5b9060200190602002018181525050600260009054906101000a9004600160a060020a0316600160a060020a031663553df0216000604051602001526040518163ffffffff1660e060020a028152600401809050602060405180830381600087803b15156102c557fe5b6102c65a03f115156102d357fe5b50506040515188519096508691508890889081106102ed57fe5b602090810290910101525b6001909501946101c7565b61030c88610663565b935061031787610663565b92506008841080156103295750600883105b1561054d576005841161049857600254604080516000602091820181905282517f553df0210000000000000000000000000000000000000000000000000000000081529251600160a060020a039094169363553df0219360048082019493918390030190829087803b151561039a57fe5b6102c65a03f115156103a857fe5b50506040515189519096508691508990fe5b602090810290910101526103cd88610663565b600154604080516000602091820181905282517f208df65f000000000000000000000000000000000000000000000000000000008152600481018b90529251949850600160a060020a039093169363208df65f936024808501948390030190829087803b151561043957fe5b6102c65a03f1151561044757fe5b5050604051519250506008821415610462576002915061047f565b6008821115610474576003915061047f565b6002825b0460030191505b5b81831161048f57506001610493565b5060005b6104ac565b600583116104a8575060016104ac565b5060005b5b801561054d57600254604080516000602091820181905282517f553df0210000000000000000000000000000000000000000000000000000000081529251600160a060020a039094169363553df0219360048082019493918390030190829087803b151561051757fe5b6102c65a03f1151561052557fe5b50506040515188519096508691508890fe5b6020908102909101015261054a87610663565b92505b5b8284111561055f5760019850610575565b828410156105705760029850610575565b600098505b5b6004549950600360009054906101000a9004600160a060020a0316600160a060020a031663850a2e78338b604060405190810160405280888152602001898152506040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a031681526020018381526020018260026020028083836000831461061d575b80518252602083111561061d57601f1990920191602091820191016105fd565b5050509050019350505050600060405180830381600087803b151561063e57fe5b6102c65a03f1151561064c57fe5b50999b508b9950505b505050505050505050915091565b6000805b82518110156106fe576001548351600160a060020a039091169063208df65f9085908490811061069357fe5b906020019060200201516000604051602001526040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b15156106db57fe5b6102c65a03f115156106e957fe5b5050604051519290920191505b600101610667565b600a825b0691505b50919050565b60408051602081019091526000815290565b826003810192821561074c579160200282015b8281111561074c578251825591602001919060010190610731565b5b5061075992915061075d565b5090565b61077b91905b808211156107595760008155600101610763565b5090565b905600a165627a7a723058201ef16c4036cfe78c7a79c8e5af74794df04365f10e8157fbaee5ea711c1b1afe00296060604052341561000c57fe5b5b60005b60008054600160a060020a03191633600160a060020a03161790555b5060005b6101a081101561005857806002816101a0811061004957fe5b0160005b50555b600101610030565b5b505b6101d08061006a6000396000f300606060405263ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166343d726d68114610050578063553df02114610062578063b0a3beaf14610084575bfe5b341561005857fe5b610060610096565b005b341561006a57fe5b6100726100dd565b60408051918252519081900360200190f35b341561008c57fe5b610060610100565b005b6000543373ffffffffffffffffffffffffffffffffffffffff9081169116146100bf5760006000fd5b60005473ffffffffffffffffffffffffffffffffffffffff16ff5b5b565b6000600261019f5b0160005b50549050600261019f5b0160005b50600090555b90565b6101a06000805b8215610177576101164361017d565b91506002836101a0811061012657fe5b0160005b505490506002826101a0811061013c57fe5b0160005b50546002846101a0811061015057fe5b0160005b5055806002836101a0811061016557fe5b0160005b505560001990920191610107565b5b505050565b6000610445614751620151a48085840283015b0694506101a0855b0693505b5050509190505600a165627a7a72305820d6f9c753c58d1d58d12619bc8d5e5b629d7f1ee103f7a0f2162d990a0e5a043d00296060604052341561000c57fe5b5b5b60008054600160a060020a03191633600160a060020a03161790555b5b5b6103068061003b6000396000f300606060405263ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663314e421e811461006657806343d726d614610097578063850a2e78146100a957806389e28a47146100cc578063ef378f6214610122575bfe5b341561006e57fe5b610085600160a060020a0360043516602435610150565b60408051918252519081900360200190f35b341561009f57fe5b6100a7610178565b005b34156100b157fe5b6100a7600160a060020a036004351660243560446101a5565b005b34156100d457fe5b6100dc6101de565b6040805183815290602082019083908083835b80518252602083111561010f57601f1990920191602091820191016100ef565b5050509050019250505060405180910390f35b341561012a57fe5b610085600160a060020a0360043516610240565b60408051918252519081900360200190f35b60026020528160005260406000208160028110151561016b57fe5b0160005b91509150505481565b60005433600160a060020a039081169116146101945760006000fd5b600054600160a060020a0316ff5b5b565b600160a060020a03831660009081526001602090815260408083208590556002918290529091206101d7918390610252565b505b505050565b60006101e8610291565b33600160a060020a031660009081526001602090815260408083205460029283905292819020815180830192839052939550919082845b81548152602001906001019080831161021f575b50939450505050505b9091565b60016020526000908152604090205481565b8260028101928215610280579160200282015b82811115610280578235825591602001919060010190610265565b5b5061028d9291506102b9565b5090565b6040604051908101604052806002905b60008152602001906001900390816102a15790505090565b6102d791905b8082111561028d57600081556001016102bf565b5090565b905600a165627a7a72305820fb6cf8b2e1850badbe34e40e5599bb263222dc89f109bff44fd213d3989b3e64002960606040525b60008054600160a060020a03191633600160a060020a03161790555b5b610ac8806100316000396000f300606060405263ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663106be31081146100665780631fc03aa0146100f9578063208df65f1461018c57806343d726d6146101b1578063de91bb10146101c3575bfe5b341561006e57fe5b6100796004356101d5565b6040805160208082528351818301528351919283929083019185019080838382156100bf575b8051825260208311156100bf57601f19909201916020918201910161009f565b505050905090810190601f1680156100eb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561010157fe5b610079600435610290565b6040805160208082528351818301528351919283929083019185019080838382156100bf575b8051825260208311156100bf57601f19909201916020918201910161009f565b505050905090810190601f1680156100eb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561019457fe5b61019f60043561034f565b60408051918252519081900360200190f35b34156101b957fe5b6101c1610390565b005b34156101cb57fe5b6101c16103d7565b005b6101dd61081e565b6001600d6034845b068115156101ef57fe5b06603481106101fa57fe5b0160005b50805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156102835780601f1061025857610100808354040283529160200191610283565b820191906000526020600020905b81548152906001019060200180831161026657829003601f168201915b505050505090505b919050565b61029861081e565b603560046034846101e5565b068115156101ef57fe5b06603481106101fa57fe5b0160005b50805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156102835780601f1061025857610100808354040283529160200191610283565b820191906000526020600020905b81548152906001019060200180831161026657829003601f168201915b505050505090505b919050565b60006069600d6034845b0681151561036357fe5b066034811061036e57fe5b602091828204019190065b9054906101000a900460ff1660ff1690505b919050565b6000543373ffffffffffffffffffffffffffffffffffffffff9081169116146103b95760006000fd5b60005473ffffffffffffffffffffffffffffffffffffffff16ff5b5b565b604080516101e08101825260036101a082019081527f41636500000000000000000000000000000000000000000000000000000000006101c083015281528151808301835260048082527f4b696e67000000000000000000000000000000000000000000000000000000006020838101919091528084019290925283518085018552600581527f517565656e0000000000000000000000000000000000000000000000000000008184015283850152835180850185529081527f4a61636b0000000000000000000000000000000000000000000000000000000081830152606083015282518084018452600281527f31300000000000000000000000000000000000000000000000000000000000008183015260808301528251808401845260018082527f39000000000000000000000000000000000000000000000000000000000000008284015260a0840191909152835180850185528181527f38000000000000000000000000000000000000000000000000000000000000008184015260c0840152835180850185528181527f37000000000000000000000000000000000000000000000000000000000000008184015260e0840152835180850185528181527f360000000000000000000000000000000000000000000000000000000000000081840152610100840152835180850185528181527f350000000000000000000000000000000000000000000000000000000000000081840152610120840152835180850185528181527f340000000000000000000000000000000000000000000000000000000000000081840152610140840152835180850185528181527f33000000000000000000000000000000000000000000000000000000000000008184015261016084015283518085019094528084527f3200000000000000000000000000000000000000000000000000000000000000918401919091526101808201929092526106ac9190600d610830565b506040805160c0810182526006608082018181527f537061646573000000000000000000000000000000000000000000000000000060a0840152825282518084018452600581527f436c75627300000000000000000000000000000000000000000000000000000060208281019190915280840191909152835180850185529182527f486561727473000000000000000000000000000000000000000000000000000082820152828401919091528251808401909352600883527f4469616d6f6e64730000000000000000000000000000000000000000000000009083015260608101919091526107a1906035906004610881565b50604080516101a081018252600b8152600a60208201819052918101829052606081018290526080810191909152600960a0820152600860c0820152600760e08201526006610100820152600561012082015260046101408201526003610160820152600261018082015261081a90606990600d6108d2565b505b565b60408051602081019091526000815290565b8260348101928215610870579160200282015b828111156108705782518051610860918491602090910190610965565b5091602001919060010190610843565b5b5061087d9291506109e4565b5090565b8260348101928215610870579160200282015b8281111561087057825180516108b1918491602090910190610965565b5091602001919060010190610894565b5b5061087d9291506109e4565b5090565b6002830191839082156109555791602002820160005b8382111561092657835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026108e8565b80156109535782816101000a81549060ff0219169055600101602081600001049283019260010302610926565b505b5061087d929150610a0e565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106109a657805160ff19168380011785556109d3565b828001600101855582156109d3579182015b828111156109d35782518255916020019190600101906109b8565b5b5061087d929150610a33565b5090565b610a0b91905b8082111561087d5760006109fe8282610a54565b506001016109ea565b5090565b90565b610a0b91905b8082111561087d57805460ff19168155600101610a14565b5090565b90565b610a0b91905b8082111561087d5760008155600101610a39565b5090565b90565b50805460018160011615610100020316600290046000825580601f10610a7a575061081a565b601f01602090049060005260206000209081019061081a9190610a33565b5b505600a165627a7a72305820ecfbbf381c6ac015bfe7de633e530ed58c0e4b3a1142a3ce37303f7357fe9baf0029', 
     gas: '4700000'
   }, function (e, contract){
    console.log(e, contract);
    if (typeof contract.address !== 'undefined') {
         console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
    }
 })

Thank you! L. Alex

  • Did you try increasing gas? – Prashant Prabhakar Singh May 25 '17 at 14:37
  • Prashant, Thank you for the response. Yes, I tried increasing gas limit, but it doesn't help. When I reduce size of data the contract deploying successfully. Are there limits for the size of contract? – user8885 May 25 '17 at 22:09
  • Oh yeah, you have supplied more than enough gas. Every block has a has limit which can't be exceeded. If your transaction exceeds the block gas limit, it is not contained in any of the blocks and hence you were unable to deploy contract. – Prashant Prabhakar Singh May 26 '17 at 3:47
1

The possible issue could be the gasLimit. Ethereum limits the number of tx that can be put in a block using gasLimit. So check if the gas you need to deploy contract is more than the gasLimit for the block.

| improve this answer | |
  • Ethereum limits the number of tx that can be put in a block using gasLimit. - Can you specify these limits? Thank you! – user8885 May 26 '17 at 10:56
  • you can find the limit by using eth.getBlock('latest').gasLimit. This is the maximum gas that all transactions included in the block together can use. So if your contract tries to consume more than this gasLimit to deploy then it will not be deployed. – joifsi May 26 '17 at 11:09

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.