3

As I study the different low level tools provided that enable us to interact with the Solana networks, some functionality appears to be found in the Solana CLI that is not available in the Solana JSON RPC API and vice versa.

For example, I have found that the Solana CLI is able to give me a history of transaction signatures when providing a wallet address using the transaction-history subcommand, but it does not appear to have a way to view transaction detail for a given transaction signature. Complementary to this, the Solana JSON RPC API does not appear to have a way to get the history of transaction signatures for a given wallet address, but it does have the getTransaction call that retrieves details for a given transaction signature.

Is there an underlying principle behind what types of functionality exist in one and not the other? Knowing this can help with understanding the respective problem domain between the usage of Solana CLI vs Solana JSON RPC API and inform when to use one or the other.

Edit: It looks like the CLI can provide transaction details via solana confirm -v <transaction signature>, so my example isn't perfect, but my question is still good.

2 Answers 2

4

The CLI uses JSONRPC via the solana-client Rust crate. Everything it does is either available from, or derivable from, JSONRPC method calls

1
  • This answer explains why there is an airtight guarantee that JSONRPC contains everything ever needed between the two and helps me reason that I only ever need to use JSONRPC from within my applications.
    – OCDev
    Jul 20, 2022 at 1:24
1

So far I did not find anything that was not available in the JSON RCP API so I would assume they are in sync.

For the transaction history you can use: getSignaturesForAddress which gives you a list of all the signatures.

Is there anything else you could not find in the JSON RPC API?

1
  • 1
    Helping me identify that getSignaturesForAddress gives me what the CLI transaction-history provides was helpful. Thanks!
    – OCDev
    Jul 20, 2022 at 1:25

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.