hardhat icon indicating copy to clipboard operation
hardhat copied to clipboard

Add support for `--chainid` argument in `node` command

Open thexeromin opened this issue 3 years ago • 9 comments

  • [ ] Because this PR includes a new feature, the change was previously discussed on an Issue or with someone from the team. (Issues #2305)

This PR adds support for --chainid argument in npx hardhat node command.

thexeromin avatar Feb 22 '22 13:02 thexeromin

⚠️ No Changeset found

Latest commit: cd28c9095dc0b8ec6f764c1307076ab37c92f268

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Feb 22 '22 13:02 changeset-bot[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Feb 22 '22 13:02 CLAassistant

Thanks, @webdevabhijit!

@fvictorio will review this after we get our next release out.

alcuadrado avatar Feb 23 '22 14:02 alcuadrado

@alcuadrado Sure.

thexeromin avatar Feb 23 '22 14:02 thexeromin

This PR was marked as stale because it didn't have any activity in the last 30 days. Please excuse us if we didn't have enough time to review it and get it merged. If you are still interested in getting these changes applied, please leave a comment indicating so. Otherwise, it will be closed in 7 days.

github-actions[bot] avatar May 05 '22 00:05 github-actions[bot]

This PR was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar May 12 '22 02:05 github-actions[bot]

Still relevant.

luncht1me avatar Jun 25 '22 00:06 luncht1me

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
hardhat ❌ Failed (Inspect) Jul 6, 2022 at 8:57AM (UTC)
hardhat-storybook ❌ Failed (Inspect) Jul 6, 2022 at 8:57AM (UTC)

vercel[bot] avatar Jul 06 '22 08:07 vercel[bot]

Hey @ethabhijit, thanks for the PR and sorry for taking so long to respond.

I don't think this implementation works, unless I'm missing something. The reason is that it relies on using hardhat_reset with the new chainId, but I'm pretty sure that hardhat_reset doesn't support that. So I would say that this feature is blocked by https://github.com/NomicFoundation/hardhat/issues/1697

In the meantime, for people landing here, a workaround for this missing feature is to use an environment variable. You should set something like this in your hardhat config:

networks: {
  hardhat: {
    chainId: Number(process.env.HARDHAT_CHAIN_ID) ?? 31337
  },
},

And then HARDHAT_CHAIN_ID=123 npx hardhat node should use 123 as a chain id.

fvictorio avatar Jul 20 '22 16:07 fvictorio