You may also try installing the wallet handler with the following commaind: #~>npm install truffle-hdwallet-provider
#~>npm install truffle-hdwallet-provider
Then on your truffle-confi.json have the following: var mnemonicPhrase = "word1 word2 word3 ....word12"; var HDWalletProvider = require("truffle-hdwallet-provider");
module.exports = { networks: { development: { host: "127.0.0.1", port: 7545, network_id: "*" // Match any network id }, rinkeby: { // must be a thunk, otherwise truffle commands may hang in CI provider: () => new HDWalletProvider(mnemonicPhrase, "https://rinkeyb.infura.io/v3/YOUR-INFURA-PROJECT-KEY"), network_id: '4', } },
compilers: { solc: { version: '0.8.9', optimizer: { enabled: true, runs: 200 } } }, };
var mnemonicPhrase = "word1 word2 word3 ....word12";
var HDWalletProvider = require("truffle-hdwallet-provider");
module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 7545,
network_id: "*" // Match any network id
},
rinkeby: {
// must be a thunk, otherwise truffle commands may hang in CI
provider: () =>
new HDWalletProvider(mnemonicPhrase, "https://rinkeyb.infura.io/v3/YOUR-INFURA-PROJECT-KEY"),
network_id: '4',
}
},
compilers: {
solc: {
version: '0.8.9',
optimizer: {
enabled: true,
runs: 200
}
}
},
};
then try run with truffle: truffle migrate --network rinkeby
You can also replace the infura "https://rinkeyb.infura.io/v3/YOUR-INFURA-PROJECT-KEY" with Alchemy "https://eth-rinkeby.alchemyapi.io/v2/YOUR-ALCHEMY-JEY"