Skip to content
This repository has been archived by the owner on Jun 3, 2018. It is now read-only.

Add specification for cashaddr #21

Merged
merged 1 commit into from Oct 17, 2017

Conversation

deadalnix
Copy link
Collaborator

No description provided.

@Mengerian
Copy link
Contributor

Very elegant proposal, I like it!

Another way of looking at the prefix, is that it can be treated as an "implicit" prefix. If, for some reason, applications have issues with "bitcoincash:" as a prefix, they can just handle the data portion. The "bitcoincash" is added for the checksum, so that should eliminate problems of ambiguous address formats.

In any case, it's nice to avoid the redundant double-prefix, such as "bitcoin:" and "bc1" in bech32

Copy link
Contributor

@ftrader ftrader left a comment

Choose a reason for hiding this comment

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

Looks nice.

A couple of minor nits and some question (prefix and payload padding, case normalization relating to the QR encoding).

cashaddr.md Outdated

This document describes proposed address format to be used on Bitcoin Cash. It is a base32 encoded format using BCH codes as checksum and that can be used directly in links or QR codes.

This format reuse the work done for Bech32[[1]](#bip173) and is similar is some aspects, but improves on others.
Copy link
Contributor

Choose a reason for hiding this comment

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

This format reuse the work done for Bech32[1] and is similar is some aspects, but improves on others.

Typos:

reuses

is similar in some aspects

cashaddr.md Outdated

## Abstract

This document describes proposed address format to be used on Bitcoin Cash. It is a base32 encoded format using BCH codes as checksum and that can be used directly in links or QR codes.
Copy link
Contributor

Choose a reason for hiding this comment

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

describes a proposed address format

cashaddr.md Outdated

## Abstract

This document describes proposed address format to be used on Bitcoin Cash. It is a base32 encoded format using BCH codes as checksum and that can be used directly in links or QR codes.
Copy link
Contributor

Choose a reason for hiding this comment

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

would be good to give a reference to type out the acronym for BCH and give a reference link when the acronym is first introduced in this spec. It's easily confused with current ticker used widely for Bitcoin Cash.

Bose–Chaudhuri–Hocquenghem (BCH)

ref. https://en.wikipedia.org/wiki/BCH_code


The version byte's most signficant bit is reserved and must be 0. The 4 next bits indicate the type of address and the 3 least significant bits indicate the size of the hash.

| Size bits | Hash size in bits |
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the paragraph above mentions that the type bits come first, it would be smoother to put the type bits explanation & table first instead of the hash bits.

cashaddr.md Outdated

#### Hash

The hash part really deserve not much explaination as its meaning is dependent on the version field. It is the hash that represents the data, namely a hash of the public key for P2KH and the hash of the reedemScript for P2SH.
Copy link
Contributor

Choose a reason for hiding this comment

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

The part that readers will probably want to know is "how is this hash calculated".

Link to other spec would be good.

Some typo corrections:

deserves

explanation

cashaddr.md Outdated
The data to be fed are:
1. The lower 5 bits of each characters of the prefix.
2. A zero for the separator.
3. The payload by chunks of 5 bits.
Copy link
Contributor

@ftrader ftrader Oct 14, 2017

Choose a reason for hiding this comment

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

"in chunks of"

I think the spec should clarify how payload needs to be padded to split into 5-bit chunks

cashaddr.md Outdated
}
````

The data to be fed are:
Copy link
Contributor

Choose a reason for hiding this comment

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

It's pretty clear what is meant, but I would still suggest to make it clearer:

-> The checksum is calculated over the following data:

cashaddr.md Outdated

Lower case is preferred for cashaddr, but uppercase is accepted. A mixture of lower case and uppercase must be rejected.

Allowing for uppercase ensure that the address can be encoded effisciently in QR codes using the alphanumeric mode[[2]](#alphanumqr).
Copy link
Contributor

@ftrader ftrader Oct 14, 2017

Choose a reason for hiding this comment

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

Then why not normalize everything to uppercase before checksum computations?

Also typo:

efficiently

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It doesn't chance anything, the text is not what is checksummed.


## Uppercase/lowercase

Lower case is preferred for cashaddr, but uppercase is accepted. A mixture of lower case and uppercase must be rejected.
Copy link
Contributor

Choose a reason for hiding this comment

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

See question on paragraph below


In some contexts, such as payment URLs or QR codes, the addresses are currently prefixed with `bitcoincash:`. In these contexts, the address must not be double prefixed.

## References
Copy link
Contributor

Choose a reason for hiding this comment

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

As indicated, a good reference for BCH codes linked to introduction would be nice.

Copy link
Contributor

Choose a reason for hiding this comment

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

Addressed in recent update.

@DesWurstes
Copy link

A Copay dev says they may cancel their new address format starting with C and switch to this proposal if this one becomes popular.

https://github.com/bitpay/copay/issues/6899#issuecomment-337210359

@deadalnix
Copy link
Collaborator Author

Updated the spec.

cashaddr.md Outdated

## References

<a name="bch">[2]</a> https://en.wikipedia.org/wiki/BCH_code
Copy link
Contributor

Choose a reason for hiding this comment

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

[2] -> [1]

cashaddr.md Outdated
The checksum is calculated over the following data:
1. The lower 5 bits of each characters of the prefix.
2. A zero for the separator (5 zero bits).
3. The payload by chunks of 5 bits. The payload is padded with zero bits up t the point where it is a multiple of 5 bits.
Copy link
Contributor

Choose a reason for hiding this comment

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

up t -> up to

cashaddr.md Outdated

The prefix indicates the network on which this addess is valid. It is set to `bitcoincash` for Bitcoin Cash main net, `xbctest` for bitcoin cash testnet and `xbcreg` for bitcoin cash regtest.

The prefix is followed by the spearator `:`.
Copy link
Contributor

Choose a reason for hiding this comment

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

spearator -> separator

@deadalnix
Copy link
Collaborator Author

Updated as per comments. I'll merge as @ftrader accepted and that comment are taken care of.

@deadalnix deadalnix merged commit 0fbb64e into bitcoincashorg:master Oct 17, 2017
@deadalnix deadalnix deleted the cashaddr branch October 17, 2017 21:15
@buzztiaan
Copy link

the document is lacking motivation?

@Spookerusa
Copy link

I don't have a CLUE what you guys are talking about, but it sure makes me nervous about the whole thing.

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.

None yet

6 participants