3

Is there a technical way to see the movements between accounts that are generated during a transaction?

For example, for this transaction from the devnet, all I can see is the balance of accounts before and after the transaction, but I can't see what actual transfers took place.

Sometimes it's easy to decode instructions, like Token Program: Transfer, where I can see that 0.000012500 SOL is being transferred from 7hkp1x... to Bs7iZq1...

But other times, to understand what's happening in a transaction, it seems like I need to know some implicit rules:

  • The fee is paid by the first signer.
  • The remaining SOL in a closed account will be returned to the account's owner.
  • ...

Are there any more rules I need to know about?

Is there an online or offline tool that can decode a transaction and give me a list of movements between accounts?

I am looking for something like

0.000012500 SOL from 7hkp1x... to Bs7iZq1...
{
  "jsonrpc": "2.0",
  "result": {
    "blockTime": 1682290069,
    "meta": {
      "computeUnitsConsumed": 91596,
      "err": null,
      "fee": 5028,
      "innerInstructions": [
        {
          "index": 2,
          "instructions": [
            {
              "parsed": {
                "info": {
                  "amount": "12500",
                  "authority": "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd",
                  "destination": "7hkp1xfPBcD2t1vZMoWWQPzipHVcXeLAAaiGXdPSfDie",
                  "source": "Bs7iZq12cZ8SoAMHEP6RpRfDozahXzK1z93d2ybMf98U"
                },
                "type": "transfer"
              },
              "program": "spl-token",
              "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
            }
          ]
        }
      ],
      "logMessages": [
        "Program ComputeBudget111111111111111111111111111111 invoke [1]",
        "Program ComputeBudget111111111111111111111111111111 success",
        "Program ComputeBudget111111111111111111111111111111 invoke [1]",
        "Program ComputeBudget111111111111111111111111111111 success",
        "Program SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f invoke [1]",
        "Program log: Instruction: CrankPop",
        "Program log: Initiating Crank Pop @ 1682290069 = [1682290069, GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR]",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
        "Program log: Instruction: Transfer",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4736 of 120469 compute units",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
        "Program data: 3YmPcncfeTHsgRBREqJX1h30z18T7gobAZGXyMU0O08qfsiEauIsGgMAAAAzCSWyuI1Y9l/I/sP4wgQIzZBFP0jqxC+h1K0fq5cfVsVmWIg6Bq5F7n9c8PAkINeJKRDo7lhilbvb5zYbp/Z1ZC3ANrOOk9B3RZy6B/HfETUFLqc7rBdRpQMcbrDRitsGAAAAwPlvaj4QD5STRKD7TulGDasTQFpkxsL3JrN/eR1YH8pYhPKmgQDi6my6NPnr0oa4eqSVRLlRNBqZnFhZMEdY0cqDIRtzJMjWbzWkQjDVeEfKflse83Q7LfdsJAl8/KgCzuhBOW9qyhbG3OnFvAGoX6DAx+LkThkif+BEyrvB+fn5+Us/iBHepRKk+t72s+F2k1bsd/crAx3lG44EfEluEccmZZpYu4XIcDA/WlyKvvkiZeT3H2pzhucHeCwskLvNidUQawoAAAATpSd3nxNOohQ/gzVLel8yyUXRhrRI/BYyeGGhwPd6+A==",
        "Program SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f consumed 91596 of 200000 compute units",
        "Program SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f success"
      ],
      "postBalances": [
        1730670979484,
        3480000,
        292673389280,
        37579509283,
        3480000,
        3480000,
        3480000,
        27693840,
        44747965093,
        39571619243,
        27693840,
        4043760,
        3897600,
        279346560,
        42184440118,
        4043760,
        27693840,
        4043760,
        4043760,
        9723120,
        27693840,
        1,
        1001000000,
        223666560,
        747729315002,
        1141440,
        934087680
      ],
      "postTokenBalances": [
        {
          "accountIndex": 2,
          "mint": "So11111111111111111111111111111111111111112",
          "owner": "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd",
          "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "uiTokenAmount": {
            "amount": "292671350000",
            "decimals": 9,
            "uiAmount": 292.67135,
            "uiAmountString": "292.67135"
          }
        },
        {
          "accountIndex": 3,
          "mint": "So11111111111111111111111111111111111111112",
          "owner": "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd",
          "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "uiTokenAmount": {
            "amount": "37577470003",
            "decimals": 9,
            "uiAmount": 37.577470003,
            "uiAmountString": "37.577470003"
          }
        },
        {
          "accountIndex": 8,
          "mint": "So11111111111111111111111111111111111111112",
          "owner": "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd",
          "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "uiTokenAmount": {
            "amount": "44745925813",
            "decimals": 9,
            "uiAmount": 44.745925813,
            "uiAmountString": "44.745925813"
          }
        },
        {
          "accountIndex": 9,
          "mint": "So11111111111111111111111111111111111111112",
          "owner": "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd",
          "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "uiTokenAmount": {
            "amount": "39569579963",
            "decimals": 9,
            "uiAmount": 39.569579963,
            "uiAmountString": "39.569579963"
          }
        },
        {
          "accountIndex": 14,
          "mint": "So11111111111111111111111111111111111111112",
          "owner": "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd",
          "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "uiTokenAmount": {
            "amount": "42182400838",
            "decimals": 9,
            "uiAmount": 42.182400838,
            "uiAmountString": "42.182400838"
          }
        }
      ],
      "preBalances": [
        1730670984512,
        3480000,
        292673376780,
        37579509283,
        3480000,
        3480000,
        3480000,
        27693840,
        44747977593,
        39571619243,
        27693840,
        4043760,
        3897600,
        279346560,
        42184440118,
        4043760,
        27693840,
        4043760,
        4043760,
        9723120,
        27693840,
        1,
        1001000000,
        223666560,
        747729315002,
        1141440,
        934087680
      ],
      "preTokenBalances": [
        {
          "accountIndex": 2,
          "mint": "So11111111111111111111111111111111111111112",
          "owner": "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd",
          "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "uiTokenAmount": {
            "amount": "292671337500",
            "decimals": 9,
            "uiAmount": 292.6713375,
            "uiAmountString": "292.6713375"
          }
        },
        {
          "accountIndex": 3,
          "mint": "So11111111111111111111111111111111111111112",
          "owner": "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd",
          "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "uiTokenAmount": {
            "amount": "37577470003",
            "decimals": 9,
            "uiAmount": 37.577470003,
            "uiAmountString": "37.577470003"
          }
        },
        {
          "accountIndex": 8,
          "mint": "So11111111111111111111111111111111111111112",
          "owner": "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd",
          "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "uiTokenAmount": {
            "amount": "44745938313",
            "decimals": 9,
            "uiAmount": 44.745938313,
            "uiAmountString": "44.745938313"
          }
        },
        {
          "accountIndex": 9,
          "mint": "So11111111111111111111111111111111111111112",
          "owner": "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd",
          "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "uiTokenAmount": {
            "amount": "39569579963",
            "decimals": 9,
            "uiAmount": 39.569579963,
            "uiAmountString": "39.569579963"
          }
        },
        {
          "accountIndex": 14,
          "mint": "So11111111111111111111111111111111111111112",
          "owner": "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd",
          "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "uiTokenAmount": {
            "amount": "42182400838",
            "decimals": 9,
            "uiAmount": 42.182400838,
            "uiAmountString": "42.182400838"
          }
        }
      ],
      "rewards": [],
      "status": {
        "Ok": null
      }
    },
    "slot": 211137537,
    "transaction": {
      "message": {
        "accountKeys": [
          {
            "pubkey": "2KgowxogBrGqRcgXQEmqFvC3PGtCu66qERNJevYW8Ajh",
            "signer": true,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "5kSxpX1Tbe5rid219eWVkdPnjCpQXRoHUDueWe8WpPzk",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "7hkp1xfPBcD2t1vZMoWWQPzipHVcXeLAAaiGXdPSfDie",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "7RBSc6NBvpwcF9XXAbrn5WLgx14XGX6fHXChyEgR38Vu",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "8WwgiLmFZP344Xd7SpfGs3c2ZpnLMUH6EQZVyBeowsTm",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "9gu3tri7UbW8cLsFDMQP7mEsYdEh2d4bvijWtmw81YYo",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "B7ZMMzxZ4AYSqxQattFKgPDoVAcYwey4hCSrFzHnkUFh",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "BjUgj6YCnFBZ49wF54ddBVA9qu8TeqkFtkbqmZcee8uW",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "Bs7iZq12cZ8SoAMHEP6RpRfDozahXzK1z93d2ybMf98U",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "BwRNHbPu5cyo5SEoda71HcMFPt8b53fDzdDjcadLbe6s",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "CdvmFaR2m3cL2YuDg9cSb2m3nKZX26vyVoBbB8aNMWaj",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "ChBRNDsRkz8em1fopNaMEZGUuozaNEtcNU9YdKLebbco",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "crnKsPsuP6f7uiDbAYYw66h2RNBrqoazmtZHwazkC6V",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "dBufw5cfPqte3VtsAcbvwA2b3fsCXgck4dsAc7mU51R",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "FdPFrUhiZ8rbxMAiWrWdnxuUwro87oXiLbzjNHVGqjdr",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "Guwy9H6dWLPxUGU1ZTga85vsyLW5LfM4WL2wGvoP3LmT",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "HwWkCcurmxfVjM3WHfBDDeqJRhueN4hqSkrwfAGVDMmP",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "HyPJSJhV1bzkeSoYkJComxwYzseP7LYpsgkabZhhizLz",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "PeRMnAqNqHQYHUuCBEjhm1XPeVTh4BxjY4t4TPan1pG",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "WMW5xc3HypXwTnPesyUT49uLsyHwNURsWAEk39onKuk",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "ComputeBudget111111111111111111111111111111",
            "signer": false,
            "source": "transaction",
            "writable": false
          },
          {
            "pubkey": "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd",
            "signer": false,
            "source": "transaction",
            "writable": false
          },
          {
            "pubkey": "dBufSqtKN59Whpq3oeh6pyxJm1yzpf9XJTTubTKVQtf",
            "signer": false,
            "source": "transaction",
            "writable": false
          },
          {
            "pubkey": "So11111111111111111111111111111111111111112",
            "signer": false,
            "source": "transaction",
            "writable": false
          },
          {
            "pubkey": "SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f",
            "signer": false,
            "source": "transaction",
            "writable": false
          },
          {
            "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
            "signer": false,
            "source": "transaction",
            "writable": false
          }
        ],
        "addressTableLookups": null,
        "instructions": [
          {
            "accounts": [],
            "data": "3csjmdxWs7vf",
            "programId": "ComputeBudget111111111111111111111111111111"
          },
          {
            "accounts": [],
            "data": "Fj2Eoy",
            "programId": "ComputeBudget111111111111111111111111111111"
          },
          {
            "accounts": [
              "crnKsPsuP6f7uiDbAYYw66h2RNBrqoazmtZHwazkC6V",
              "PeRMnAqNqHQYHUuCBEjhm1XPeVTh4BxjY4t4TPan1pG",
              "2KgowxogBrGqRcgXQEmqFvC3PGtCu66qERNJevYW8Ajh",
              "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd",
              "7hkp1xfPBcD2t1vZMoWWQPzipHVcXeLAAaiGXdPSfDie",
              "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
              "dBufw5cfPqte3VtsAcbvwA2b3fsCXgck4dsAc7mU51R",
              "dBufSqtKN59Whpq3oeh6pyxJm1yzpf9XJTTubTKVQtf",
              "So11111111111111111111111111111111111111112",
              "WMW5xc3HypXwTnPesyUT49uLsyHwNURsWAEk39onKuk",
              "5kSxpX1Tbe5rid219eWVkdPnjCpQXRoHUDueWe8WpPzk",
              "7RBSc6NBvpwcF9XXAbrn5WLgx14XGX6fHXChyEgR38Vu",
              "8WwgiLmFZP344Xd7SpfGs3c2ZpnLMUH6EQZVyBeowsTm",
              "9gu3tri7UbW8cLsFDMQP7mEsYdEh2d4bvijWtmw81YYo",
              "B7ZMMzxZ4AYSqxQattFKgPDoVAcYwey4hCSrFzHnkUFh",
              "BjUgj6YCnFBZ49wF54ddBVA9qu8TeqkFtkbqmZcee8uW",
              "Bs7iZq12cZ8SoAMHEP6RpRfDozahXzK1z93d2ybMf98U",
              "BwRNHbPu5cyo5SEoda71HcMFPt8b53fDzdDjcadLbe6s",
              "CdvmFaR2m3cL2YuDg9cSb2m3nKZX26vyVoBbB8aNMWaj",
              "ChBRNDsRkz8em1fopNaMEZGUuozaNEtcNU9YdKLebbco",
              "FdPFrUhiZ8rbxMAiWrWdnxuUwro87oXiLbzjNHVGqjdr",
              "Guwy9H6dWLPxUGU1ZTga85vsyLW5LfM4WL2wGvoP3LmT",
              "GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR",
              "HwWkCcurmxfVjM3WHfBDDeqJRhueN4hqSkrwfAGVDMmP",
              "HyPJSJhV1bzkeSoYkJComxwYzseP7LYpsgkabZhhizLz"
            ],
            "data": "2o2JNCMcp6ZiBGiKfP4HNb9ZNDNjgJm9N5DKmZ4rg6aSJVku78UXNLJJDXuJTqLdbnDTjb6zE5Myr",
            "programId": "SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f"
          }
        ],
        "recentBlockhash": "3UktfghwEwk4VTBKRbURQ9QGTj4vRTSr3JvSTJSkUHYo"
      },
      "signatures": [
        "5bsTW7HW5jmAq4o3SrsNAXxq72URY2Aw4xJ5mqcDiLPFfHc9bYXPmZN35XcYgAyN6beekVAZcFHqh1G4379Aehep"
      ]
    },
    "version": "legacy"
  },
  "id": "80f845e4-adc8-4049-ae2c-cccfb5339d84"
}

1 Answer 1

1

I also had this problem before its difficult to figure out. There is one more case which is when a transfer in a program is done via

**ctx
 .accounts
 .chest_vault
 .to_account_info()
 .try_borrow_mut_lamports()? += something;

Then you also wouldnt see it as a transfer, but it may be a transfer from a pda to a wallet. You could try https://xray.helius.xyz/ and see if it shows what you want. Here is the api they are using: https://docs.helius.xyz/solana-apis/enhanced-transactions-api/parse-transaction-s

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.