Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

blockchain chain id:2, given 0: invalid chain id for signer. #114

Open
billtlee opened this issue Nov 25, 2021 · 0 comments
Open

blockchain chain id:2, given 0: invalid chain id for signer. #114

billtlee opened this issue Nov 25, 2021 · 0 comments

Comments

@billtlee
Copy link

Not sure if this is an issue with hdwallet-provider. Wondering if anyone has any idea. Thanks in advance! I am trying to deploy some contracts onto harmony but am getting the following error:

Starting migrations...

Network name: 'harmonytest'
Network id: 1666700000
Block gas limit: 80000000 (0x4c4b400)

1_initial_migration.js

Deploying 'Migrations'

Error: *** Deployment Failed ***

"Migrations" -- blockchain chain id:2, given 0: invalid chain id for signer.

at /Users/bill/Documents/MyProjects/NFTSDao/tribute-contracts/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:365:1
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at Migration._deploy (/Users/bill/Documents/MyProjects/NFTSDao/tribute-contracts/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:70:1)
at Migration._load (/Users/bill/Documents/MyProjects/NFTSDao/tribute-contracts/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:56:1)
at Migration.run (/Users/bill/Documents/MyProjects/NFTSDao/tribute-contracts/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:217:1)
at Object.runMigrations (/Users/bill/Documents/MyProjects/NFTSDao/tribute-contracts/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
at Object.runFrom (/Users/bill/Documents/MyProjects/NFTSDao/tribute-contracts/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
at Object.runAll (/Users/bill/Documents/MyProjects/NFTSDao/tribute-contracts/node_modules/truffle/build/webpack:/packages/migrate/index.js:114:1)
at Object.run (/Users/bill/Documents/MyProjects/NFTSDao/tribute-contracts/node_modules/truffle/build/webpack:/packages/migrate/index.js:79:1)
at runMigrations (/Users/bill/Documents/MyProjects/NFTSDao/tribute-contracts/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:258:1)
at Object.run (/Users/bill/Documents/MyProjects/NFTSDao/tribute-contracts/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:223:1)
at Command.run (/Users/bill/Documents/MyProjects/NFTSDao/tribute-contracts/node_modules/truffle/build/webpack:/packages/core/lib/command.js:183:1)

Truffle v5.4.22 (core: 5.4.22)
Node v12.18.4

Here is what I have in my truffle-config.js

`/**

  • Use this file to configure your truffle project. It's seeded with some
  • common settings for different networks and features like migrations,
  • compilation and testing. Uncomment the ones you need or modify
  • them to suit your project as necessary.
  • More information about configuration can be found at:
  • truffleframework.com/docs/advanced/configuration
  • To deploy via Infura you'll need a wallet provider (like @truffle/hdwallet-provider)
  • to sign your transactions before they're sent to a remote public node. Infura accounts
  • are available for free at: infura.io/register.
  • You'll also need a mnemonic - the twelve word phrase the wallet uses to generate
  • public/private key pairs. If you're publishing your code to GitHub make sure you load this
  • phrase from a file you've .gitignored so it doesn't accidentally become public.

*/

require("dotenv").config();
require("solidity-coverage");

const getNetworkProvider = () => {
let HDWalletProvider = require("@truffle/hdwallet-provider");
let mnemonic = process.env.TRUFFLE_MNEMONIC;
return new HDWalletProvider(mnemonic, process.env.ETH_NODE_URL);
};

module.exports = {
networks: {
ganache: {
host: "127.0.0.1", // Localhost (default: none)
port: 7545, // Standard Ethereum port (default: none)
network_id: "1337", // Any network (default: none)
},
goerli: {
provider: getNetworkProvider,
network_id: 5,
gasPrice: 10000000000,
skipDryRun: true,
},
rinkeby: {
provider: getNetworkProvider,
network_id: 4,
gasPrice: 10000000000,
skipDryRun: true,
},
mainnet: {
provider: getNetworkProvider,
network_id: 1,
skipDryRun: true,
},
harmony: {
provider: getNetworkProvider,
network_id: 1666600000,
skipDryRun: true,
},
harmonytest: {
provider: getNetworkProvider,
network_id: 1666700000,
skipDryRun: true,
},
coverage: {
host: "localhost",
network_id: "*",
port: 8555,
gas: 0xfffffffffff,
gasPrice: 0x01,
},
},

// Configure your compilers
compilers: {
solc: {
version: "0.8.10", // 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: true,
runs: 10000,
},
// evmVersion: "byzantium"
},
},
},
api_keys: {
etherscan: process.env.ETHERSCAN_API_KEY, // Obtain one at https://etherscan.io/myapikey
},
plugins: ["solidity-coverage", "truffle-plugin-verify"],
};
`

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant