Skip to content

Commit 66e15fa

Browse files
author
Filippo
committed
final edits
- new figures + description - updated text
1 parent b347254 commit 66e15fa

6 files changed

Lines changed: 72 additions & 57 deletions

File tree

docs/assets/balance-example-1.png

-45.9 KB
Loading

docs/assets/balance-example-2.png

-124 KB
Loading

docs/assets/balance-example-3.png

-98.7 KB
Loading

docs/assets/balance-example-4.png

-69.2 KB
Loading

docs/assets/balance-example-5.png

268 KB
Loading

docs/learn/learn-account-balances.md

Lines changed: 72 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,108 +3,123 @@ title: Account Balances
33
description: Discover the different types of account balances in Polkadot and Kusama, including free, frozen, and spendable balances.
44
---
55

6-
In the Polkadot ecosystem, there are different types of balances depending on the account activity.
7-
Different balance types dictate whether your balance can be used for transfers, to pay fees, or must
8-
remain frozen and unused due to an on-chain requirement.
6+
In the Polkadot ecosystem, different types of balances depend on the account activity.
7+
Different balance types dictate whether your balance can be used for transfers, to pay fees, or must remain frozen and unused due to an on-chain requirement.
98

10-
!!!info "A more efficient distribution of account balance types"
11-
Soon, pallets on Polkadot SDK will be implementing the _fungible_ trait (see [the tracking issue](https://github.com/paritytech/polkadot-sdk/issues/226) for more info). This new logic will allow for more efficient use of your account balance. Specifically, the [fungible trait](https://paritytech.github.io/polkadot-sdk/master/frame_support/traits/tokens/fungible/index.html) will allow using the `free` balance for on-chain activity like setting proxies and identities.
9+
There are four types of account balances:
1210

13-
There are 4 types of account balances:
11+
- **Free Balance** is a portion of an account's total balance that is not held (see below). It is the balance that can be used for any on-chain activity ([staking](./learn-staking.md), [governance](./learn-polkadot-opengov.md), and deposits) as long as the total balance (free + reserved) remains above the maximum of frozen balance and existential deposit.
1412

15-
- **Free** is the balance that can be used for any on-chain activity ([staking](./learn-staking.md), [governance](./learn-polkadot-opengov.md), deposits) as long as your total balance (free + reserved) remains above the maximum of frozen balance and existential deposit.
16-
- **Frozen** (also called locks) is a balance that overlaps across pallets. Example: If governance freezes 100 DOT and vesting freezes 120 DOT, total frozen = 120 DOT (not 220 DOT).
17-
- **Reserved** (also called holds) is the balance removed from free and doesn't overlap. Used by nomination pools, [staking](./learn-staking.md), etc. Can still be used for governance voting but not for transfers or fees.
18-
- **Spendable** is the portion of free balance available for transaction fees and creating new holds.
13+
- **Reserved Balance** (also called holds, or held balance) is the balance removed from free and does not overlay. It can be slashed, but only after all the free balance has been slashed. Reserved balance is used for:
14+
- native [staking](./learn-staking.md) on the relay chain or via nomination pools
15+
- deposits such as [governance](./learn-polkadot-opengov.md) decision and submission deposits, [identity](./learn-identity.md) deposits, and [proxy](./learn-proxies.md) and [multi-signature](./learn-account-multisig.md) accounts deposits. It cannot be used for transfers or paying fees.
16+
17+
- **Frozen Balance** (also called locks, or locked balance) is a balance that overlays. The frozen balance can exceed the total balance. Frozen balance is used for:
18+
- [vested transfers](./learn-transactions.md#vested-transfers)
19+
- governance locks
20+
21+
Locks overlay with themselves and with holds, meaning that if staking reserves 60 DOT, voting for a governance proposal with 20 DOT will put a lock on 20 out of 60 reserved DOT. If a governance vote freezes 20 DOT and vesting freezes 120 DOT, the total frozen balance is 120 DOT (not 140 DOT).
22+
23+
- **Spendable Balance** is the portion of free balance available for transaction fees and creating new holds.
1924

2025
The spendable balance is calculated as follows:
2126

2227
```
2328
spendable = free - max(frozen - reserved, ED)
2429
```
2530

26-
where `free`, `frozen` and `reserved` are defined above. The `ED` is the
31+
Where `free`, `frozen`, and `reserved` are defined above. The `ED` is the
2732
[existential deposit](./learn-accounts.md#existential-deposit-and-reaping).
2833

29-
**Wallet providers might show you the spendable, locked, and reserved balance.**
34+
**Wallet providers might show you the spendable, frozen, and reserved balance.**
3035

3136
## Example of Account Balance Types
3237

3338
Below is an in-depth example of how an account balance composition changes depending on user actions
34-
once
35-
[the _fungible_ trait](https://paritytech.github.io/polkadot-sdk/master/frame_support/traits/tokens/fungible/index.html)
36-
is used for account balances. Let’s take, for example, an account with 100 DOT.
39+
**once [the _fungible_ trait](https://paritytech.github.io/polkadot-sdk/master/frame_support/traits/tokens/fungible/index.html) is implemented by all Substrate pallets**. Let’s take, for example, an account with 100 DOT.
3740

3841
```
3942
Free: 100 DOT
40-
Frozen: 0 DOT
41-
Reserved: 0 DOT
43+
Frozen (locked): 0 DOT
44+
Reserved (held): 0 DOT
4245
Spendable: 99 DOT
4346
Untouchable: 1 DOT (ED)
4447
```
4548

4649
![balance-example-1](../assets/balance-example-1.png)
4750

48-
In this case, the existential deposit of 1 DOT is untouchable (meaning you can’t touch it if the
49-
account can’t or shouldn’t get reaped). If 80 DOT from the account is staked, we get the following
50-
balance structure:
51+
The untouchable balance is part of the free balance that cannot be spent due to ED or freezes. In this case, the existential deposit of 1 DOT is untouchable (meaning you can’t touch it if the
52+
account can’t or shouldn’t get reaped). The untouchable balance can also be defined as the frozen balance in excess of holds (see [here](https://github.com/paritytech/polkadot-sdk/issues/1833#issuecomment-1805764506) for a visual aid).
53+
54+
If 60 DOT from the account is staked, we get the following balance structure:
5155

5256
```
53-
Free: 100 DOT
54-
Frozen : 0 DOT
55-
Reserved: 80 DOT
56-
Spendable: 20 DOT
57-
Untouchable: 80 DOT
57+
Free: 40 DOT
58+
Frozen (locked) : 0 DOT
59+
Reserved (held): 60 DOT
60+
Spendable: 39 DOT (Free - ED)
61+
Untouchable: 1 DOT (ED)
5862
```
5963

6064
![balance-example-2](../assets/balance-example-2.png)
6165

62-
The spendable balance would be 20 DOT (which would also include fees for future transactions from
66+
The spendable balance would be 39 DOT (which would also include fees for future transactions from
6367
this account).
6468

65-
Note how the account cannot be reaped from the state while it has a reserved balance, or in general
69+
Note how the account cannot be reaped from the state while it has a reserved balance, or in general,
6670
any [consumer and provider reference](./learn-guides-accounts.md#query-account-data-in-polkadot-js).
6771
Those references determine if an account can be reaped, usually because other accounts depend on the
68-
existence of such an account). For example, the existential deposit adds a provider reference simply
72+
existence of such an account. For example, the existential deposit adds a provider reference simply
6973
because the account exists, while a proxy account adds a consumer reference (the proxy existence
7074
depends on the proxied account; the proxy is the consumer). **Because the existential deposit is
7175
part of the untouchable balance, the user can use all the spendable balance (there is no need to
7276
keep 1 DOT as spendable).**
7377

74-
!!!info
75-
The use of the _free_ balance as shown in the following figures will be possible once the _fungible_ trait is implemented for account balances.
7678

77-
If the account creates a proxy, it will use the `free` balance as shown below.
79+
If the account creates a proxy, it will use the reserved balance as follows:
7880

7981
```
80-
Free: 80 DOT
81-
Frozen : 0 DOT
82-
Reserved: 100 DOT
83-
Spendable: 20 DOT
84-
Untouchable: 60 DOT
82+
Free: 20 DOT
83+
Frozen (locked) : 0 DOT
84+
Reserved (held): 80 DOT
85+
Spendable: 19 DOT (Free - ED)
86+
Untouchable: 1 DOT (ED)
8587
```
8688

8789
![balance-example-3](../assets/balance-example-3.png)
8890

89-
**Note how, through the fungible trait, the system uses the `balance` that is reserved instead of the
90-
`free` balance that is spendable (present configuration on-chain).** In other words, holds are
91-
subtracted from free balance but overlap with the reserved balance. The free portion shrinks from 100
92-
to 80 DOT, and the `reserved` portion increases from 80 to 100 DOT. The creation of an identity will
93-
grow the `reserved` portion to 120 DOT, and shrink further the `free` from 80 to 60 DOT. Note how the
94-
spendable balance stays the same in the process.
91+
The reserved balance for the proxy deposit increases the total held balance to 80 DOT while the free balance decreases to 20 DOT.
92+
93+
If the account votes for a governance proposal with 20 DOT, the situation would be as follows:
9594

9695
```
97-
Free: 60 DOT
98-
Frozen: 0 DOT
99-
Reserved: 120 DOT
100-
Spendable: 20 DOT
101-
Untouchable: 40 DOT
96+
Free: 20 DOT
97+
Frozen (locked): 20 DOT
98+
Reserved (held): 80 DOT
99+
Spendable: 19 DOT (Free - ED)
100+
Untouchable: 21 DOT (ED)
102101
```
103102

104103
![balance-example-4](../assets/balance-example-4.png)
105104

106-
This update using the fungible trait allows the use of the frozen balance for on-chain activity like
107-
setting up proxies and identities. Note that
105+
Note how, through the fungible trait, the system uses the reserved balance. In other words, locks are
106+
subtracted from the free balance but overlap with the reserved balance, and with themselves (see below). The free and reserved portions remain 20 DOT and 80 DOT, respectively. We also have 20 DOT as a frozen balance because of the governance lock, and the untouchable balance would thus be 21 DOT.
107+
108+
A vested transfer of 50 DOT will
109+
grow the frozen balance to 50 DOT and the untouchable balance to 51 DOT, using the already frozen 20 DOT plus an additional 30 DOT from the reserved balance without touching the free and spendable balances.
110+
111+
112+
```
113+
Free: 20 DOT
114+
Frozen (locked): 50 DOT
115+
Reserved (held): 80 DOT
116+
Spendable: 19 DOT (Free - ED)
117+
Untouchable: 51 DOT (ED)
118+
```
119+
120+
![balance-example-5](../assets/balance-example-5.png)
121+
122+
This update uses the fungible trait to allow the use of the reserved balance for on-chain activity like voting in governance and vesting. Note that
108123
[holds are slashable](https://github.com/paritytech/substrate/pull/12951), and the pallet
109124
[migrations](https://github.com/paritytech/polkadot-sdk/issues/226) need to take that into account.
110125
This means that freezes should account for hold being slashed (for example, your stash account
@@ -114,7 +129,7 @@ balance getting reduced because your governance deposit for a proposal was slash
114129

115130
Locks are abstractions over an account's free balance, preventing it from being spent. Several locks
116131
can overlap on the same account balance instead of being stacked on top of one another. Locks are
117-
automatically added onto accounts when the account participates in activities on-chain (voting, etc.), but these are not customizable.
132+
automatically added to accounts when the account participates in activities on-chain (voting, etc.), but these are not customizable.
118133

119134
Locks are accounted for within the `frozen` balance of the account. This is the balance that can be
120135
`free` but not transferrable, and locked in
@@ -152,9 +167,9 @@ have ongoing locks.
152167

153168
Following the previous example, if you:
154169

155-
- undelegate a 1x conviction delegation of 24 DOT, you will get a 7-day lock on 24 DOT
156-
- delegate 4 DOT with 6x conviction
157-
- undelegate again before the 1x conviction lock is removed
170+
- Undelegate a 1x conviction delegation of 24 DOT, you will get a 7-day lock on 24 DOT
171+
- Delegate 4 DOT with 6x conviction
172+
- Undelegate again before the 1x conviction lock is removed
158173

159174
You will get a 6x conviction for 24 DOT! See
160175
[here](https://substrate.stackexchange.com/questions/5067/delegating-and-undelegating-during-the-lock-period-extends-it-for-the-initial-am)
@@ -178,16 +193,16 @@ types are the same for a Polkadot account).
178193
schedule. The account owns the tokens, but they are _locked_ and become available for transfer
179194
after a specific number of blocks. In the example, the vested balance is 0.25 KSM.
180195
- The **bonded** balance indicates the number of tokens that are _locked_ for on-chain participation
181-
to staking. In the example, the bonded balance is 0.4 KSM.
196+
in staking. In the example, the bonded balance is 0.4 KSM.
182197
- The **democracy** balance indicates the number of tokens that are _locked_ for on-chain
183198
participation in democracy (i.e., voting for referenda and council). In the example, the democracy
184199
balance is 0.4 KSM.
185200
- The **redeemable** balance indicates the number of tokens ready to be unlocked to become
186-
transferrable again. Those tokens already went through the unbonding period. In this case, the
201+
transferrable again. Those tokens have already gone through the unbonding period. In this case, the
187202
redeemable balance is 0.1 KSM.
188-
- The **locked** balance indicates the number of frozen tokens for on-chain participation to staking
203+
- The **locked** balance indicates the number of frozen tokens for on-chain participation in staking
189204
and democracy or for vested transfers. **Locks do not stack**, which means that if you have
190-
different locks, the total locked balance is not the addition of the individual locks. Instead,
205+
different locks, the total locked balance is not the sum of the individual locks. Instead,
191206
**the biggest lock decides the total locked balance**. In the example, the locked balance is 0.55
192207
KSM because the biggest lock is on democracy (0.55 KSM).
193208
- The **reserved** balance indicates the number of frozen tokens for on-chain activity other than

0 commit comments

Comments
 (0)