Replies: 1 comment 1 reply
-
|
This is more of a Node Provider/RPC intricacy than a Viem one.
This may be expected. The Node will place this transaction in a mempool (pool of transactions yet to be broadcast onchain) and give you a transaction hash. Subsequent writes would be failing as it would likely be waiting for the "failing" transaction to be included on the block. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Check existing issues
Viem Version
2.37.5
Current Behavior
After the first reverted transaction, the following write functions — which should succeed — return transaction hashes that do not exist on-chain.
These transactions appear to hang indefinitely (remain pending) and fail to broadcast new transactions. Eventually, waitForTransactionReceipt throws a timeout error on the ghost hash.
Restarting the server temporarily resolves the issue.
After the first 30 seconds, nothing else happens in the video — it’s mainly to show that it keeps hanging for quite a while.
viem.repro.mp4
Expected Behavior
In my demo video, the pause action should work, because the token state is currently set to unpaused.
Steps To Reproduce
Start the NestJS server.
Call
POST http://localhost:3000/token/0x914dba91dd57d68c9e2826c9e2007ec6bb3d79ec/unpause→ This correctly returns a revert error, since the token is already Unpaused.
Then call
POST http://localhost:3000/token/0x5b782861155c3e18081b0c77edc2a4de591547ff/pause→ This call logs a transaction hash, but that hash cannot be found on the Polygon Amoy block explorer.
After step 2, all subsequent write calls remain pending or fail to broadcast properly until the process is restarted.
Link to Minimal Reproducible Example
https://github.com/Nielss01/viem-write-txhash-error
Anything else?
Summary
When a writeContract call (e.g. unpause) fails on-chain (reverts), I still receive a transaction hash. However, that hash does not exist on-chain (cannot be found on the explorer).
After this “ghost” transaction, all subsequent writes from the same walletClient:
The issue seems to occur likely in writeContract itself, nonce handling, or the underlying transport.
Beta Was this translation helpful? Give feedback.
All reactions