You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing a Nano library for Elixir, and I believe I have discovered an off-by-one error in whatever library produced the example wallet address in they Key Management section.
My first attempt at encoding the public key into a wallet address used the RFC 4648 base32 algorithm with a modified alphabet. That is, I would take five bits at a time, and use that five-bit integer as an index for a character array. Here was my first attempt:
However, this produced an incorrect wallet address.
After some toying around, I discovered that whatever library produced these examples is actually dropping the first bit of the public key. Here's the snippet that produces an address matching the example:
# Drop the first bit of the to-be-encoded value<<_::1,rest::pubkey>>=bin# Same RFC 4648 algorithmfor<<i::5<-rest>>,into: <<>>doString.at("13456789abcdefghijkmnopqrstuwxyz",i)end
I'm writing a Nano library for Elixir, and I believe I have discovered an off-by-one error in whatever library produced the example wallet address in they Key Management section.
My first attempt at encoding the public key into a wallet address used the RFC 4648 base32 algorithm with a modified alphabet. That is, I would take five bits at a time, and use that five-bit integer as an index for a character array. Here was my first attempt:
However, this produced an incorrect wallet address.
After some toying around, I discovered that whatever library produced these examples is actually dropping the first bit of the public key. Here's the snippet that produces an address matching the example:
I was following the reference implementation at https://github.com/numsu/nanocurrency-web-js/blob/master/lib/nano-address.ts, and I suspect the bug is in there.
Am I correct in saying this is also a bug in the Javascript implementation, or was the example wallet in these docs produced by another library?
The text was updated successfully, but these errors were encountered: