I'm trying to deploy to Mainnet (for the first time) but the initial migration (1_initial_migration
) is getting stuck. Deploying to Kovan works fine and is super fast. I have enough Eth to deploy to Mainnet. I've attempted it few times, and it get stuck.
I'm running this command to find out the addresses of my Contract deployment. This creates an error:
TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at Object.display (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/networks.js:58:41)
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/networks.js:31:1)
at Command.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:136:1)
Truffle v5.1.67 (core: 5.1.67)
Node v15.4.0
Could this error (not sure what causes it) be related to Truffle not being able to migrate my Contract to Mainnet?
// truffle-config.js
const path = require("path");
const dotenv = require("dotenv");
const dotenvExpand = require("dotenv-expand");
const HDWalletProvider = require("@truffle/hdwallet-provider");
const { ethers } = require("ethers");
const pathToConfig = path.resolve(".env");
const env = dotenv.config({
path: pathToConfig,
});
dotenvExpand(env);
module.exports = {
networks: {
contract_build_directory: "./client/src/contracts",
// Useful for testing. The `development` name is special - truffle uses it by default
// if it's defined here and no other network is specified at the command line.
// You should run a client (like ganache-cli, geth or parity) in a separate terminal
// tab if you use this network and you must also set the `host`, `port` and `network_id`
// options below to some value.
// mainTest: {
// url:
// "https://sandbox.truffleteams.com/df027e94-8bfc-4af8-82de-0205db77e32c",
// network_id: 1,
// },
development: {
host: "127.0.0.1", // Localhost (default: none)
port: 7545, // Standard Ethereum port (default: none)
network_id: "*", // Any network (default: none)
gas: 10000000,
gasLimit: 26000000000,
},
kovan: {
provider: () =>
new HDWalletProvider({
mnemonic: { phrase: process.env.MNEMONIC },
providerOrUrl: process.env.RPC_URL_42,
}),
network_id: 42, // Kovan's id
from: process.env.DEPLOYERS_ADDRESS,
},
mainnet: {
provider: () =>
new HDWalletProvider({
mnemonic: { phrase: process.env.MNEMONIC },
providerOrUrl: process.env.RPC_URL_1,
}),
network_id: 1, // Main's id
gas: 5500000, // Main has a lower block limit than mainnet
confirmations: 2, // # of confs to wait between deployments. (default: 0)
timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
skipDryRun: false, // Skip dry run before migrations? (default: false for public nets )
from: process.env.DEPLOYERS_ADDRESS,
},
},
// Set default mocha options here, use special reporters etc.
mocha: {
timeout: 100000,
},
// Configure your compilers
contracts_build_directory: path.join(__dirname, "client/src/contracts"),
compilers: {
solc: {
version: "0.7.4", // Fetch exact version from solc-bin (default: truffle's version)
},
},
};