I am using a private geth with a simple contract file SimpleContract.sol

pragma solidity ^0.4.0;

contract SimpleStorage {
  uint storedData;

  function set(uint x) {
    storedData = x;

  function get() constant returns (uint) {
    return storedData;

and the genesis file

  "nonce": "0x0000000000000042",
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "difficulty": "0x400",
  "alloc": {
     "65a89fc3ff11a5fb1f6c77532dfb258fba531011":{ "balance": "10000000000000000"}
   "coinbase": "0x0000000000000000000000000000000000000000",
   "timestamp": "0x00",
   "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
   "gasLimit": "0xffffffff",
   "config": {
       "chainId": 42,
       "homesteadBlock": 0,
       "eip155Block": 0,
       "eip158Block": 0

I compiled using

echo "var simpleOutput=`solc --optimize --combined-json abi,bin,interface SimpleContract.sol`" > simpleStorage.js

I invoked a private geth console and ran

personal.unlockAccount(eth.accounts[0], <password>)
var simpleStorageContract = web3.eth.contract(JSON.parse(simpleOutput.contracts["SimpleContract.sol:SimpleStorage"].abi));
var simpleStorage = simpleStorageContract.new(   {     from: web3.eth.accounts[0],      data: "0x" + simpleOutput.contracts["SimpleContract.sol:SimpleStorage"].bin,      gas: '47000'   },  function (e, contract) { if(!e) {    if(!contract.address) {      console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined...");    } else {      console.log("Contract mined! Address: " + contract.address);      console.log(contract);    }  }})

At this point, it printed

INFO [07-02|17:30:53] Submitted contract creation
fullhash=0x98a94a395677b304a90c6d73d64514272a32f7c891acbdde44bc3caca50fc162 contract=0xe27c4df48e1a75bcb2de33fb9647a677268764c9

Contract transaction send: TransactionHash: 0x98a94a395677b304a90c6d73d64514272a32f7c891acbdde44bc3caca50fc162 waiting to be mined...

When I tried


it printed

INFO [07-02|17:31:05] Commit new mining work number=58 txs=0 uncles=0 elapsed=5.320ms

DEBUG[07-02|17:31:05] Loaded old ethash dataset from disk epoch=0

DEBUG[07-02|17:31:05] Loaded old ethash dataset from disk epoch=1

INFO [07-02|17:31:06] Successfully sealed new block number=58 hash=839455…388037

DEBUG[07-02|17:31:06] Trie cache stats after commit misses=8 unloads=0

INFO [07-02|17:31:06] 🔨 mined potential block number=58 hash=839455…388037

INFO [07-02|17:31:06] Commit new mining work number=59 txs=0 uncles=0 elapsed=102.378µs

DEBUG[07-02|17:31:06] Receipt not found for transaction hash=98a94a…0fc162

It never mines the smart contract.

I have the unlocked account and the account signs the "from" in simpleStorageContract. Anything else I am missing?

  • Did you setup eth.coinbase? Check in console what eth.coinbase command returns. – NewTwoEth Jul 3 '17 at 1:24
  • eth.coinbase => "0x65a89fc3ff11a5fb1f6c77532dfb258fba531011" – trialcritic Jul 3 '17 at 1:41
  • Ok. So this is not a problem of not having eth.coinbase set. – NewTwoEth Jul 3 '17 at 1:47
  • 1
    The gas seems too low, try something like gas: "1000000". – Ismael Jul 3 '17 at 5:27
  • You are right about the gas being low. When I increased the gas, it went through. Thanks – trialcritic Jul 3 '17 at 6:02

Your Answer

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

Browse other questions tagged or ask your own question.