I am currently looking to query historical transaction data for specific programs/wallets using the Solana CLI. The command I'm using, as an example, looks like this:

solana transaction-history --show-transactions --verbose --output json VoLT1mJz1sbnxwq5Fv2SXjdVDgPXrb9tJyC8WpMDkSp

This results in a set of output with instructions, accounts used, and data. I am trying to understand how to go from a data array like, [242, 35, 198, 137, 82, 225, 242, 182, 160, 54, 212, 57, 7, 0, 0, 0], to something that is human readable. Ideally being able to understand in cases where SPL tokens are involved, what the token mint is and how much of the token is moving.

1 Answer 1



This is a bit of a broad question, as there are several cases to consider, but the basic fact to understand is: the data field in an instruction is the arbitrary, serialized input given to the program.

What this means is that this data:

  • can be anything,
  • can be serialized in arbitrary ways, but
  • needs to be constructed and serialized in a way that matches what the program expects

Now to the original question of "how to process it to make it human-readable", it should become clear that it depends on the program you are looking at. You can consider 2 main categories:

Program developed using Anchor

Anchor is a framework that, among other things:

  • generates an Interface Definition Language (IDL) to describe the arguments/accounts required by all endpoints the program has,
  • standardizes the way data is serialized
  • makes available clients (JS, rust) which help with the encoding/decoding

So if the program you target is developed with Anchor and has an IDL published, you could use the BorschCoder (default utility to encode/decode data with Anchor) to decode the raw data, using the JS Anchor library, Anchorpy for python, or the program's rust library directly if it's available.

Other programs

Then there is no standard way, and the project itself might have some custom, OS helpers available, like Mango does. You can check these tests together with the functions it tests for to get an idea in Rust, or this for an example of how they do it in JS using the common buffer-layout library.

The Solana Cookbook seems to have extensive description of the process in different languages so my advice is give it a read.

Edit: I forgot to mention that there are dedicated Anchor Coders allowing deserialization of ix (and account) data for specific non-Anchor programs as well, such as SPL Associated Token, SPL, and System programs. They can be instantiated and used in a similar way to the default BorschCoder, and can be found here.

  • This is amazingly thorough, thank you! Gives me an extremely solid foundation on which to begin!
    – m2sa
    Jul 24, 2022 at 19:28

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.