-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to custom nonce ? #37
Comments
hello @cctanfujun Right now you have to assemble a transactions manually or by help of transaction intermediate and then set the nonce guard case .success(let tx) = transactionIntermediate.assemble(options: someOptions, onBlock: "pending") // may fail, that would mean that gas estimation failed, for example
var txCopy = tx
txCopy.nonce = BigUInt(1337)
let result = web3.eth.sendTransaction(txCopy, options: someOptions, password: "web3swift") |
@cctanfujun did solve your task? |
i finally always set nonce manual,but i think it's difficult and not elegant |
@cctanfujun thanks for the update. Are any ideas, how to make it easier? @shamatar 's solution looks pretty straightforward. Is your code open source or can you show an example? We can check if there is a better solution. |
I'm having the same problem. One way to fix it would be that the transaction count is increased/persisted locally (by web3swift) each time a transaction is successfully broadcast. Now it seems to rely on the |
Having local in-memory mapping for account nonces is actually in the work for 2.0. There we will implement internal event loop and extendable pipeline, so you can easily provide hooks at different stages of transaction lifetime.
…________________________________
From: Matija Kregar <notifications@github.com>
Sent: Friday, October 26, 2018 5:39:31 PM
To: matterinc/web3swift
Cc: Alexander; Mention
Subject: Re: [matterinc/web3swift] how to custom nonce ? (#37)
I'm having the same problem.
One way would be that the transaction count is increased/persisted locally (by web3swift) each time a transaction is successfully broadcast.
Now it seems to rely on the eth_getTransactionCount response, which is the same for 2 consecutive transactions in a short time. This means that the second transaction will be rejected with the Transaction with the same hash was already imported. error.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#37 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AGKv93cA_U05VujKgsc_wJ82U0OwsQrDks5uox6jgaJpZM4WrKcQ>.
|
@shamatar any estimates about estimation of release web3swift 2.0 ? 😉 |
Everything done in 2.0 |
create two transaction in a short time,will cause replacement error due to same nonce,so how to create
custom nonce transcation?Thank you!
The text was updated successfully, but these errors were encountered: