Skip to content
This repository has been archived by the owner on Aug 21, 2020. It is now read-only.

Address binary serialisation #12

Merged
merged 10 commits into from
Jan 21, 2019
Merged

Conversation

NicolasDP
Copy link
Contributor

@NicolasDP NicolasDP commented Jan 17, 2019

resolves #2

Propose short address binary serialisation as well as a new human readable encoding for it using bech32

rendered markdown

text/0000-address.md Outdated Show resolved Hide resolved
text/0000-address.md Outdated Show resolved Hide resolved
text/0000-address.md Outdated Show resolved Hide resolved
Copy link
Contributor

@commandodev commandodev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of grammar tweaks

text/0000-address.md Outdated Show resolved Hide resolved
text/0000-address.md Outdated Show resolved Hide resolved
text/0000-address.md Outdated Show resolved Hide resolved
Ben Ford and others added 3 commits January 18, 2019 09:59
Co-Authored-By: NicolasDP <nicolas@primetype.co.uk>
Co-Authored-By: NicolasDP <nicolas@primetype.co.uk>
Co-Authored-By: NicolasDP <nicolas@primetype.co.uk>

* `PublicKey`: this will be necessary to be able to utilise the token;
* `Discriminant`: this will prevent misuse of addresses between testing
environment and production environment;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add the address kind here as well?

It is possible to create a **Grouped Address**, it groups addresses to a
staking key. To create a **Grouped Address** you need the `PublicKey`,
the `Discriminant` (just like for a **Single Address**) and another
`PublicKey` that is associating this address to another hierarchy.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should expand on this, to get the connection to what's in the design document. There, we have four new types of addresses (base, pointer, enterprise, and reward account). This RFC introduces two new kinds of addresses, which can be used to represent three of the addresses in the design document:

  • base addresses can be implemented in terms of grouped addresses
  • pointer addresses are not covered here
  • enterprise addresses can be implemented in terms of single addresses
  • reward account addresses can be implemented in terms of grouped addresses

I suggest using the address kind to distinguish the two kinds of grouped addresses (base and reward account), and adding pointer addresses.

Copy link
Member

@vincenthz vincenthz Jan 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're not going to support pointer address (with this rfc). they are not useful for MVP, can be bolted afterwards without a problem from the format PoV, and are raising important security questions.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So are you saying that with this proposed address format, where the additional staking key hash takes only 32 bytes, the savings of space by using pointer addresses is not enough to warrant the additional complexity?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kantp can you share a document where types of addresses are defined - as I am not aware of the recent development

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akegalj They are defined in the design document for delegation.

text/0000-address.md Outdated Show resolved Hide resolved
@kantp kantp requested review from dcoutts and nc6 January 18, 2019 11:09
nc6
nc6 previously requested changes Jan 18, 2019
Copy link

@nc6 nc6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made a bunch of grammar/consistency suggestions. I also agree that we should have some mention of pointer addresses in here. Otherwise this LGTM

ETA: just seen the note about pointer addresses.

text/0000-address.md Outdated Show resolved Hide resolved
text/0000-address.md Outdated Show resolved Hide resolved
text/0000-address.md Outdated Show resolved Hide resolved
text/0000-address.md Outdated Show resolved Hide resolved
text/0000-address.md Outdated Show resolved Hide resolved
text/0000-address.md Outdated Show resolved Hide resolved
text/0000-address.md Outdated Show resolved Hide resolved
text/0000-address.md Outdated Show resolved Hide resolved
@commandodev
Copy link
Contributor

I think we've given this enough time and eyeballs now. @NicolasDP if you could adress @nc6's review I'll go ahead and merge.

Co-Authored-By: NicolasDP <nicolas@primetype.co.uk>
@NicolasDP
Copy link
Contributor Author

Thanks for the feedback and fixes.

@NicolasDP
Copy link
Contributor Author

@Boothead , before merging we need to agree on the CIP number: 0001 seems the obvious choice.

@commandodev
Copy link
Contributor

@Boothead , before merging we need to agree on the CIP number: 0001 seems the obvious choice.

Good point! Yes, let's go for 0001!

kantp
kantp previously requested changes Jan 21, 2019
Copy link

@kantp kantp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, this looks good, but I'd really like to see a connection be made to the address types that we have for Shelley (base, enterprise, and reward account addresses). Ideally, I think we should avoid introducing new terminology when we already have some.

@vincenthz you said that you deliberately did not include pointer addresses, because of security concerns. Could you elaborate on that? If there are security issues with pointer addresses, we should address them in the design.

@commandodev commandodev dismissed nc6’s stale review January 21, 2019 11:04

I think these have been addressed

@NicolasDP
Copy link
Contributor Author

@kantp thanks for your feedback on this. Just like you said in your previous comment : we can implement the spec's addresses with the address types we currently have. The pointer address is not necessary now. Right now we need to focus on delivering the necessary resources before Q2. To do so we need to make choices and axes the non necessary elements. As you notice, there are room for new types (up to 121 new address types) so we can always extend this CIP with another one (and I think the pointer address will need a proper CIP since there are lot of questions that will arise from this).

@commandodev commandodev dismissed kantp’s stale review January 21, 2019 18:52

Addressed by Nicolas

@commandodev commandodev merged commit 53b079b into input-output-hk:master Jan 21, 2019
@commandodev
Copy link
Contributor

I'm going to go ahead and merge this. Thanks everyone for their input. If we've missed anything, please feel free to put comments here and we can look at re-opening if necessary or superseding with another RFC.

@NicolasDP NicolasDP deleted the address branch May 2, 2019 10:19
@SebastienGllmt
Copy link

SebastienGllmt commented Aug 6, 2019

Two points that I thought might be worth bringing up:

  1. In the original BECH32 spec, there was discussion about whether or not the checksum should come at the start of the data section or at the end. The rationale for putting it at the front is because most users only check that the first few characters in an address match (especially in the hardware wallet case where scrolling an address to the end on a tiny screen is tedious and slow). They ended up having to put it at the end for some compatibility reason but we're not bound to this design decision

  2. BitcoinCash uses : as the separator instead of 1. The rationale is that this makes the addresses not only easier to read, it also makes all your addresses automatically into URI Schemes (ex: bitcoincash:q9adhakpwzztepkpwp5z0dq62m6u5v5xtyj7j3h2ws4mr9g01). The special character ':' is still part of the QR code alphanumeric mode so you still get equivalent compression. The main downside to this is that right now websites are only allowed to register URI Schemes that start with web+ (only desktop applications can omit the web+ prefix). This is why the Cardano URI Scheme spec we wrote for Yoroi uses web+. That being said, it may be worth making this change to cardano: for our addresses also (reference: https://www.bitcoincash.org/spec/cashaddr.html )

@SebastienGllmt
Copy link

SebastienGllmt commented Aug 8, 2019

I also noticed the Rust codebase uses many different HRPs for bech32 serialization of internal data structures. Maybe these should be defined in some registry? (ex: https://github.com/input-output-hk/chain-libs/blob/d50858350f37e864aeda6b7ce573f773a2dbecd2/chain-crypto/src/algorithms/ed25519_derive.rs#L45)

@ilap
Copy link

ilap commented Oct 12, 2019

I think, they should consider ':' separator for addresses, but for the keys we should stick with the 1, which will give some advantages e.g. easily distinguish between keys and addresses. But, IMO, the Bech32 should be standardised first (versioned either) for general use as chain-libs uses some other variant of the original, due to the fact that the original spec has some limitations, the 90 max data size as an example.

@ilap
Copy link

ilap commented Oct 12, 2019

However, the checksum is not really relevant as it was designed for length 71 and is effective till 89. That's why there is a size restriction (90 i.e. 450 bits data which is 56 length octets) in the original spec.

@SebastienGllmt
Copy link

I agree. The fact that the Rust codebase uses bech32 for literally everything (not just addresses) is strange because the checksum wasn't designed to be used for arbitrary lengths. As long as we don't care about the checksum it's not an issue though

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

Successfully merging this pull request may close these issues.

Specify the address binary format
9 participants