我可以用这个设置把松露连接到我自己的鹅链上。
$ vi truffle-config.js
networks: {
development: {
host: "mydomain.com",
port: 9000,
network_id: "*",
}
}但草帽不行。
hardhat.config.ts
const config: HardhatUserConfig = {
solidity: "0.8.17",
networks: {
localhost: {
chainId: 2000,
url:"http://mydomain.com:9000"
chainId: 2000,
}
}
};这很奇怪。我使用chainid 2000运行,但是“草帽错误”说它连接到了2020年。
安全帽被设置为使用链式id 2000,但与id 2020连接到链上。
这是我的背景。
geth --networkid 2000 --nodiscover --datadir data --http --http.port 9000 --http.addr 0.0.0.0 --http.corsdomain '*' $ARGS --http.vhosts "*" --nodiscover --allow-insecure-unlock --http.api 'web3,eth,net,debug,personal' npx hardhat run --network localhost scripts/deploy.js后来,我将chainId更改为2020,错误消失了,但是ProviderError:HttpProviderError发生了。
发布于 2023-03-31 19:07:02
节点)
你可以用同样的安全帽。它内置了一个为开发而设计的本地以太网节点它允许您部署契约、运行测试和调试代码,所有这些都在本地计算机的范围内。
npx hardhat run --network hardhat scripts/my-script.js即使使用硬帽子,您也可以独立运行一个节点,以便外部客户端能够连接到它。这可能是MetaMask、Dapp接口或脚本。若要以这种方式运行“草帽网络”,请在项目内部运行:
npx hardhat node然后,只需将元请求连接到http://127.0.0.1:8545,在元问询中,您可以加载硬帽子为开发生成的任何帐户。
您可以在以下链接中阅读更多内容:https://hardhat.org/hardhat-network/docs/overview
。
https://geth.ethereum.org/docs/getting-started#list-accounts
https://ethereum.stackexchange.com/questions/136894
复制相似问题