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

Use hexadecimal for all addresses instead of base58+bech32 #223

Closed
SebastienGllmt opened this issue Jul 28, 2020 · 2 comments
Closed

Use hexadecimal for all addresses instead of base58+bech32 #223

SebastienGllmt opened this issue Jul 28, 2020 · 2 comments

Comments

@SebastienGllmt
Copy link
Contributor

SebastienGllmt commented Jul 28, 2020

There are three main benefits to this:

Reason one - easier to decode

Currently, for every address, we have to do two steps

  1. Try decoding as base58
  2. If (1) fails, try decoding as bech32

However, given that all base58 addresses all start with the prefix 0b1000, parsing from hexadecimal immediately gives you the right address type.

Reason two - easier to query

Currently, all queries to cardano-db-sync have to use the bech32 prefix "addr" otherwise you won't get any results. This seems fairly arbitrary as a requirements. Would be much easier if I can just query the hex representation of an address and know it works for all address types.

Reason three - ambiguity on legacy addresses

I have seen people multiple times take a base58 address and wrap it in bech32. Tools like cardano-cli even accept legacy addresses in this format! It's really confusing if we have to parse base58 addresses in two different ways. Saving raw hex is the only canonical way to handle addresses.

@rhyslbw
Copy link
Contributor

rhyslbw commented Jul 29, 2020

Currently, for every address, we have to do two steps

As consumers of the database we should only be exposed to the presentation address format, so this is a workaround.

Currently, all queries to cardano-db-sync have to use the bech32 prefix "addr" otherwise you won't get any results.

The network discrimination forms part of the address identity, why are there addresses being derived without it?

I have seen people multiple times take a base58 address and wrap it in bech32

Wrapping in bech32 seems like an odd approach to a non-existent problem (unless I am missing the point entirely). What is the point of mutating an identity?

I'd also like to see resolution to the inconsistencies, but decoding should be an internal concern of the chain sync client
#224

@erikd
Copy link
Contributor

erikd commented Jul 31, 2020

@SebastienGllmt What about adding an extra column to the tx_out table containing the un-encoded address?

@erikd erikd closed this as completed in c0b9aed Aug 10, 2020
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

3 participants