I created a contract and deployed to Ganache test network successfully but it is not deploying to infura.
//this section is clean. worked for Ganache
var output = JSON.parse(solc.compile(JSON.stringify(input)));
const interface = output.contracts["test.sol"]["Inbox"].abi;
const bytecode = output.contracts["test.sol"]["Inbox"].evm.bytecode.object
for infura,
const HDWalletProvider = require("@truffle/hdwallet-provider");
const Web3 = require("web3");
const compile = require("./compile");
const provider = new HDWalletProvider(
"chef punch git then seek hobby abstract sad split fog quick able",
"https://rinkeby.infura.io/v3/87773d0063ddee33821710c0e926c554"
);
const web3 = new Web3(provider);
const deploy = async () => {
const accounts = await web3.eth.getAccounts();
console.log("attemtign", accounts);// shows the array of accounts
const myContract = await new web3.eth.Contract(interface)
.deploy({ data: "0x" + bytecode, arguments: ["hi there"] })
.send({
gas: "1000000",
from: accounts[0],
gasPrice: "10000" // even i discarded here did not work
});
console.log(myContract.options.address);
provider.engine.stop();
};
deploy();
I have 3 eth in my account and terminal is showing this console.log("attemtign", accounts)
then hanging.