-
Notifications
You must be signed in to change notification settings - Fork 109
deterministic currency unit derivation path #1004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
deterministic currency unit derivation path #1004
Conversation
it is defined in the NUT-01 spec so it should live there in the code
|
Suppose we want to add a new enum value, how does that work? Do we implement it as a custom variant? |
What do you mean enum value? |
|
a new CurrencyUnit enum variant, like how If we reserve a small range of hard coded derivation path values for the future it becomes trivial to add a new enum variant that is more ergonomic for developers to use. The downside is minor IMO: you get an infinitesimally larger chance of collision. We don't need to reserve 10,000 spaces but I think a small reserved range is a good idea. |
for what? Even the current ones only need to stay fixed for backwards compatibility. The only point of the reserved is to map the unit to the derivation index, we can do that now by hashing. |
|
It makes the code uglier. That's all. |
|
I was about to suggest we take a page from the secp256k1 library and implement different hash functions but I just saw that apoelstra removed this functionality last week. rust-bitcoin/rust-secp256k1@54828ac We could standardize on the rust default hash function for simplicity. Would this make derivation paths different in some library upgrade scenarios? |
|
Discussion points from the cdk meeting:
|
|
We also determined this should be added to the NUT specs. Open question whether to add it to NUT-01 or as a new NUT. |
|
This PR is stale because it has been open for 60 days with no activity. |
|
This PR is stale because it has been open for 60 days with no activity. |
Description
Move the CurrencyUnit enum from
nut00where it was originally implemented before being added to the spec tonut01to match the spec definition.Implement deterministic currency unit derivation paths.
Notes to the reviewers
See also this impl from the portal team: PortalTechnologiesInc@0051f57
and this impl from a previous hashpool cdk branch: vnprc@0d11a5b
The implementation in this PR improves on both of the above impls.
Suggested CHANGELOG Updates
CHANGED
ADDED
REMOVED
FIXED
Checklist
just final-checkbefore committing