ethereum/go-ethereum · error · Error

Contract transaction couldn't be found after 50 blocks

Error message

Contract transaction couldn't be found after 50 blocks

What it means

After deploying a contract via web3's contract constructor, the code polls getTransactionReceipt once per new block via a filter. If the transaction receipt has not appeared within 50 blocks, it stops watching and reports (via callback or throw) that the contract transaction could not be found. This is a deployment-confirmation timeout, not a consensus error.

Source

Thrown at internal/jsre/deps/web3.js:2898

var checkForContractAddress = function(contract, callback){
    var count = 0,
        callbackFired = false;

    // wait for receipt
    var filter = contract._eth.filter('latest', function(e){
        if (!e && !callbackFired) {
            count++;

            // stop watching after 50 blocks (timeout)
            if (count > 50) {

                filter.stopWatching(function() {});
                callbackFired = true;

                if (callback)
                    callback(new Error('Contract transaction couldn\'t be found after 50 blocks'));
                else
                    throw new Error('Contract transaction couldn\'t be found after 50 blocks');


            } else {

                contract._eth.getTransactionReceipt(contract.transactionHash, function(e, receipt){
                    if(receipt && !callbackFired) {

                        contract._eth.getCode(receipt.contractAddress, function(e, code){
                            /*jshint maxcomplexity: 6 */

                            if(callbackFired || !code)
                                return;

                            filter.stopWatching(function() {});
                            callbackFired = true;

                            if(code.length > 3) {

View on GitHub (pinned to 6bb0588ad8)

Solutions

  1. Check the deployment transaction hash (contract.transactionHash) with eth.getTransaction to see if it is pending or was dropped.
  2. Resend with a higher gas price so miners include the deployment within 50 blocks.
  3. Ensure the geth node is fully synced and (in dev mode) that mining/sealing is running.
  4. Verify the sending account has enough balance for gas+value before deploying.

Example fix

// before
contract.new({from: acct, data: code, gas: 3000000, gasPrice: web3.toWei(1, 'gwei')}, cb);

// after
contract.new({from: acct, data: code, gas: 3000000, gasPrice: web3.toWei(20, 'gwei')}, cb);
Defensive patterns

Strategy: retry

Validate before calling

function deployWithRetry(Contract, opts, cb, tries) {
  tries = tries || 0;
  Contract.new(opts, function (err, c) {
    if (err && /couldn't be found after 50 blocks/.test(err.message) && tries < 3) {
      opts.gasPrice = (opts.gasPrice || web3.toWei(1, 'gwei')) * 1.5;
      return deployWithRetry(Contract, opts, cb, tries + 1);
    }
    cb(err, c);
  });
}

Try / catch

contract.new(opts, function (err, c) {
  if (err && err.message.indexOf("couldn't be found after 50 blocks") !== -1) {
    // inspect c.transactionHash via eth.getTransaction, then bump gasPrice and redeploy
  }
});

Prevention

When it happens

Trigger: new web3.eth.Contract(abi).new({...}, callback) where the sendTransaction succeeded but the tx was never mined within 50 blocks: gas price too low so miners ignore it, out of gas on a full block, node out of sync, or the transaction was dropped from the mempool.

Common situations: Deploying with a low gas price on a congested network, deploying while the local geth node is still syncing, or a stalled/overloaded dev node (dev mode not mining). Also happens if the account had insufficient balance and the tx never propagated.

Related errors


AI-assisted analysis of ethereum/go-ethereum@6bb0588ad8 (2026-08-15). Data as JSON: /api/errors/c8667d4ca8a936da. Report an issue: GitHub.