9

I am facing this error when on running truffle migrate on Rinkeby network with my infura

enter image description here

Sahil Kharya
  • 141
  • 1
  • 1
  • 6

4 Answers4

5

I found the fix by changing the infura Rinkeby RPC_URL in 'the truffle-config.js' file.

Originally I was using the https://rinkeby_url. On using wss://rinkeby_url - it got fixed. Please see a snapshot of the URL from infura. You can create a account on infura and generate these URL. Example of URL from Infura

Example of my truffle-config.js

    rinkeby: {
      provider: () => {
        return new HDWalletProvider(process.env.MNEMONIC, process.env.RINKEBY_RPC_URL)
      },
      network_id: "4",
      networkCheckTimeout: 1000000,
      timeoutBlocks: 200,
      addressIndex: 2
},

Sahil Kharya
  • 141
  • 1
  • 1
  • 6
1

I met the same problem. Here is how I resolved this problem:

I saw this error message, just saying "this operation is timeout", don't just focus on this error, you should also check the browser with the transaction id.

e.g.

Step1. I ran this command to deploy:

truffle deploy --network goerli --verbose-rpc --interactive --skip-dry-run --reset

and it may give this error :

Error: PollingBlockTracker - encountered an error while attempting to update latest block:
undefined
    at PollingBlockTracker._performSync (/mnt/d/workspace/test_truffle/node_modules/eth-block-tracker/src/polling.js:51:24)

so, let increase the timeout config:

// truffle-config.js 
require('dotenv').config();
const HDWalletProvider = require('@truffle/hdwallet-provider');
const { INFURA_API_URL, MNEMONIC } = process.env;

module.exports = { networks: { development: { host: "127.0.0.1", port: 8545, network_id: "*" }, goerli: { provider: () => new HDWalletProvider(MNEMONIC, INFURA_API_URL), network_id: '5', gas: 5500000,

  // you can also increase the gas price from default to 50 gwei, which is very high in 2022.6
  gasPrice: 50000000000,

  //  This is the timeout config. set it to 1000 seconds
  networkCheckTimeout: 1000000,    
  timeoutBlocks: 200,
  addressIndex: 2
}

} };

step2. run the command again, and you would get an output looks like:

enter image description here

copy this tx and view it on goerli.etherscan.io: you may found it's pending

enter image description here

step3. let's increase the gas price from default to 50Gwei, then resend this rpc call:

// truffle-config.js
goerli: {
  // ....
  // you can also increase the gas price from default to 50 gwei, which is very high in 2022.6
  gasPrice: 50000000000,

}

then re-execute the command:

truffle deploy --network goerli --verbose-rpc --interactive --skip-dry-run --reset

then everything looks fine:

enter image description here

step4. finally , I checked the blockchain browser when I met "752 seconds timeout", I found at that time, all people's tx is pending ( another word, there's no one successful block minted during 40 minutes) . see the image below:

enter image description here

Siwei
  • 322
  • 2
  • 10
0

In my project, it seems that removing other attributes than these three: providers, network_id, and gas somehow solves the problem.

rinkeby: { provider: () => new HDWalletProvider( numonic, "https://rinkeby.infura.io/v3/{id}" ), network_id: 4, // chain_id: 5, gas: 5500000, }

0

You can also use compile-none when deploying. If your migration file has a lot of contracts to compile, truffle sends requests to get latest block. If provider limits the number of calls you can do it, it will timeout. Use compile-none and it will work fine.

More details here: BSC Testnet: Truffle Migrate ETIMEDOUT

Luiz Soares
  • 1,064
  • 6
  • 14