As it has been explained here, here and even here I proceed with computing number of confirmations for a given txid. It works but gives weird results which are not consistent with the block explorer.


receipt = w3.eth.get_transaction_receipt(txid)
result = _contract.events.Transfer().processReceipt(receipt, errors=DISCARD)

I obtain

        'from': '0x0000000000000000000000000000000000000000',
        'to': '******************************************',
        'tokenId': ***
    'event': 'Transfer',
    'logIndex': ***,
    'transactionIndex': **,
    'transactionHash': HexBytes('******************************************************************'),
    'address': '******************************************',
    'blockHash':    HexBytes('******************************************************************'),
    'blockNumber': 23504211

(I starred sensitive values) then using


I get


So following the current_block_number - tx_block_number we find this tx has 23542487 - 23504211 = 38276 confrimations which seems like a crazy large number. Just to compare, at the same time https://polygonscan.com/ indicates 346 confirmations.

screenshot of the polygon scan block explorer showing smaller number of confirmations

I find this super confusing. Anyone could clarify how number of confirmations is computed on the Polygon Network?


Is it possible that w3.eth.block_number gives me the current ETH block number and not Polygon block number even if I connected to Polygon RPC node?

1 Answer 1


Ok, that is a bit embarrasing, but it turns out I had a bug that was comparing wrong transaction hash, instead of previous one it was taking previous-previous one. Everything works fine, those numbers match, keep using Polygon!

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.