Minka Ledger Docs

Wallet balances

Understanding how and where balances are stored in the Ledger


Keeping track of balances is the most important feature of the Ledger.

In our previous lesson you could see that the wallet record doesn't actually hold any balance information.

Instead, it's located in the wallet-balance record.

Getting balance

When we run minka wallet balances demo-bank-wallet CLI command we see that we're sending wallet handle. Also, the CLI returns the actual balance:

$ minka wallet balances demo-bank-wallet
Balances:
$700.00 (usd)

However, we already saw that this balance is not stored in the wallet record.

So where is it?

Getting wallet balance record

Let's request this same command with -v verbose flag:

$ minka wallet balances demo-bank-wallet -v
 
{
  "hash": "ac71d8add9fde91f5b4cbe9eed9c37011b8e5fcd7006e174976b307cbcfebc3b",
  "meta": {
    "proofs": [
      {
        "method": "ed25519-v2",
        "public": "hnKFzEDkpMka/BnYj+s7+leFCpc9yNk8T7tNVPm8Xgc=",
        "digest": "0f79a8cb1b45835b5c915af3d05ed0d8f5c6773ce65e6682d2d7188291079653",
        "result": "yNZZ98Xzp3J3iu6QfUIKQSjR74i3+aShHjicaxR1ZnvbtMtOWZBBhRFGBB8TYgeyHR24g1ar9tF0RjKICFxkCQ==",
        "custom": {
          "moment": "2025-03-24T13:05:20.989Z"
        }
      }
    ],
    "moment": "2025-03-24T13:05:20.989Z"
  },
  "data": [
    {
      "hash": "447c425fce7c25eb7c8c54e92715cb00d5360f7586c92163d61c1ea504f4e7e7",
      "data": {
        "parent": "d38a77bcef65c5033bc007cdbcbb15bad52ed0bdd3787cfaf237c61917c79a1a",
        "wallet": "demo-bank-wallet",
        "symbol": "usd",
        "amount": 70000
      },
      "luid": "$wbl.-00eg3GMeRWR9HVOb",
      "meta": {
        "proofs": [
          {
            "custom": {
              "moment": "2025-03-18T10:04:37.338Z"
            },
            "digest": "3441f22b0cb91947fad218e0c6ced5d778bb0c993db51df2c4bcd76b4eee6e77",
            "method": "ed25519-v2",
            "public": "hnKFzEDkpMka/BnYj+s7+leFCpc9yNk8T7tNVPm8Xgc=",
            "result": "M+edyGoZrcxqLn6JGiOrOZ1GrHZH6DaXvjl6sNTS7oH3rz2+qbBSLH5FuFdw1lfX27M/CGHCODaP92yJ5ZpmBg=="
          }
        ],
        "moment": "2025-03-18T10:04:37.326Z"
      }
    }
  ],
  "page": {
    "index": 0,
    "limit": 20,
    "total": 1
  }
}

From the record luid we can see that the ballance is stored in wallet-balance record:

"luid": "$wbl.-00eg3GMeRWR9HVOb"

And the amount is expressed in fractions of the currency. This was defined during the creation of new currency through symbol record in one of the earlier lessons.

Updating balances

When we create a new intent (for example - type transfer), Ledger will check whether there are sufficient balances.

If a transaction is valid, the balances will be updated. If not, the transfer will fail.

Also, whenever the amount is changed, this change must also be signed. This ensures the integrity of the balances.

You can see the history of all signatures in the proofs array.

On this page