I want to block users from performing certain actions on my platform when the NFT token they own is under an active transaction i.e., pending transaction. The reason is simple because we don't know who's going to be the ultimate owner of that token.

To solve this, I need to query the blockchain to find out if there are any pending transactions for a tokenID. Example: Let's say I am providing a service to encourage buying crypto kitties. To do that I let users play a game or make money by some other means on my platform if they own a Cryptokitty with tokenID #123. They come to get the service and earn money, but their token has a pending transaction, I'd like to wait before letting them use the services on the platform.

I have no issues coupling the system to a full node provider or querying service like Moralis, Alchemy etc.

1 Answer 1


I would say it's not a good arch design.

  1. you cannot control how long would transaction stay in mempool. It could be seconds, hours, days.
  2. if user has a pending transaction, it cannot create a new one. It's because of nonce, which has to be uninterruptedly incremental. For it to keep using your on-chain service, it would have to cancel the pending transaction or create a new one with same nonce, which would "cancel" the previous.

In your case, I would restrict access to certain functionality based on the ownership of a NFT. If user owns NFT at the moment of tx execution, its allowed to process. If not, tx would fail. No need to query mempool.

  • Yeah, but let's say they exploit services right after setting their NFT up for sale. As soon as their transaction goes to a pending state they can start exploiting the service till the next owner gets it. To the next owner, nothing would be left to use. Oct 21, 2021 at 22:47
  • I see. In that case, I would try to somehow snapshot the current NFT state (hash of the state could be enough) and include that snapshot into transaction. In that case, when attacker tries to front-run somebody he/she would change the token state and user transaction would fail. I don't think scanning mempool is possible from EVM.
    – ashhanai
    Oct 23, 2021 at 11:19

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.