Blockchain Discussion

Web3.js 1.0 Transaction Receive Issue

After deploying a new contract I never receive a receipt object.

const deploy = { abi: [...], bytecode: '0x...' };

const web3 = new Web3 (window ['ethereum']);
const contract = new web3.eth.Contract (deploy.abi);

window ['ethereum'].enable()
    .then (accounts => {

        contract.deploy({
            data: deploy.bytecode,
            arguments: [...]
        })
        .send ({
            from: accounts [0]
        })
        .on ('error',           console.error)
        .on ('transactionHash', console.log)       /* this is working */
        .on ('receipt',         console.log);      /* this never gets executed */

    })
    .catch (console.error);

Expected behavior

Receiving a contract object containing the address of the new contract in .on ('receipt', ....

Actual behavior

Nothing happens (also no error).

On my node I can look up the contract address manually.
The contract gets created.

Versions

  • web3.js: 1.0.0-beta.51 (latest)
  • metamask: 6.3.0 (latest)
  • browser: Chromium
  • ethereum node: instance: Geth/v1.8.23-stable-c9427004/linux-amd64/go1.11.

Solution

In addition: With web3.js: 1.0.0-beta.46 it’s working fine and I get a receipt as well. All other versions after this one are not working.

https://github.com/ethereum/web3.js/issues/2601

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *