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.
Using
receipt = w3.eth.get_transaction_receipt(txid)
result = _contract.events.Transfer().processReceipt(receipt, errors=DISCARD)
I obtain
AttributeDict({
{
'from': '0x0000000000000000000000000000000000000000',
'to': '******************************************',
'tokenId': ***
},
'event': 'Transfer',
'logIndex': ***,
'transactionIndex': **,
'transactionHash': HexBytes('******************************************************************'),
'address': '******************************************',
'blockHash': HexBytes('******************************************************************'),
'blockNumber': 23504211
}
(I starred sensitive values) then using
print(w3.eth.block_number)
I get
23542487
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.
I find this super confusing. Anyone could clarify how number of confirmations is computed on the Polygon Network?
EDIT:
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?