Properly manage transaction nonces #28

Open
opened 2019-04-06 10:02:26 +00:00 by raucao · 2 comments
raucao commented 2019-04-06 10:02:26 +00:00 (Migrated from github.com)

See dcbce66796 for hotfix that doesn't really fix the underlying issue with ethers.js' wallet nonce management.

See dcbce66796669c96d931a70f0f2e3ba52437af31 for hotfix that doesn't really fix the underlying issue with ethers.js' wallet nonce management.
bumi commented 2019-04-06 11:20:24 +00:00 (Migrated from github.com)

can we do a eth_gettransactioncount on boot or regularly, store that number and then manually increment the nonce everytime we've sent a transaction?

something like (pseudo code):

let nonce = await provider.getTransactionCount('pending');
nonce++;
[contirbution1, contribution2].forEach(c => {
  await kredits.Contribution.add(attrs, {nonce});
  nonce++;
})
can we do a [eth_gettransactioncount](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactioncount) on boot or regularly, store that number and then manually increment the nonce everytime we've sent a transaction? something like (pseudo code): ```js let nonce = await provider.getTransactionCount('pending'); nonce++; [contirbution1, contribution2].forEach(c => { await kredits.Contribution.add(attrs, {nonce}); nonce++; }) ```
bumi commented 2019-04-06 11:26:33 +00:00 (Migrated from github.com)

we could maybe use ether.js's waitForTransaction to wait until the transaction is mined and then increment the nonce (or do a provider.getTransactionCount('pending') again) and then do the next transaction.

we could maybe use ether.js's `waitForTransaction` to wait until the transaction is mined and then increment the nonce (or do a `provider.getTransactionCount('pending')` again) and then do the next transaction.
raucao added the
bug
label 2025-01-23 21:26:16 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kredits/hubot-kredits#28
No description provided.