For most transaction it is so difficult to find the source and destination of the transaction. as a program in Solana interact with multiple accounts. so how can I get the source and destination of the transaction just like Ethereum they give from and to in their object when I call web3.eth.getTransaction() here is an example: https://explorer.solana.com/tx/qTpMT3jAFkENF9uwkmLF9yX8btZwGyd3fhZb8R4g3LoBrzqVsugEXowdu5UQtJZG3mrjFJHCsEdwHqhqD7oTZbd

2 Answers 2


If you are talking about the transfer of funds, you will have to look at the Transfer inner instructions. There are 6 of them in your example.

Please note for accounts owned by a Program itself, it can adjust the balance without doing a Transfer CPI call so those will not be surfaced.


As an alternative, if you're fetching the transaction with getTransaction, you can look at the pre and post balances. For example, if this is the response for getTransaction:

  "jsonrpc": "2.0",
  "result": {
    "meta": {
      "err": null,
      "fee": 5000,
      "innerInstructions": [],
      "postBalances": [499998932500, 26858640, 1, 1, 1],
      "postTokenBalances": [],
      "preBalances": [499998937500, 26858640, 1, 1, 1],
      "preTokenBalances": [],
      "rewards": [],
      "status": {
        "Ok": null
    "slot": 430,
    "transaction": { // removed for brevity
  "blockTime": null,
  "id": 1

In the "meta", you can compare preBalances to postBalances, and preTokenBalances to postTokenBalances to see what tokens have moved.

More information about getTransaction at https://docs.solana.com/developing/clients/jsonrpc-api#gettransaction

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.