0

** HOW TO SET UP TRUFFLE CONFIGURATIONS FOR SEPOLIA ETH **

I want to know how to set up my config on truffle to be able to deploy my contract on the eth testnet, I already have an infura api key

1 Answer 1

1

Note that Truffle is deprecated.

If you still want to use it though, here's what truffle-config.js may look like interact with Sepolia:

const HDWalletProvider = require('@truffle/hdwallet-provider');
const private_key = 'PRIVATE_KEY';

module.exports = {
  compilers: {
    solc: {
      version: '0.8.20',
    },
  },
  
  // Network configuration
  networks: {
    // Development network is by default Ganache
    development: {
      host: '127.0.0.1',
      port: 7545,
      network_id: '*',
    },

    // Sepolia test network
    sepolia: {
      provider: () => new HDWalletProvider(
        private_key, 
        `NODE_ENDPOINT`
      ),
      network_id: 11155111, // Sepolia's network id
    },
  },
};

Replace PRIVATE_KEY with the private key of your account funded with Sepolia ETH thatn will do the deployment.

Replace NODE_ENDPOINT with a Sepolia node. Eg you can get one from Chainstack or any other provider.

1
  • Thank you very much Commented Jan 17 at 17:26

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.