How to get extrinsic details by extrinsic hash
See original GitHub issueIs there any way to get the transaction details through the transaction hash?
I used blockHash to find the whole block details, and query each of these transactions. Is there a better way?
let block = await api.rpc.chain.getBlock('*****')
block.block.extrinsics.forEach(ex=>{
console.log(''ex");
});
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
To get the extrinsic data from the extrinsic Hash
There are a couple ways you could work with that. If you have the extrinsic hash and the block number than you could...
Read more >Blocks | polkadot{.js}
A block hash refers to the hash over the header, the extrinsic hash refers to the hash of the encoded extrinsic. Since all...
Read more >Polkadot Protocol Information
The correct way to uniquely identify an extrinsic on a Substrate-based chain is to use the block ID (height or hash) and the...
Read more >Polkadot Extrinsic — hs-web3 0.8.0.0 documentation
Extrinsic is a piece of data from external world that proposed to be a part of blockchain ... If everything ok then you...
Read more >Block in sp_runtime::traits - Rust
It has types for `Extrinsic` pieces of information as well as a `Header`. ... You can get an iterator over each of the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, @crossle!
First, what do you mean by Block ID?
If you mean Block Height, then you can get the Block Hash first by using:
blockHash = await api.rpc.chain.getBlockHash(blockHeight)
, and then get the block by its hash with:block = await api.rpc.chain.getBlock(blockHash)
. The transactions (extrinsics) will be inside:block.block.extrinsics
.If you mean Block Hash, then start from the second code I wrote above.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.