2

I`m trying to deploy by truffle to testnet polygon Mumbai a smart contract , However it does not work with my contract.

It worked with another smaller contract , but with this one which imports different libraries it doesnt work .

I added the errors below :

Any ideas ?

Compiling your contracts…

    Compiling .\contracts\TenesseERC20.sol
    Compiling .\contracts\interfaces\IERC20.sol
    Compiling .\contracts\libraries\Address.sol
    Compiling .\contracts\libraries\Counters.sol
    Compiling .\contracts\libraries\SafeMath.sol
    Compiling .\contracts\types\ERC20.sol
    Compiling .\contracts\types\Ownable.sol
    Artifacts written to C:\Users\John\polygon-truffle\build\contracts
    Compiled successfully using:

    solc: 0.7.5+commit.eb77ed08.Emscripten.clang

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ({
code: -32603,

message: ‘Too Many Requests’,

data: { originalError: {} }
})

at new NodeError (internal/errors.js:322:7)

at Web3ProviderEngine.emit (events.js:389:17)

at C:\Users\John\node_modules\web3-provider-engine\index.js:54:14
at afterRequest (C:\Users\John\node_modules\web3-provider-engine\index.js:148:21)

at C:\Users\John\node_modules\web3-provider-engine\index.js:174:21

at C:\Users\John\node_modules\web3-provider-engine\index.js:232:9


at C:\Users\John\node_modules\async\internal\once.js:12:16

at replenish (C:\Users\John\node_modules\async\internal\eachOfLimit.js:61:25)

at C:\Users\John\node_modules\async\internal\eachOfLimit.js:71:9

at eachLimit (C:\Users\John\node_modules\async\eachLimit.js:43:36)

at C:\Users\John\node_modules\async\internal\doLimit.js:9:16

at end (C:\Users\John\node_modules\web3-provider-engine\index.js:211:5)
at C:\Users\John\node_modules\web3-provider-engine\subproviders\rpc.js:52:18

at Request._callback (C:\Users\John\node_modules\web3-provider-engine\subproviders\rpc.js:53:11)

at Request.self.callback (C:\Users\John\node_modules\request\request.js:185:22)

at Request.emit (events.js:400:28)
3
  • What are you doing in the truffle-config and deploy scripts? From the error message the network isn't correctly configured or you IP was blacklisted.
    – Ismael
    Dec 8, 2021 at 4:00
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Dec 8, 2021 at 20:49
  • Which node do you use to connect to Polygon Mumbai? rpc-mumbai.maticvigil.com is known to have request limits. Dec 27, 2021 at 15:29

2 Answers 2

0

The solution to this is to add the following configuration in your truffle-config.js file, under the networks section:

  pollingInterval: 1800000,
  disableConfirmationListener: true

This is how it should look like:

  networks: {
    development: {
      host: "127.0.0.1",     // Localhost (default: none)
      port: 8545,            // Standard Ethereum port (default: none)
      network_id: "*",       // Any network (default: none)
    },
    matic: {
      provider: () => new HDWalletProvider(privateKey, "YOUR_RPC"),
      network_id: 80001,
      confirmations: 2,
      timeoutBlocks: 200,
      skipDryRun: true,
      networkCheckTimeout: 9000000,
      pollingInterval: 1800000,
      disableConfirmationListener: true
    }

You can also refer to this video for a more visual explanation.

-1

The issue is because of the RPC used. Generally, everyone uses public RPCs and they cannot handle this many requests coming from different users at the same time. Deployment is smooth if u purchase a private RPC from services like alchemy, quicknode, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.