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

Rework Namada addresses #2018

Closed
Tracked by #2004
sug0 opened this issue Oct 20, 2023 · 2 comments · Fixed by #2060
Closed
Tracked by #2004

Rework Namada addresses #2018

sug0 opened this issue Oct 20, 2023 · 2 comments · Fixed by #2060
Assignees
Labels
brainstorming breaking:client has-a-pr The issue has been solved by a PR that has yet to be merged ledger prio:high

Comments

@sug0
Copy link
Contributor

sug0 commented Oct 20, 2023

Context

All Namada addresses (established, implicit and internal) are currently encoded with bech32m, with an atest prefix. The data being encoded for these addresses consists of 45 bytes, split into the following sections:

  • A 3 byte prefix (e.g. "nam")
  • Two colon characters ("::")
  • 40 bytes of arbitrary data (e.g. for implicit addresses, this will be a hex encoded truncated public key hash)

A consequence of this is that we employ some hacks for internal addresses, to fit the criteria above. See:

mod internal {
    pub const POS: &str = 
        "ano::Proof of Stake                          ";
    pub const POS_SLASH_POOL: &str =
        "ano::Proof of Stake Slash Pool               ";
    pub const PARAMETERS: &str =
        "ano::Protocol Parameters                     ";
    pub const GOVERNANCE: &str =
        "ano::Governance                              ";
    pub const IBC: &str =
        "ibc::Inter-Blockchain Communication          ";
    pub const ETH_BRIDGE: &str =
        "ano::ETH Bridge Address                      ";
    pub const ETH_BRIDGE_POOL: &str =
        "ano::ETH Bridge Pool Address                 ";
    pub const REPLAY_PROTECTION: &str =
        "ano::Replay Protection                       ";
    pub const MULTITOKEN: &str =
        "ano::Multitoken                              ";
    pub const PGF: &str =
        "ano::Pgf                                     ";
}

Goal

We should introduce different prefixes, for addresses with different size constraints.

  • Transparent addresses (whether implicit or established) should use a tnam prefix. A discriminant byte (e.g. with a value of 0/1) may be used to distinguish between implicit or established addresses, followed by the raw (truncated to 20 bytes) public key hash of an address, in the case of implicit addresses, or random data, in the case of established addresses. This will result in encodings of the form: tnam1xqqqzqsrqszsvpcgpy9qkrqdpc83qygjzvd4tm66. Maybe established/implicit keys should have different bech32m prefixes?
  • Shielded addresses should use a znam prefix. See section 5.6 starting on page 110 of the zcash paper for size constraints. Distinguishing between different MASP keys may also be done with a discriminant byte. Perhaps we should use a different prefix for these?
  • Other prefixes should be chosen for internal addresses, such as ERC20 wrapped assets, the Ethereum Bridge pool address, etc.
@sug0
Copy link
Contributor Author

sug0 commented Oct 20, 2023

Depends on #1840

@tzemanovic
Copy link
Member

related issue #112

@sug0 sug0 self-assigned this Oct 24, 2023
@sug0 sug0 added the has-a-pr The issue has been solved by a PR that has yet to be merged label Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
brainstorming breaking:client has-a-pr The issue has been solved by a PR that has yet to be merged ledger prio:high
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants