I'm trying to get transaction history (ie. transfers) using just the account id. From my understanding the only way this can be done is if you go through every single block and look up the transaction and see if it matches up with the account number. Is there a better way to do this and is there a way to do it without the use of some sort of database to store all the transaction of the blockchain?


3 Answers 3


Typically no. Best to use an indexing database on the side like https://github.com/paritytech/substrate-archive . This is in part because the minimal amount of resources possible is wanted to be used in the runtime and the state it operates on. The runtime is not typically referring to historical state only the present state to progress to the next.


Substrate unlike the Ethereum node for example doesn't offer any easy way to query historic state. Therefore I recommend using Subsquid archive (indexer) to store chain history, you can then use GraphQL to query anything you want.

Also you can extend archive with a processor that will allow to transform data per block into your application specific structure.

For example this is last 10 extrinsics that account signed:

query Recent {
     where: {signer: {_eq: "bXhxg5XurkmitqYGsPwGXQdXxQAKZYEaHvFjbVPY1kpLrW5ek"}},
     limit: 10, 
     order_by: {id: desc}
  ) {

You can play with it here.


You could use an indexer service in the cloud, where you can literally ask for all transactions made by a specific account ID.

This is a good post for reference:

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.