Closed garyyu closed 4 years ago
[Updated for above additional note
, to correct a mistake]:
At maximum, a Gotts key id (i.e Identifier
) can have 3-level BIP-32 derivation path: m/p1/p2/p3. The 1st two path consist of the so-called wallet account here. The last path can be saved into the chain into the PathMessage
here.
(the 4th part of Identifier
is reserved and not used at this moment)
Since we already have 2^31
keys here for each m/p1/p2/p3, it's already fair enough for most of the use cases.
The current
PathMessage
contains 28 bytes as follows:The complete
Identifier
here is a little bit wasting on the precious chain space, this PR shorten thekey_id
here, replace it with thelast_path
which is only 4 bytes instead of 17 bytes.This is a balance we have to make, between a compact chain space and a simpler wallet implementation. The new
PathMessage
only need 12 bytes.For wallet restoring or checking, to get a complete key id, the wallet must know the parent key path, which should be bound to the wallet account (i.e.
m/p1/p2
).For example the
default
wallet account:After this PR, the wallet will never be able to restore all coins by one call, since a wallet could have multiple wallet accounts. It will have to leave to the wallet user to manage the wallet accounts manually, but I think it's acceptable, considering the original intention of the "accounts".
Additional note: At maximum, a Gotts key id (i.e
Identifier
) can have 4-level BIP-32 derivation path:m/p1/p2/p3/p4
. The 1st two path consist of the so-called wallet account here. The last path can be saved into the chain into thePathMessage
here. Then, how about the 3rd path?At this moment, let's leave a TODO here about this 3rd path. In my current design (including some refactoring on this part soon), I just leave this 3rd path always as
0
. This 3rd path could be used in the future if there's a good use case, but since we already have2^31
keys here for eachm/p1/p2/0
, it's already fair enough for most of the use cases.(Because this PR is a consensus breaking change, I also import a new Genesis block for Floonet test.)