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

Support cashaddr #314

Merged
merged 23 commits into from Feb 16, 2018
Merged

Support cashaddr #314

merged 23 commits into from Feb 16, 2018

Conversation

dagurval
Copy link
Member

Depends on #305, #308, #313

This adds cashaddr support. Needs more testing - marking as WIP for now.

sipa and others added 14 commits February 5, 2018 11:44
Summary:
This is extracted from D544 .

based on code from Pieter Wuille.

Test Plan: Added unit tests.

Reviewers: dagurval, #bitcoin_abc, tomtomtom7

Reviewed By: dagurval, #bitcoin_abc, tomtomtom7

Differential Revision: https://reviews.bitcoinabc.org/D572
Summary:
This is split from D544 plus implement a candidate BCH code of degree 8 for it. The BCH code can detect up to 6 errors over the typical length of an address and up to 8 errors in a row.

This is intended to serve as a base to get the new address format started.

Test Plan: Added unittests.

Reviewers: #bitcoin_abc, dagurval

Reviewed By: #bitcoin_abc, dagurval

Subscribers: dagurval

Differential Revision: https://reviews.bitcoinabc.org/D576
Summary: This makes it translate more naturally from/to the spec.

Test Plan:
  make check

Reviewers: dagurval, #bitcoin_abc

Reviewed By: dagurval, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D599
Summary: Reflects changes in bitcoincashorg/spec#31

Test Plan: make check

Reviewers: #bitcoin_abc, Mengerian, schancel

Reviewed By: #bitcoin_abc, Mengerian, schancel

Differential Revision: https://reviews.bitcoinabc.org/D682
Summary: Make these functions reusable.

Test Plan: None

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D631
Summary: Depends on D631

Test Plan: Added unittests.

Reviewers: #bitcoin_abc, schancel, deadalnix

Reviewed By: #bitcoin_abc, schancel, deadalnix

Subscribers: deadalnix, schancel

Differential Revision: https://reviews.bitcoinabc.org/D623
…creation step

Summary: This allows for much more in depth testing, even for destination we don't have support for.

Test Plan: Added a bunch of unittests.

Reviewers: dagurval, schancel, freetrader, #bitcoin_abc

Reviewed By: dagurval, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D652
Summary: As per title. It's doing the same computation twice.

Test Plan:
  make check

Reviewers: dagurval, schancel, #bitcoin_abc

Reviewed By: schancel, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D746
Summary: Fix the construction logic for check_size test.

Test Plan: make check

Reviewers: deadalnix, dagurval, freetrader, #bitcoin_abc

Reviewed By: deadalnix, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D762
Summary: Encode the hash size in the version bit

Test Plan: make -j8 src/test/test_bitcoin && src/test/test_bitcoin --run_test='cashaddrenc_tests/*'

Reviewers: deadalnix, freetrader, dagurval, #bitcoin_abc

Reviewed By: deadalnix, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D761
Summary: This makes for a much more pleasant UX.

Test Plan:
Added unittests.

In addition, try to send coin on testnet using both cashaddr with and without prefix and legacy addresses, with and without the `-usecashaddr` flag.

Reviewers: schancel, dagurval, #bitcoin_abc, Mengerian

Reviewed By: schancel, #bitcoin_abc, Mengerian

Subscribers: Mengerian

Differential Revision: https://reviews.bitcoinabc.org/D839
Wraps both cashaddr and base58 addresses into EncodeDestination and
DecodeDestination.
dagurval and others added 9 commits February 5, 2018 12:02
Summary:
Previously destinations were encoded with EncodeDestination, which
depends on user configuration. WalletDB needs consistent encoding.

Base58 encoding is used for backward compatibility.

Tests for Purpose, Name and DestData in CWalletDB

Test Plan: added tests

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D745
Summary:
Windows is a bit more restrictive when it comes to files not properly closed and alike. This caused an error in the cleanup after running hte test (the DB files were kept open and couldn't be deleted).

This ensure that the DB is closed properly after use. The use of MockDB ensure that files shared accross DB instance such as db.log do get mamaged in memory instead of on disk.

Test Plan:
Cross compile windows binaries, then

  wine src/test/test_bitcoin.exe -t walletdb_tests

Reviewers: schancel, #bitcoin_abc

Reviewed By: schancel, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D791
Summary: Depends on D708

Test Plan: added tests

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D709
Test Plan: qt unittests

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D769
Summary: Adds support for the new uri schemes introduced by cashaddr.

Test Plan: Added tests

Reviewers: deadalnix, schancel, kyuupichan, #bitcoin_abc

Reviewed By: deadalnix, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D797
Summary:
This makes the client support parsing cashaddr encoded addresses for all networks.

Depends on D797

Test Plan:
  ./bitcoin-qt "bitcoincash:mz8DUu5atAfNEBNeQHrpdGkfWZ9vmk3Q13?amount=42.00000000&label=test1&message=a%20message"

Ensure that the client boot in testnet mode and the proper sent is prefilled.

  ./bitcoin-qt "bitcoincash:1F6MqpCw3f8JRErcZMYjkFLBzpFvvjobZZ?amount=42.00000000&label=mainnet1&message=a%20message"

Ensure the client boots in mainnet and the sent form is prefilled.

  ./bitcoin-qt "bchtest:qp5dzwdct8xcpec62z799rdfpylxftsl6v0trfz2m9?amount=42.00000000&label=cashtest2&message=a%20message" "bitcoincash:mz8DUu5atAfNEBNeQHrpdGkfWZ9vmk3Q13?amount=42.00000000&label=test1&message=a%20message"

Ensure that the client start on testnet and fill up the sent form properly.

  ./bitcoin-qt "bitcoincash:qrc5xvnqwv3esj8hs5w85gh3xjwgnnjfvv3ll6wmdu?amount=42.00000000&label=test3&message=a%20message" "bitcoincash:1F6MqpCw3f8JRErcZMYjkFLBzpFvvjobZZ?amount=42.00000000&label=mainnet1&message=a%20message"

dito

  ./bitcoin-qt "bchreg:qrxvv8fpv42wvlls6z4mp9qvrs3kar2pau5tssl8xd?amount=42.00000000&label=cashtest1&message=a%20message"

Start in regtest mode.

Reviewers: #bitcoin_abc, dagurval, schancel

Reviewed By: #bitcoin_abc, schancel

Subscribers: schancel, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D583
Summary:
The address associated with a receive request is encoded using the
configuration of the client at the time. This can be either base58 or
cashaddr.

When displaying an existing receive request, display with the currently
configured encoding.

Test Plan:
- Added test.
- Create two requests, one running with -usecashaddr and one without.
- Start client with and without -usercashaddr, observe that requests are displayed correct.

Reviewers: #bitcoin_abc, dagurval

Reviewed By: #bitcoin_abc, dagurval

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D801
This is two commits from ABC squashed:
11a84a2d0 by dagurval and ab79db66f by deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D552
Differential Revision: https://reviews.bitcoinabc.org/D838
@dagurval dagurval changed the title Support cashaddr [WIP] Support cashaddr Feb 5, 2018
@dgenr8 dgenr8 self-requested a review February 14, 2018 21:57
* new valid list. For that reason, cashaddr requires the resulting checksum
* to be 1 instead.
*/
return c ^ 1;
Copy link
Member

Choose a reason for hiding this comment

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

So this is a strict improvement over the original from https://github.com/sipa/bech32/blob/master/ref/c%2B%2B/bech32.cpp#L84 ?

@dgenr8 dgenr8 merged commit 88da790 into bitcoinxt:master Feb 16, 2018
@dgenr8
Copy link
Member

dgenr8 commented Feb 16, 2018

The dimmed-out example addresses in the send dialog are cashaddrs even when -usecashaddr=0, but these examples aren't totally dumb - they are network-sensitive.

@dagurval dagurval deleted the 19-01-cashaddr branch February 16, 2018 05:31
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

Successfully merging this pull request may close these issues.

None yet

5 participants