Replies: 3 comments 19 replies
-
I think that's a good idea, though maybe behind an Given that we will probably see more encoding schemes in the future, how does such a feature impact whether this library can stabilize at |
Beta Was this translation helpful? Give feedback.
-
I was thinking it could make sense to make each of these a separate crate:
And if not a separate crate then at least try to make the API as if it was a separate crate. I don't have much time to dig into this more deeply. |
Beta Was this translation helpful? Give feedback.
-
So, here's my thought for an API exposure:
Then the root of the crate defines generic functions for "end-to-end" operations like taking data and producing a checksummed hrpstring from it, or an iterator which does the same, etc) and the specific checksums |
Beta Was this translation helpful? Give feedback.
-
I've been thinking about this for a little while, but #95 made me think of it again.
In Bitcoin, we have several checksums that are all degree-2 BCH codes over the the same alphabet:
There are also "blech32" and "blech32m" which are part of Elements/Liquid, and probably others, and probably new ones will pop up as the years ga by.
In all cases, we have the same character set, the same "hrpstring" encoding, basically the same algorithm (although BIP 93 is a bit annoying since, as a 65-bit checksum, we cannot pack intermediate values into u64s) for checksum generation and verification, and basically the same algorithm for error locating/correcting.
Currently this crate provides support for bech32 and bech32m, and deliberately does not expose any internals, which means that we wind up duplicating some code.
I think we should expose some sort of
internals
module, and some generic code, to make this easier.Thoughts?
cc @clarkmoody @Kixunil
Beta Was this translation helpful? Give feedback.
All reactions