GithubHelp home page GithubHelp logo

Comments (12)

stvenyin avatar stvenyin commented on June 12, 2024 1

use this method appaer
Error: replacement transaction underpriced

from ethers-ens.

ricmoo avatar ricmoo commented on June 12, 2024

Heya jadster,

So, ethers-ens does not store any nonce information anywhere. It queries the ethereum node (using provider.getTransactionCount(address, 'pending')) every time you try to send a transaction.

The problem is likely the transaction was accepted by your node, and so when asked what nonce to use, it is considering that pending transaction to be valid, so the next nonce is +1 more than you want (since you are in fact trying to replace a transaction).

To solve this, if things are getting gummed up, it's gummed up in the mempool of your Etehreum node. If you restart it, it should only make one last request to broadcast the transaction, and hopefully remove it from the mempool.

There is another issue I have open for the backspace problem, it will likely require upstream fixed in readline-sync.

But if you enter a wrong password, literally nothing else happens. Without the correct password, it cannot decrypt the wallet file, cannot sign any transaction and does not (and cannot) send a transaction.

The --nonce will be available soon, I often need it too when there is network congestion. If you make a pending transaction, and then wait until it shows up on etherscan (as pending), it is usually safe to then perform the next action, since it has been accepted by the network as "going to happen".

The other addition to --nonce will be that info will also display the pending and latest transactionCount.

from ethers-ens.

jadster avatar jadster commented on June 12, 2024

Just to be clear: I wasn't my goal to replace transaction. It's just that ethers-ens was (most likely) using a nonce for a new transaction that was already used by the last transaction pending. So it's trying to replace my last transaction, but with --cheap, so it doesn't even place the transaction, instead throwing the "underpriced" error.

A restart of geth did seem to help. It creeps up still occasionally...

from ethers-ens.

ricmoo avatar ricmoo commented on June 12, 2024

Right; all I mean is that ethers-ens simply asks geth what nonce it should use, and in the case you describe, geth tried to re-use a nonce.

The --cheap option changes the gas price, so if your geth is configured with a minimum gas price, it may get dropped by geth. I'm not exactly sure what geth does. I personally use parity. And for revealing bids, you can always submit the transaction (and query the nonce) directly from Etherscan and INFURA by omitting the --rpc option.

from ethers-ens.

jadster avatar jadster commented on June 12, 2024

I swear this "replacement transaction underpriced" (related to nonce count) has something to do with your script (not just geth). It keeps happening after something happens with your script. One time it was a wrong password. Other times it's trying to bid before auction is open ("name not up for auction yet; please "start" first"). And then I need to wait until all pending transactions are through before I can continue without the "replacement transaction underpriced" error.

I can't point you to the causal relationship, but it's hard to believe it's just chance.

Switching to normal mode without --rpc there is no such error, but it uses a nonce many numbers too low (i.e. multiple transactions with higher nonces are pending on etherscan). (as you mentioned infura seems to not always be up to date on the nonce-count either)

from ethers-ens.

ricmoo avatar ricmoo commented on June 12, 2024

My guess is it is largely to do with how geth handles lower gas prices. But, literally, if the wrong password is entered, nothing happens, the script just terminates, and even if it didn't there isn't ANYthing it could do, since the private key is never decrypted.

I think I will switch it to use Etherscan first, then fall back onto INFURA instead of the current, otherway around.

INFURA seems to be more pessimistic as to whether a transaction will succeed or not.

Have you tried parity out? I have used ethers-ens to secure nearly 100 domains, and haven't ever seen that error.

I also wait until I see my tx show up as pending on etherscan before issuing the next operation with a given account.

from ethers-ens.

jadster avatar jadster commented on June 12, 2024

Thanks for your quick answers. I've tried Parity, but as I understand Mist only works with geth (right?), and I'm still using Mist for names with german Umlauts...

I tried going back to normal mode without --rpc. And I made sure the transaction shows up on etherscan before transmitting another.
=> I don't get the "replacement transaction underpriced" error. But instead it keeps using a nonce that's too small... So this way I don't even see that it ain't going to work until things play out on etherscan...
I don't know where the problem lies but it's kind of annoying nts.

I've noticed though that the "eth.getTransactionCount(eth.accounts[n], 'pending')" command in "geth attach" console has the same irregular behavior where the number keeps jumping around from lower nonce numbers to the correct ones (without the number of pending transactions changing in the meantime). I'd say this might be a geth issue, or something with the javacript console, but as just described, things aren't smoothe when using infura either. (?)

from ethers-ens.

jadster avatar jadster commented on June 12, 2024

The registrar dapp must use a different method to determine the nonce.
I can successfully submit new transactions via the registrar dapp (in Mist) with a consecutive number (without reusing a nonce), eventhough the command "eth.getTransactionCount(eth.accounts[3], 'pending')" is giving me a number that's too low.

(Mist is, though, using a standard gas price).

from ethers-ens.

ricmoo avatar ricmoo commented on June 12, 2024

I think Mist manages the nonce for you; when it starts up it memorizes the current pending transactionCount, and likely never looks it up again, just nonce++ every time it sends a transaction.

It may occasionally sync against eth.getTransactionCount(address, 'latest'), but if you had multiple applications running against your Geth node, it would get confused. But for these days, that isn't an issue.

It may also skip building a transaction entirely, and just use the eth.sendTransaction call, and let the node use information the node itself doesn't expose over JSON-RPC.

I still plan to add a --nonce option though, as it is useful (sometimes you want to replace something, sometimes you know the nonce better than the Ethereum node does).

from ethers-ens.

jadster avatar jadster commented on June 12, 2024

looking forward to --nonce :-)

from ethers-ens.

ricmoo avatar ricmoo commented on June 12, 2024

The --nonce feature has now been added. ethers-ens info wallet.json will also show the latest and pending transaction count to help determine the nonce to use.

There is also a new --gas-price PRICE option that lets you specify the gas price (in GWei) you wish to use, so it is much easier to override transactions that have not yet been mined.

Try it out and let me know if you have any issues. I've used it a few times now to recover from the random ICO's plaguing the network.

from ethers-ens.

ricmoo avatar ricmoo commented on June 12, 2024

That’s means you are using a nonce that is already been used, but not mined.

You can either increase the gas price with the same nonce, which will replace the pending transaction or you can increase the nonce which will wait until the pending tx is mined.

If you increase the gas price, it must be 50% + 1 wei or higher.

from ethers-ens.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.