3

I have a question regarding the calculation of the XLM balance in this case: https://stellarchain.io/address/GATESQVJTO2QPFLLDS4VZQ3X6WX6FSICR6IFXIAMGMJYCMEE645KKTSM

The current balance is 1.99998, which is 0.00002 XLM too few if I add up the transactions and the ovbious fee for creating the account. I know it's very small, but I just would like to understand how it's calculated.

Imho it should be: 63619 (account created) + 0.00001 (payment received) + 0.5 (payment received) + 0.5 (payment received) + 0.5 (payment received) - 63618.5 (new account created) - 0.0001 (fee for new account created) = 2 XLM.

Can anyone explain what I'm missing? E.g. is there also a fee on the received payments for the receiver?

1

This is a really interesting case and indeed there seems to be 0.00002 XLM missing. How did you come up with this?

Now let's dig into this accounts transactions. You can get the raw data from a stellar-horizon server like the official one from the stellar foundation:

https://horizon.stellar.org/accounts/GATESQVJTO2QPFLLDS4VZQ3X6WX6FSICR6IFXIAMGMJYCMEE645KKTSM/transactions

Luckily it's only 6 transactions, so we can get all at once. Take a look at the last two transactions (I know it's the last two ones because I went through all six of them :) by copying the result_meta_xdr transaction details...

enter image description here

...and pasting them into the stellar laboratory XDR decoding tool which should look like this:

enter image description here

Before the second last transaction the account had a balance of 63620.0000100 XLM, before the last transaction it only had 63620.4999800 XLM. So yeah, that's a difference of 300 stroops. 100 stroops can be accounted for the tx-fee of the last transaction, 200 stroops have somehow disappeared.

If you also look at the sequence number, the seqNumber was increased by two, which is a very strong indication that the account must have submitted two other transactions (or unlikely one bumpSequence transaction with a double fee) between the actually listed two transactions and which would have cost 200 stroops tx-fee, the exact amount we are missing.

Now where are those two missing transactions?

The thing is: unlike other blockchains the stellar ledger is a distributed state machine, which means that basically only account state changes but no transaction details are tracked on chain. Account balances are verified and secured on chain, transaction history is not. That is stored in archives instead and ingested/provided by horizon servers. Horizon servers only provide the transactions they have ingested, if they don't have for whatever reason they just won't list them (One common case: you set up your own horizon but are not interested in gigabytes of tx-history, so you will usually only ingest a specified number of ledgers. Other case: your horizon is set up to catch up only the last n ledgers and is offline for a period of more than n ledgers, creating a gap).

Although I would have expected the official horizon to have ingested all transaction details since the genesis block, it appears to have not here. Maybe some bug or rare edge case occurred which prevented horizon servers to skip those transactions, maybe it just skips failed transactions by design or purges deprecated operations - just guesses, I have absolutely no idea and I'm also looking forward to someone giving a good explanation for that :)

Finally it should be possible to recover the missing transactions from the archives but I've currently no intention to dig that deep.

1
  • Wow, thanks a lot for that detailed answer. No need to dig deeper. I was just curious if I'm just too stupid or can't see anything obvious.
    – Tobias
    Jun 3 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.