I created my own Pallet to save Student certificates, then I am reading the Storage to retrieve the certificates that I have stored in BC using Plokadot.js, this is the code for read the certificate from BC:

  let cerIds = await api.query.templateModule.certificateOwned(

  let cerDetails = await Promise.all(
    cerIds.map(async (id) => {
      return await api.query.templateModule.certificates(id);

In the Certificate, I am storing the following data :

  • Certificate ID
  • Student Information

I am not storing any data related to Transaction hash.

Now the question is:

How I can get the transaction hash for each certificate that has been stored in Storage, the purpose is I need to create URL pointing the transaction detail that can be viewed in https://polkadot.js.org/apps/#/explorer

  • 1
    I think we need more info to properly answer this question: Are you explicitly storing the hash of the transactions in the storage of your custom pallet? or is your question more about how to identify the transactions associated with the stored certificates?
    – Iker
    Commented Jan 25, 2023 at 17:31
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Jan 25, 2023 at 21:31
  • @Iker I add more info, and regarding your questions yes I am looking how to identify the transactions associated with the stored certificates?
    – Koptan
    Commented Jan 26, 2023 at 5:55

1 Answer 1


I think it is a better idea to store some information about the transaction itself if you are going to query it later as you are trying to.

Because otherwise you have to scan the Blockchain to try to find the extrinsic that make this storage change. You can do that using for example the Subscan API to query the events and filtering with the event your pallet emits after store the certificate or if you are not emitting events just querying the extrinsics.

But as I said is a better idea to store the information. You can store the Transaction Hash that you get after the signAndSend function if using PolkadotJS, or event better the unique identifier of the transaction which is the block# + the extrinsic index in that block (See here how to get it).

If you don't have the control of the DApp interacting with your pallet a good option would be to get the block number inside the code of your extrinsic call in your pallet and store it:

 let current_block_number = <frame_system::Pallet<T>>::block_number();

To store it you can add another field in your struct within Certificate ID, Student Information or have a separate StorageMap with accountId as key and the block number as value.

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.