Is there something equivalent to w3.eth.getTransaction(txHash)
, for Substrate based chains using python?
1 Answer
Transaction hashes have a different meaning in Polkadot than in Ethereum.
Ethereum TX hashes uniquely identify a transaction in a Block.
TX hashes in Polkadot are not necessarily unique. They are calculated from the function name and its argument values. So they identify a Transaction regardless of whether it's inside a block or not.
Many Polkadot Transactions will therefore share the same hash.
Transactions in Polkadot are identified by their block-number and the index that they have in that block. For example #11831228-2 is transaction 2 in Block 11831228.
Have a look at py-substrate-interface which has an example on how to list the extrinsics of a block.
-
There is indeed as far as I know no index available to lookup extrinsic by its hash in the Substrate RPC. You will need a third-party indexer for that– ArjanCommented Sep 8, 2022 at 18:29