Closed ghost closed 5 years ago
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.
You have to configure your module correctly for the development environment. I've updated and improved the transaction confirmation workflow in this release.
Thank's for the quick reply.
You mean this options
object?
const options = {
defaultAccount: '0x0',
defaultBlock: 'latest',
defaultGas: 1,
defaultGasPrice: 0,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 480,
transactionSigner: new CustomTransactionSigner()
}
const web3 = new Web3(window ['ethereum'], options);
Are this values not calculated and set by metamask if you do a transaction? This is what they do for you, right? If not, can I just use this default values then?
Yes @nivida. This issue is same as the issue #2577. Please check the .on('receipt')
event. Why it's not generating the receipt.
I don't know, but it might be issue of Geth as it is working fine with Ganache. Also, after setting options it gets executed but doesn't produces transaction receipt. We only get methods, options etc in receipt.
@hbrs Check the issue #2577 and set the options correctly.
I changed my code to this below, but still don't get a receipt.
const options = {
transactionConfirmationBlocks: 1,
transactionBlockTimeout: 5,
transactionPollingTimeout: 480
};
const web3 = new Web3 (window ['ethereum'], null, options);
+1 After updating to 1.0.0-beta.51 (latest)
, the .on('receipt', (txReceipt : TransactionReceipt)
event is not triggered anymore. I tested this on Ganache, Quorum, and Ropsten. The confirmation
and transactionHash
events are triggered correctly.
1.0.0-beta.51 (latest)
Version 2.0.0-beta.2 (2.0.0-beta.2.398)
Most likely related, await
ing a call to web3.eth.sendSignedTransaction
the Promise never resolves in 1.0.0-beta.51
. It did resolve correctly on the receipt in 1.0.0-beta.50
Same here. Here is a failing test to demonstrate the issue with sendTransaction
on ganache
not sure if it's related but it seems not to resolve nor reject on VM error either (running on ganache-cli
version 6.4.1).
This test times out on await receipt
which is executing a contract tx which reverts.
update: I tried it today with beta.52 (latest)
again and still don't get a receipt.
@hbrs Thanks for answering here!:)
Did you configure the transaction confirmation workflow as documented in our documentation?
What kind of node are you using and which provider?
I tried with beta 55 and web3.eth.sendTransaction() is still not resolving and no receipt. I'm using Infura websocketprovider
@nivida @JonahGroendal I can confirm that in beta 55 this issue is fixed when setting the options defined above, but I would kindly want to ask for additional information on the docs:
transactionConfirmationBlocks
, transactionBlockTimeout
and transactionPollingTimeout
when web3 is and when it is not connected to the mainnet? I couldn't find this anywhere.on("receipt")
PromiEvent gets fired?Also, another issue I have is with the synchrony between the receipt
PromiEvent and the value returned by web3.eth.getTransactionReceipt
. Even if the latter returns a non-null value for a given transaction hash, it can take up to 10 seconds and more for the former PromiEvent to be fired.
Is this related or should I open a new issue?
@PaulRBerg It's working for me now after initializing like this: ''' new Web3( new Web3.providers.WebsocketProvider("wss://kovan.infura.io/ws/v3"), undefined, { transactionConfirmationBlocks: 1 } )'''
Default value of transactionConfirmationBlocks is 24 by default: https://github.com/ethereum/web3.js/blob/5683436b1dae70fce72a2ff952736e687998fd7f/packages/web3-core/src/AbstractWeb3Module.js#L53
You might want to just wait or lower it. For those on local dev chains you want transactionConfirmationBlocks = 1 because blocks are not created after the one including the TX, so the receipt is never fired.
Description
After deploying a new contract I never receive a
receipt
object.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
1.0.0-beta.51 (latest)
6.3.0 (latest)
Chromium
instance: Geth/v1.8.23-stable-c9427004/linux-amd64/go1.11.5