I am using following code to deploy my smart contract but now my transaction is taking too much time to mine on my private blockchain.

String contractAddress = myContract.deploy(web3j, credentials, DefaultGasProvider.GAS_PRICE, DefaultGasProvider.GAS_LIMIT, BigInteger.valueOf(campaign.getId()),
                        campaign.getName(), startDateTime, endDateTime).send().getContractAddress();

So far I was using DefaultGasProvider to calculate gas price and gas limit but it seems like now these limits are not enough to mine my blocks...its taking like 34 mins to mine my transactions. How can I programmatically calculate these value using web3j. Please help me.

  • You don't calculate the gas-price, you choose it. Commented Jun 23, 2020 at 12:14
  • @goodvibration thanks for your reply! But how will I get to know that one particular value which will work for me....for example the above code was working alright but since yesterday that value is not working...though I was able to deploy my contract but at java end I was getting this error "transaction receipt was not generated after 600 seconds for transaction"
    – Ruchita
    Commented Jun 23, 2020 at 12:25


Browse other questions tagged or ask your own question.