4

I am performing a transaction to send an ERC20 and I keep getting this error:

ValueError: {'code': -32000, 'message': 'already known'}

I'm assuming this means that this transaction is already in the mempool or something? Looking for some clarifications though.

2 Answers 2

3

Partial answer...

I'm assuming this means that this transaction is already in the mempool or something?

Yes. From tx_pool.go:

// ErrAlreadyKnown is returned if the transactions is already contained
// within the pool.
ErrAlreadyKnown = errors.New("already known")

But it's not immediately clear from the code what conditions have to be met for this error to be set, so it's difficult to suggest a solution.

2
  • 1
    I think this is pretty much it. Just wanted others to be aware of what is going on when they run into this error. May 4, 2021 at 20:54
  • I think the nonce can be used to prevent the error, and it needs to be checked against the most recent older nonce.
    – Cristofor
    Jun 27, 2021 at 17:27
0

I was getting this error using github.com/ethereum/go-ethereum

First, make sure you are using the right nonce in the tx

nonce, err := client.PendingNonceAt(context, someAddress)

Then, make sure you are passing the right context to all your methods, including the one above

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.