I have read the specification, but didn't understand whether this is required of this is just a convention?
For instance consider the following path
Bitcoin first external first m / 44' / 0' / 0' / 0 / 0
https://i.stack.imgur.com/7jgkj.pngIf I change the constant number 44, what consequences may I experience?
If you change 44 to something else, then you'll find that BIP44 compatible wallets will NOT be able to derive the same addresses. If a wallet adheres to (or enforces) BIP44, then they should be using m/44'/.... unless the wallet also offers "custom" derivation paths that allow a user to define whatever they want... (and then just append the "/0/x" on the end)
The recommendation is that if you don't want to follow the BIP44 spec, you should apply for your own BIP number... and use that. If you're creating a new coin, you should apply/register for a new coin number (see below) and use that.
As far as I know all online tools for calculating balances just check all available values to calculate the final balance.
Not quite... they generally stick to a set "base" derivation path like m/44'/0'/0'... ie. BIP44, Coin = 0 (Bitcoin, list of "registered" coin numbers here:
https://github.com/satoshilabs/slips/blob/master/slip-0044.md), Account = 0.
From there, they'll use "external/internal" of 0/1 for deriving separate "receive" and "change" addresses respectively... and then an incrementing "address index"
ie.
ReceiveAddress0 = m/44'/0'/0'/0/0
ReceiveAddress1 = m/44'/0'/0'/0/1
ReceiveAddress2 = m/44'/0'/0'/0/2
ReceiveAddress3 = m/44'/0'/0'/0/3
...
ReceiveAddressN = m/44'/0'/0'/0/N
ChangeAddress0 = m/44'/0'/0'/1/0
ChangeAddress1 = m/44'/0'/0'/1/1
ChangeAddress2 = m/44'/0'/0'/1/2
ChangeAddress3 = m/44'/0'/0'/1/3
...
ChangeAddressN = m/44'/0'/0'/1/N
To avoid having to generate addresses "forever" when restoring wallets... most wallets will implement a "gap limit" system... ie. they'll loop around "generate address -> check address for activity -> generate next address"
etc until they have generated X addresses that have ZERO activity (note, NOT balance... but activity). The value of X is known as the gap limit... and is variable from wallet to wallet. Electrum uses 20 receive, 5 change... I've seen some wallets use 100.
And in case the last value corresponds to a address index, what is the maximum value of addresses though ?
Theoretically, there isn't one... technically, it is probably the largest (INT) number that your OS/system is able to represent.
And if there any lib, that just makes it simple to derive and address passing all these values as function argument to generate a valid new address?
I would think it should be relatively easy to create a simple wrapper function of your own to do this.
I have one more question regarding the path of derived addresses
It was actually 3 questions, but I'll let it slide
![Tongue](https://bitcointalk.org/Smileys/default/tongue.gif)