team-exor / eiquidus

Feature-rich open-source altcoin block explorer. Regular Updates ~ Platform Independent ~ Mobile Friendly ~ Supports Themes, Markets, Charts, Claiming Addresses, Public API's, Custom RPC Cmds, Bitcoin, Heavycoin, zk-SNARKs ~ List Masternodes, Network Peers, Top 100 Wallets ~ Built-in Update Script ~ Highly Customizable
https://explorer.exor.io
BSD 3-Clause "New" or "Revised" License
85 stars 185 forks source link

Saving addresses as base58 vs Bech32 #43

Closed StohnIO closed 1 month ago

StohnIO commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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.