I'm using the truffle suite against a custom network. This network returns an empty list in response to eth_accounts. So I need to feed the truffle with default accounts (I mean default private keys) in the configuration file just like hardhat. Is it possible in truffle?

I also set from in networks in truffle-config.js but after that truffle sends an eth_sendTransaction instead of eth_sendRawTransaction and again my custom network doesn't support eth_sendTransacton

1 Answer 1


You have to configure truffle to use @truffle/hdwallet-provider.

const HDWalletProvider = require("@truffle/hdwallet-provider");

const mnemonicPhrase = "..."; // Use the wallet mnemonic phrase

module.exports = {
  networks: {
    mynetwork: {
      provider: () =>
        new HDWalletProvider({
          mnemonic: {
            phrase: mnemonicPhrase
          providerOrUrl: "https://ropsten.infura.io/v3/YOUR-PROJECT-ID",

Your Answer

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

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