- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 VScode 中使用所需的依赖项设置了 Hardhat,并使用 Metamask 运行了一个 Alchemy Node 。我已经尝试了我在网上找到的大部分故障排除并阅读了大部分文档,但我仍然迷路了。无论您需要什么信息,我都可以提供。什么都有帮助。太感谢了。我对此很陌生,所以请和我一起工作。
这是我收到的错误:
npx hardhat node
Error HH604: Error running JSON-RPC server: Must be authenticated!
Hardhat.config.ts
import "@typechain/hardhat";
import "@nomiclabs/hardhat-ethers";
import "@nomiclabs/hardhat-waffle";
import "@nomiclabs/hardhat-etherscan";
import "hardhat-gas-reporter";
import "solidity-coverage";
import "@openzeppelin/hardhat-upgrades";
import "hardhat-deploy";
import { resolve } from "path";
import { config as dotenvConfig } from "dotenv";
import { HardhatUserConfig } from "hardhat/config";
import { NetworkUserConfig } from "hardhat/types";
dotenvConfig({ path: resolve(__dirname, "./.env") });
const chainIds = {
goerli: 5,
hardhat: 1337,
kovan: 42,
mainnet: 1,
rinkeby: 4,
ropsten: 3,
};
// Ensure that we have all the environment variables we need.
const privateKey = process.env.PRIVATE_KEY;
// Make sure node is setup on Alchemy website
const alchemyApiKey = process.env.ALCHEMY_API_KEY;
function getChainConfig(network: keyof typeof chainIds): NetworkUserConfig {
const url = `https://eth-${network}.alchemyapi.io/v2/${alchemyApiKey}`;
return {
accounts: [`${privateKey}`],
chainId: chainIds[network],
url,
};
}
const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
gasReporter: {
currency: "USD",
enabled: process.env.REPORT_GAS ? true : false,
excludeContracts: [],
src: "./contracts",
},
networks: {
hardhat: {
forking: {
url: `https://eth-mainnet.alchemyapi.io/v2/${alchemyApiKey}`,
},
chainId: chainIds.hardhat,
},
// Uncomment for testing. Commented due to CI issues
// mainnet: getChainConfig("mainnet"),
// rinkeby: getChainConfig("rinkeby"),
// ropsten: getChainConfig("ropsten"),
},
paths: {
artifacts: "./artifacts",
cache: "./cache",
sources: "./contracts",
tests: "./test",
deploy: "./scripts/deploy",
deployments: "./deployments",
},
solidity: {
compilers: [
{
version: "0.8.10",
settings: {
metadata: {
bytecodeHash: "none",
},
optimizer: {
enabled: true,
runs: 800,
},
},
},
{
version: "0.8.10",
settings: {
metadata: {
bytecodeHash: "none",
},
optimizer: {
enabled: true,
runs: 800,
},
},
},
{
version: "0.7.5",
settings: {
metadata: {
bytecodeHash: "none",
},
optimizer: {
enabled: true,
runs: 800,
},
},
},
{
version: "0.5.16",
},
{
version: "0.8.10",
settings: {
metadata: {
bytecodeHash: "none",
},
optimizer: {
enabled: true,
runs: 800,
},
},
},
],
settings: {
outputSelection: {
"*": {
"*": ["storageLayout"],
},
},
},
},
namedAccounts: {
deployer: {
default: 0,
},
daoMultisig: {
// mainnet
1: "HIDDEN",
},
},
typechain: {
outDir: "types",
target: "ethers-v5",
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
mocha: {
timeout: 1000000,
},
};
export default config;
最佳答案
当 Alchemy URL 不正确时,通常会显示此错误。如果有帮助,您可以尝试验证一次 key 。
关于node.js - 错误 HH604 : Error running JSON-RPC server: Must be authenticated! Hardhat Node.js Alchemy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70826940/
尝试使用 Hardhat 构建项目,我有节点 v15.14.0,并运行以下命令: npm init -y npm install --save-dev hardhat 终端给我: 然后我跑了: npx
因此,我遵循了多个关于在以太坊中开始智能合约开发的教程,并阅读了许多关于 OpenZeppelin 安全和开发的页面。但是,我究竟如何使用 Hardhat 将我的项目实际部署到以太坊主网?我只能找到有
正在关注这个article运行命令 npm install --dev hardhat @nomicfoundation/hardhat-toolbox 得到成功响应。但是,当我尝试运行 npx ha
我正在 Hardhat 中开发智能合约并在 RSK Testnet 上进行测试.要创建签名者帐户,我使用助记种子短语以及以下 Hardhat 配置: require('@nomicfoundation
我正在分析 Chainrunners 智能合约,因此我在 Etherscan 上复制了 verified contract source code . 当我尝试编译不使用 Solidity 优化器时,
下面是我的智能合约(已经部署)。当我尝试验证它以将代码提交给 Etherscan 时,我收到以下错误,我真的不知道为什么。请问有人可以建议吗? npx hardhat verify --networ
我有一个名为“收养狗”的可靠函数,如下所示,它基本上是契约(Contract)中的一个应付函数。 //这失败了,因为我不知道如何在 HARDHAT/ETHER.JS 中传递以太币 硬汉 const
我正在尝试使用 Hardhat 运行脚本来部署具有构造函数参数的合约。当我运行 npx hardhat run scripts\deploy.js --network rinkeby我得到错误:Err
我正在使用 Hardhat 在 RSK 测试网上部署和测试我的智能合约。这是hardhat.config.js我正在使用的设置: require('@nomiclabs/hardhat-waffle'
追随一个基本的NFT tutorial ,我不得不说,我是编程中的菜鸟。我面临的问题是我的 hardhat.config.js 文件需要一个 API_KEY 和一个私钥,它应该从 process.en
在官方的 waffle 文档中,您可能会找到下一个实现装置的方法: import {expect} from 'chai'; import {loadFixture, deployContract}
在控制台中使用 npx hardhat test 运行 Hardhat 测试后,我决定能够设置断点将帮助我更快地迭代。 如何让 Webstorm 运行由 npx hardhat test 启动的底层函
我试图用构造函数参数验证我的合约,但安全帽每次都抛出该错误 npx hardhat verify --network rinkeby 0x50a45120252c2FeeD06915F46D8Fbab
我在 VScode 中使用所需的依赖项设置了 Hardhat,并使用 Metamask 运行了一个 Alchemy Node 。我已经尝试了我在网上找到的大部分故障排除并阅读了大部分文档,但我仍然迷路
我是一名优秀的程序员,十分优秀!