I am working on the my contracts testing scripts. But I want to run tests not on the local TestRPC or Ganache but in the Ropsten testnet. How can I predefine a list of accounts (private keys and addresses)?

  • What node are you connecting to Ropsten with? Commented Mar 9, 2020 at 9:42
  • @goodvibration basically I am working with Shasta and TRON now. There no such big community for TRON, so I asked here and want to port solution to the Tronbox+tronweb+Shasta stack. Commented Mar 9, 2020 at 10:50

2 Answers 2


You can use truffle-hdwallet-provider and provide it with mnemonic which has addresses funded with Ropsten Ethers.

var HDWalletProvider = require("truffle-hdwallet-provider");

var mnemonic = "mountains supernatural bird ...";

module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*" // Match any network id
    ropsten: {
      // must be a thunk, otherwise truffle commands may hang in CI
      provider: () =>
        new HDWalletProvider(mnemonic, "https://ropsten.infura.io/"),
      network_id: '3',

You can use HDWalletProvider to connect to a provider (infura or your local node) using a mnemonic phrase. In case you are using truffle, you can do it by seting you config to something like this:

    networks: {
    kovan: {
          provider: () => new HDWalletProvider(mnemonic, `https://kovan.infura.io/v3/${infuraKey}`),
          network_id: 3,       // Ropsten id

Attention that HDWalletProvider is deprecated. But I, personally, still use it often for testing environments.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.