Web3.js: Contract deploy promise never returns in beta.52

Created on 14 Apr 2019  路  7Comments  路  Source: ChainSafe/web3.js

Description

Awaiting on a transaction to deploy a web3 contract in beta.52 never returns, even though the transaction does go through and the contract is deployed. Tested in ganache with both instant seal and 1s block time. The same snippet worked fine in beta.37.

Expected behavior

Awaiting on Contract.deploy().send() should return after the transaction is mined.

Actual behavior

Awaiting on Contract.deploy().send() never returns.

Steps to reproduce the behavior

  1. Create a new web3 contract instance
  2. Await on Contract.deploy().send()

Error Logs

None, but ganache reports the transaction as successful:

  Transaction: 0xd74bac6e76aa75e9c9a8998cc0e1835acf38ddf92cd07d47e694709b12b7f58c
  Contract created: 0x5b1869d9a4c187f2eaa108f3062412ecf0526b24
  Gas usage: 412242
  Block Number: 44
  Block Time: Sun Apr 14 2019 17:27:16 GMT-0300 (Argentina Standard Time)

Gists

const Web3 = require('web3');

async function main() {
  const web3 = new Web3('http://localhost:8545');
  const [from] = await web3.eth.getAccounts();
  const artifact = require('./Greeter.json');
  const data = artifact.compilerOutput.evm.bytecode.object;
  const abi = artifact.compilerOutput.abi;
  const Greeter = new web3.eth.Contract(abi, null, { data, gas: 1e6 });
  const greeter = await Greeter.deploy({ arguments: ["Hello"] }).send({ from });
  console.log(`Deployed at ${greeter.options.address}`);
}

main();

Versions

  • web3.js: 1.0.0-beta.52
  • nodejs: v10.13.0
  • ethereum node: Ganache CLI v6.4.0 (ganache-core: 2.5.1)
more information needed

All 7 comments

Thanks for opening this issue!
Did you configure the transactionConfirmationBlocks as described here?

Adding that configuration fixed the issue, thanks! That said, I would expect the option to have a reasonable default value if it is not set.

I too was able to fix this with transactionConfirmationBlocks, but if I'm developing locally with ganache and deploying I need to manually mine a block in order to get a response.

Is there a reasonable way to get around having to do this manual step?

i think I have the same issue, see #2661

@ejwessel We have an issue with the transaction confirmation workflow over an HTTP connection as mentioned from @szerintedmi. Because of this will I close this issue.

As long as the issue is not fixed, it should be left open.

It's a duplication of #2661 @Levino

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SCBuergel picture SCBuergel  路  3Comments

zamoore picture zamoore  路  3Comments

joeriexelmans picture joeriexelmans  路  3Comments

mishell-trickster picture mishell-trickster  路  3Comments

baxy picture baxy  路  3Comments