Following is a promise that i use for getting transaction receipt:

function getTransactionReceiptMined(web3Instance, txHash, interval) {
    const self = this;
    const transactionReceiptAsync = function(resolve, reject) {
        web3Instance.eth.getTransactionReceipt(txHash, (error, receipt) => {
            if (error) {
            } else if (receipt == null) {
                    () => transactionReceiptAsync(resolve, reject),
                    interval ? interval : 500);
            } else {

   return new Promise(transactionReceiptAsync);

function sendRawTransaction() {
  let sendRawTxn = async function(resolve, reject){
//web3_inst is web3 object
        web3_inst.eth.sendRawTransaction("0x" + txSerialized.toString('hex'), function(err, result){
            getTransactionReceiptMined(web3_inst, result)


The above code works when i deploy in (local)ganache and (online testnet)ropsten. But when i deploy in geth, i get following output in (powershell) console:

O [03-28|12:05:27.873] Submitted contract creation
fullhash=0xaeacbabebdec3ca0d3e89e4030abc644d34ad34ad46d1eaf803abb31fa852913 contract=0x9F35a8B2ACE175734FA94059F59dA792123049cC INFO [03-28|12:05:29.793] Commit new mining work number=1 sealhash=9f591d…f29cb5 uncles=0 txs=10 gas=44098370 fees=0.04409837 elapsed=5.907ms

Normally the promise calls itself few times until it receives receipt object, but in case of geth, even after receiving the above output which i assume to be contract deployed successfully, the promise is stuck in infinite loop as receipt is always null. How should i solve this?

PS: I am using solc to compile and deploying using nodejs i.e., no truffle. node version: v10.14.2 web3 version: 0.20.7

PS C:\> geth version
Version: 1.8.23-stable
Git Commit: c942700427557e3ff6de3aaf6b916e2f056c1ec2
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.11.5
Operating System: windows

Genesis file:

  "config": {
    "chainId": 15,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
  "gasLimit": "0x260000000",
  "difficulty": "0x24",
  "coinbase": "0x20a876ab4b2e27e1918275859de895e1b87a2f8f",
  "alloc": {
    "0x20a876ab4b2e27e1918275859de895e1b87a2f8f": {
      "balance": "1000000000000000000"


After a while a checked this on console:

geth output:

INFO [03-28|15:12:08.916] Submitted contract creation
fullhash=0xfb8ddf2536ff5475d6f8ccde47b5dfb1cfea909a0eccfff76857b86e7da44a88 contract=0x9e46d590F6aa8a7166CB43fBB1e9AFa58BDe3C3e INFO [03-28|15:12:11.217] Commit new mining work number=1 sealhash=478732…a3cfc0 uncles=0 txs=1 gas=4409837 fees=0.004409837 elapsed=1.097ms

geth console:

> eth.getBlock("latest")
  difficulty: 36,
  extraData: "0x",
  gasLimit: 10200547328,
  gasUsed: 0,
  hash: "0xd887ca627fcd6959ede6c41e51a7da1c84eb6ccddf0b1974bb8938c45ae358bf",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0x164259641d660616aa4a96201f98971604ff0b38",
  mixHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  nonce: "0x0000000000000000",
  number: 0,
  parentHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 506,
  stateRoot: "0x0b7d3ec854a52e42499a0ccf0fbbab8365a7ac7e3c9f36022e5b42aec8a2f3f1",
  timestamp: 0,
  totalDifficulty: 36,
  transactions: [],
  transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  uncles: []
> eth.getBlock("pending")
  difficulty: 131072,
  extraData: "0xda83010817846765746888676f312e31312e358777696e646f7773",
  gasLimit: 10190585857,
  gasUsed: 4409837,
  hash: null,
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: null,
  mixHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  nonce: null,
  number: 1,
  parentHash: "0xd887ca627fcd6959ede6c41e51a7da1c84eb6ccddf0b1974bb8938c45ae358bf",
  receiptsRoot: "0xb7500c085957fa5e7ba88aff60dc536d93cf73913659e47bfdc637bc8e9eb94e",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 17152,
  stateRoot: "0x75fd4a128345f0df147f93795780f7706821fa9bba79132f6e9085fab33c6115",
  timestamp: 1553766110,
  totalDifficulty: 0,
  transactions: ["0xfb8ddf2536ff5475d6f8ccde47b5dfb1cfea909a0eccfff76857b86e7da44a88"],
  transactionsRoot: "0x1df68167a72101fabe050fb21c8bbd87a8321100f1e959ba5cd46c74dc067fd0",
  uncles: []

I think, that the transaction is not getting mined even after waiting for an hour. Also, please explain why difficulty of pending block (131072) is different than that of network (36, which i had set in genesis).



** Until now, I have been doing geth ... --mine, but when I do geth ... console then miner.start() then it starts creating blocks:

INFO [03-29|14:13:23.907] Successfully sealed new block            number=3172 sealhash=74b181…41550f hash=dbba06…c3dba8 elapsed=4.693s
INFO [03-29|14:13:23.919] 🔗 block reached canonical chain          number=3165 hash=5622f9…35038a
INFO [03-29|14:13:24.085] 🔨 mined potential block                  number=3172 hash=dbba06…c3dba8
INFO [03-29|14:13:24.103] Commit new mining work 

Is there any difference between using command line mine vs miner.start() ?

  • when i deploy in (local)ganache and (online testnet)ropsten. But when i deploy in geth - this statement doesn't make much sense, because those 3 entities are not under the same category. Ganache and Geth are node types, while "local" and Ropsten is a network types. In order to describe a deployment, you need to specify both, i.e., what node type you're using and to what network type you're deploying. So while local ganache provides a good deployment-description, (online testnet)ropsten doesn't, and neither does geth. – goodvibration Mar 28 '19 at 6:53
  • I meant in sense of install location, i.e., geth(one node) and ganache on pc, whereas ropsten testnet (endpoint) from infura. – pebble Mar 28 '19 at 7:04
  • Just say which setup works and which doesn't. At present, I see 3 node types and 2 network types, so there are 6 possible setups, and I'm pretty sure that you've tried only some of them, so please explain which combinations you've tried and what result you get for each combination. – goodvibration Mar 28 '19 at 7:07
  • I tried on: 1. geth local 2. ganache local 3. ropsten testnet (endpoint from infura) – pebble Mar 28 '19 at 7:21
  • And the result in each case? – goodvibration Mar 28 '19 at 7:27

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.