Is BSC "mempool" has a limitation?

In some hot presale, IDO, ILO,… it’s literally a gas war and a lot of transaction will be send to bsc node in that time lead to congestion. Some of my tx was like “ignored”, it’s not appeared in bscscan although my gas gwei is pretty high. Anybody know how bsc validator work like the maximum capacity of mempool, how it prioritizes transactions,…
And when my tx is reverted by the evm, it just throw “Error: Transaction has been reverted by the EVM” and an object like this:
{ “blockHash”: “0x901bc06579c0054aaecd1da708fa83e56f3d9fd3ea920ad76e73ba0fc5746164”, “blockNumber”: 10649933, “contractAddress”: null, “cumulativeGasUsed”: 19952894, “from”: “0x3b4f8c05b11d106d32dd7b2acd6f4a464695285e”, “gasUsed”: 34626, “logs”: [], “logsBloom”: “0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000”, “status”: false, “to”: “0xc06ac1b96609fb8b01e3cb64d19fcbd6605039e3”, “transactionHash”: “0xc2b643e34f4bf2ed71c0e3c029915f8053cb477f8560283bfdae9068b50a89ae”, “transactionIndex”: 123, “type”: “0x0” }
I don’t know how to debug with the same error like this everytime my tx is failed.
Sorry for my bad english


It looks like smart contract reverted with this error: Fail with error 'NOTHING TO WITHDRAW'

I know, but I is there any way to show that “NOTHING TO WITHDRAW” in my throw exception?

I know only how to do it in python for now:

from web3 import Web3

speedy_node = 'https://speedy-nodes-nyc.moralis.io/vvvvvvvvvv/bsc/mainnet/archive'
web3 = Web3(Web3.HTTPProvider(speedy_node))
print(web3.isConnected())


from_ = web3.toChecksumAddress('0x3b4f8c05b11d106d32dd7b2acd6f4a464695285e')
to_ = web3.toChecksumAddress('0xc06ac1b96609fb8b01e3cb64d19fcbd6605039e3')
try:
    y = web3.eth.call({
        'from': from_,
        'to': to_,
        'data': '0xfe8121de'}, block_identifier=10649933)
except Exception as e:
    print(repr(e))

=> ContractLogicError('execution reverted: NOTHING TO WITHDRAW')

Hey @spider149

Take a look at:
https://web3js.readthedocs.io/en/v1.2.5/web3-eth.html#handlerevert

web3.eth.handleRevert = true;
try {
    await contract.methods.method().call();
} catch (e) {
    const data = e.data;
    console.log(data)
}

Thank you all for answering me, If you are using python, try @cryptokid solution, I’m not checking it yet :slight_smile: And if you are using js and have the same problem with me, set web3.eth.handleRevert to true, but in my case, my exception not have “data” field, instead it have “reason” field, you can log the full err to get all of its field.
But I’m still wondering about “BSC congestion”, may I will try it tonight when a hot IDO launch, I will reply this comment if I know the answer.

Update: I don’t know why, but with handlerevert, some return the “reason” field, some not although in bscscan, it’s show the error clearly.

You may have to specify the block_identifier parameter in some cases, and you may have to use an archive node if you are not using that. [only if you try to do transaction replay]

I just want to log clear reason for user when a transaction is failed, with js try catch, I can only get “Transaction has been reverted by the EVM”, and it’s hard to debug.

python HTTP POST request version:

import requests
import json

headers = {
    "Content-Type": "application/json"
    }

speedy_node = 'https://speedy-nodes-nyc.moralis.io/vvvvvvvvv/bsc/mainnet/archive'


post_data = '{"jsonrpc": "2.0", "method": "eth_call", "params": [{"from": "0x3B4F8C05b11D106D32Dd7B2acd6F4a464695285e", "to": "0xC06aC1B96609FB8B01E3cB64D19fcBd6605039e3", "data": "0xfe8121de"}, "0xa2814d"], "id": 1}'
statusResponse = requests.request("POST", speedy_node, headers=headers, data=post_data)


data = statusResponse.json()
print(json.dumps(data, indent=4))

=>

{
    "jsonrpc": "2.0",
    "id": 1,
    "error": {
        "code": 3,
        "message": "execution reverted: NOTHING TO WITHDRAW",
        "data": "0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000134e4f5448494e4720544f20574954484452415700000000000000000000000000"
    }
}

maybe it’s just show the full error with archive mode, is there any difference between a normal node and archive node? thank you.

I think that a regular node keeps only last N minted blocks.