Skip to content
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

Saving addresses as base58 vs Bech32 #43

Open
StohnIO opened this issue Feb 19, 2024 · 2 comments
Open

Saving addresses as base58 vs Bech32 #43

StohnIO opened this issue Feb 19, 2024 · 2 comments

Comments

@StohnIO
Copy link

StohnIO commented Feb 19, 2024

We have been using eiquidus explorer and love it however recently ran into an issue when upgrading our core to a new hd wallet that can uses segwit. After the node update eiquidus now saves utex addresses in mongod as Bench32 (starts with the number 3) instead of the legacy address that is base58. This is an interesting issue and wasn't sure if there was a simple update to convert the Bench32 to base58 before saving into mongod db.

@joeuhren
Copy link
Contributor

Hi, as you probably noticed, the explorer doesn't have any way to convert from bech32 to base58 or vice-versa, it is more of a dumb app that just aggregates and displays data that comes directly from the coin wallet.

That being said, I see base58 addresses on the Stohncoin explorer right now https://stohnexplorer.com/. For example, according to the raw tx data from https://stohnexplorer.com/tx/729fc1db66403245abe318b489a10a888f31f841f1660e0e2f2f6deb5f64d474 the address shows as 3GzyQRj3YC16XV8JsQjWg1xdoxZh5Uk4Lo but the explorer is showing ScbxWj1kiesuxdDLHk3zoHkGKDWQFzKKSy.

I have a couple questions about your original request:

  1. I assume by what I'm seeing that you already figured out how to convert bech32 to base58? I'm curious as to how you were able to do that. It seems the decode function from here would work, but I haven't tried it: https://github.com/sipa/bech32/blob/master/ref/javascript/bech32.js
  2. I have to wonder, is converting from bech32 to base58 in all cases really the desired result? Perhaps this is something very specific to Stohncoin or merely a preference, but I would think its best to output the address that the coin wallet is showing, no? For example, I notice that not all addresses shown in your explorer are bech32 such as https://stohnexplorer.com/tx/52f8a0015fa2fcca1c3b4f052a0dae707bc904ca6494a2a55032ecf691e12618 the raw data already shows the base58 address of T1EMrwg2EYypEPLkrhCr2cGYv72nHwneaa. This leads me to believe that coins might have been sent to one address or the other and would therefore be more proper to display the address that actually received the coins, even if the 2 addresses are effectively the same address.

@StohnIO
Copy link
Author

StohnIO commented Feb 21, 2024

Thank you for the quick response. We found an issue in our core that was causing the problem. We have fixed it and the bench32 is no longer a problem. This is a great explorer by the way you did a fantastic job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants