5

To connect to an Ethereum Testnet, the configuration in hardhat.config.js is like this:

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

(taken from here: https://hardhat.org/tutorial/deploying-to-a-live-network.html )

How can I add a network config for the RSK Testnet?

(Note that I'm using a seed phrase instead of a raw private key)

bguiz
  • 27,371
  • 47
  • 154
  • 243
Aleks Shenshin
  • 2,117
  • 5
  • 18

1 Answers1

7

The network config in hardhat.config.js could be defined like so:

  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,
      },
    },
  },

Where

  • mnemonic is your BIP-39 seed phrase.
  • TESTNET_GAS_MULT set to any value more than or equal to 1
  • minimumGasPriceTestnet see this answer or this answer
bguiz
  • 27,371
  • 47
  • 154
  • 243