What are the two "amount" array values?

Hello, I am planning to build a Nano client, but when I study the DB schema, there is something I don't understand: What do the two values in the amount and balance fields represent? For example, in the transaction table in a local test network I've set up, I see this kind of value in the amount field:


I see similar values in the balance field of send/receive blocks. I think the first value is the individual account's balance, which increases/decreases with each consecutive block on the individual account chain, but what is that second large number? That second number seems totally erratic, jumping from negative to positive with large swings between blocks even within the same account chain.

Also, when I send certain amounts of test Nano, there doesn't seem to be a rational relationship between the nominal amount that I send and the amount that is decreased/increased in the amount/balance field. For example, when I send 100 nano to my test client, the amount field (first value in those two-value arrays) in the DB decreases by exactly 5,421,011 units. And that relationship is constant, i.e., whenever I send 100 nano, it decreases the first value in the amount DB field by exactly 5,421,011. And when I send 200 nano, it decreases by exactly 2x that amount: 10,842,021. That's how I inferred that the first number of the array is the current account balance.

I've studied the number units page. Based on that page, it seems like the nano units should increase/decrease in a much more rational pattern. Is there any documentation that explains how those two values are computed beyond the basic "balances are calculated based on the delta between the previous block balance and the current balance..." (I already understand that.)

Thank you in advance for your help.

I haven’t dug into the database this closely to be able to answer the question, but maybe this will help some of you haven’t seen it?

There is an image of the database schema as well as sample python scripts for querying the database.


Seems like you are likely deserializing the DB incorrectly. Please see the link posted by Srayman above, which table are you trying to read?


Thank you both for your replies. @Dotcom was correct. After I fixed the serialization logic the balances look normal as expected.