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",

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"] })
      gas: "1000000",
      from: accounts[0],
      gasPrice: "10000" // even i discarded here did not work


I have 3 eth in my account and terminal is showing this console.log("attemtign", accounts) then hanging.

2 Answers 2


The gas price is too low. As of 2020-04-01 from rinkeby.etherscan.com gas prices are around 1 gwei = "1000000000" wei.

To have faster confirmation times adjust to a higher value.

Transactions are processed in increasing order of their nonce. A pending transaction with low fees will prevent new transaction with corrects fees from being mined.

  • I get this error when I placed the value above :"RuntimeError: abort(Error: exceeds block gas limit). Build with -s ASSERTIONS=1 for more info."
    – Yilmaz
    Apr 2, 2020 at 0:13
  • @Yilmaz You have to set gasPrice to 1000000000, it seems you were setting gas instead.
    – Ismael
    Apr 2, 2020 at 5:17
  • gasPrice: 1000000000 or gasPrice: "1000000000", still hanging. If i add gas:100 i get this:abort(Error: intrinsic gas too low). if add gas: 1000000000, abort(Error: exceeds block gas limit).
    – Yilmaz
    Apr 2, 2020 at 22:18
  • @Yilmaz Does the account used have a pending transaction? gas depends on the contract size. You haven't put the code in the question so I can't say a number. A typical contract requires less than 5000000 but complex ones will use more.
    – Ismael
    Apr 2, 2020 at 23:34

Visit https://web3js.readthedocs.io/en/v2.0.0-alpha/web3-eth-contract.html?highlight=deploy#id9 .You can try printing error,transaction hash or receipt. It might help you figure out the actual problem, since it gets stuck after console.log("attemtign", accounts).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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