如何配置Hardhat连接到RSK测试网



要连接到以太坊测试网,hardhat.config.js中的配置如下:

networks: {
ropsten: {
url: `https://eth-ropsten.alchemyapi.io/v2/${ALCHEMY_API_KEY}`,
accounts: [`${ROPSTEN_PRIVATE_KEY}`]
}
}

(取自此处:https://hardhat.org/tutorial/deploying-to-a-live-network.html(

如何为RSK Testnet添加网络配置?

(注意,我使用的是种子短语,而不是原始私钥(

hardhat.config.js中的网络配置可以这样定义:

networks: {
rsktestnet: {
chainId: 31,
url: 'https://public-node.testnet.rsk.co/',
gasPrice: Math.floor(minimumGasPriceTestnet * TESTNET_GAS_MULT),
gasMultiplier: TESTNET_GAS_MULT,
accounts: {
mnemonic: mnemonic,
initialIndex: 0,
// if using RSK dPath
// Ref: https://developers.rsk.co/rsk/architecture/account-based/#derivation-path-info
path: "m/44'/37310'/0'/0",
// if using Ethereum dPath (e.g. for Metamask compatibility)
// path: "m/44'/60'/0'/0",
count: 10,
},
},
},

何处

  • mnemonic是您的BIP-39种子短语
  • TESTNET_GAS_MULT设置为大于或等于1的任何值
  • minimumGasPriceTestnet查看此答案或此答案

最新更新