I'm trying to use Polygon test network with truffle and I followed this document and youtube video to configure Polygon network for truffle. But when I'm trying to execute truffle deploy --network matic
then it failed with below errors.
Error logs
Error: PollingBlockTracker - encountered an error while attempting to update latest block:
Error: Unknown Error: {"statusCode":404,"error":"Not Found"}
at Request._callback (/home/alpha/GoWorkspace/src/github.com/metadata/solidity_e2e/node_modules/@trufflesuite/web3-provider-engine/subproviders/rpc.js:57:23)
at Request.self.callback (/home/alpha/GoWorkspace/src/github.com/metadata/solidity_e2e/node_modules/request/request.js:185:22)
at Request.emit (events.js:315:20)
at Request.<anonymous> (/home/alpha/GoWorkspace/src/github.com/metadata/solidity_e2e/node_modules/request/request.js:1154:10)
at Request.emit (events.js:315:20)
at IncomingMessage.<anonymous> (/home/alpha/GoWorkspace/src/github.com/metadata/solidity_e2e/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:421:28)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
at PollingBlockTracker._performSync (/home/alpha/GoWorkspace/src/github.com/metadata/solidity_e2e/node_modules/eth-block-tracker/src/polling.js:51:24)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
UnhandledRejections detected
Promise {
<rejected> {
code: -32603,
message: 'Unknown Error: {"statusCode":404,"error":"Not Found"}',
data: { originalError: {} },
stack: 'Error: Unknown Error: {"statusCode":404,"error":"Not Found"}\n' +
' at Request._callback (/home/alpha/GoWorkspace/src/github.com/metadata/solidity_e2e/node_modules/@trufflesuite/web3-provider-engine/subproviders/rpc.js:57:23)\n' +
' at Request.self.callback (/home/alpha/GoWorkspace/src/github.com/metadata/solidity_e2e/node_modules/request/request.js:185:22)\n' +
' at Request.emit (events.js:315:20)\n' +
' at Request.<anonymous> (/home/alpha/GoWorkspace/src/github.com/metadata/solidity_e2e/node_modules/request/request.js:1154:10)\n' +
' at Request.emit (events.js:315:20)\n' +
' at IncomingMessage.<anonymous> (/home/alpha/GoWorkspace/src/github.com/metadata/solidity_e2e/node_modules/request/request.js:1076:12)\n' +
' at Object.onceWrapper (events.js:421:28)\n' +
' at IncomingMessage.emit (events.js:327:22)\n' +
' at endReadableNT (internal/streams/readable.js:1327:12)\n' +
' at processTicksAndRejections (internal/process/task_queues.js:80:21)'
}
}
truffle-config.js
const HDWalletProvider = require('@truffle/hdwallet-provider');
const fs = require('fs');
const mnemonic = fs.readFileSync(".secret").toString().trim();
module.exports = {
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(mnemonic, `https://rpc-mumbai.matic.today`),
//host: 'https://rpc-mumbai.matic.today',
network_id: 80001,
confirmations: 2,
timeoutBlocks: 200,
skipDryRun: true
},
},
// Set default mocha options here, use special reporters etc.
mocha: {
// timeout: 100000
},
// Configure your compilers
compilers: {
solc: {
version: "0.8.5", // Fetch exact version from solc-bin (default: truffle's version)
// docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
// settings: { // See the solidity docs for advice about optimization and evmVersion
// optimizer: {
// enabled: false,
// runs: 200
// },
// evmVersion: "byzantium"
// }
}
},
// Truffle DB is currently disabled by default; to enable it, change enabled: false to enabled: true
//
// Note: if you migrated your contracts prior to enabling this field in your Truffle project and want
// those previously migrated contracts available in the .db directory, you will need to run the following:
// $ truffle migrate --reset --compile-all
db: {
enabled: false
}
};
Setup Information
- WSL2 Ubuntu 18.04
- Node version:
v14.15.4
- npm version:
6.14.10
- Solidity compiler:
0.8.5
- truffle version:
v5.3.11 (core: 5.3.11)
- Web3.js:
v1.3.6