0

I sent 0.13 SOL from one ordinary wallet to other. There's been no interraction with a smart contract, nor was it a token but SOL sent.

Here's a part of a TX in its raw form which I've obtained via API:

"preBalances" => [
    9997940920,
    0,
    1,
    1
], 

"preTokenBalances" => [],

"postBalances" => [
    9867934320,
    130000000,
    1,
    1
], 
"postTokenBalances" => [], 
  • Why are there 4 items in the preBalances and postBalances instead of 1?

  • Although it's clear that one look at 130000000 as the new balance, why is this particular element? How to determine this?

What I need: given the address of a wallet, check whether it's been deposited any SOL or tokens on. In this particular case SOL

1 Answer 1

0

if you take a look at the transaction's json, you should also have an array of accounts. I think you have 4 accounts involved in your transaction (sender, receiver, and 2 solana core program account). The pre/post balance are displayed in the same order than accounts in the transaction (or instruction, i'm not sure, i have a doubt).

So you can check with the accounts array which wallet received sol / tokens.

You can also see that the first account was debited more than 0.13 sol, because there are transaction fees.

If you take a random transaction, there could be some difference in sol balance, it could also be linked to account creation. For example, if you send a token (nft, etc) to a wallet address that doesn't have the associated token account created yet, it has to be funded (0.002 sol or so).

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.