Substrate错误码1012「Transaction is temporarily banned」的含义及相关疑问
When you encounter the Substrate chain error:
{code: 1012, message: "Transaction is temporarily banned"}
This indicates your transaction is being held (typically in the Substrate Runtime's mempool or a similar component), but the official code comments in core/rpc/src/author/errors.rs and core/transaction-pool/graph/src/errors.rs don't clearly outline the exact triggers or final outcomes. Let's break down your key questions and common scenarios:
Key Questions Answered
Is this triggered by too many transactions from one account, IP, or other entity hitting a threshold?
This is the most likely cause. Substrate's transaction pool includes anti-spam mechanisms that can temporarily restrict transactions if:- A single account sends too many transactions in a short window
- An IP address makes excessive transaction submission requests
- Your transaction has an extremely low gas price, marking it as low-priority "spam" that gets throttled
These limits are designed to prevent the mempool from being overwhelmed.
Is the transaction actually invalid?
Probably not. This error specifically uses "temporarily banned"—it's distinct from errors that flag invalid transactions (like bad signatures, insufficient balance, or invalid call parameters, which return explicit error codes). Your transaction is likely structurally valid, just temporarily blocked from processing.Does "temporary" mean the transaction is valid but delayed? How long will the delay last?
Yes, "temporary" confirms this is a delay, not a permanent rejection. The exact wait time varies based on a few factors:- Chain configuration: Different Substrate-based chains can customize their mempool limits and unban timers
- Trigger reason: If you hit a rate limit, you'll usually be able to resubmit or see the transaction process within a few minutes. If the mempool is congested, you may wait until higher-priority transactions are cleared
- Transaction priority: Increasing your transaction's gas price can help it move up the queue and bypass the temporary restriction faster
Additional Tip
If you wait a reasonable amount of time and the transaction still hasn't processed, try resubmitting it (double-checking the signature and parameters are correct) or adjusting the gas price to boost its priority.
内容的提问来源于stack exchange,提问作者T9b

