Skip to content

Conversation

@inaltoasinistra
Copy link
Contributor

The CBech32Data class implements an interface similar to CBase58Data, it encapsulates the python reference implementation of bech32 addresses.

@petertodd
Copy link
Owner

Looks like a good start!

We should think how we can present a decent API for this, along the lines of the existing CBitcoinAddress scheme. I haven't had a chance to review what Bitcoin Core is doing for that yet, and of course, that pull-req isn't quite merged yet either, so I think it's fine to wait until that happens and we're sure BIP173 is stabilized.

@dgpv dgpv mentioned this pull request Sep 17, 2018
BASE58_PREFIXES = {'PUBKEY_ADDR':111,
'SCRIPT_ADDR':196,
'SECRET_KEY' :239}
BECH32_HRP = 'tb'

Choose a reason for hiding this comment

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

Should be bcrt for regtest

@dbolser
Copy link

dbolser commented Dec 11, 2018

Yo @petertodd, can you make @dgpv or @Simplexum co-maintainer of this library?

@dgpv
Copy link
Contributor

dgpv commented Dec 11, 2018

Not applicable, as explained in Simplexum#17 (comment) - I am not willing to maintain original library, only our derivative library, that have reduced scope.

petertodd added a commit that referenced this pull request Aug 21, 2019
1547251 Bitcoin's default Regtest bech32 HRP is 'bcrt' not 'tb' (John Villar)
e8d2037 Add tests (genme)
542ac35  Add python2 support to CBech32BitcoinAddress (genme)
e872989 add str() tests for P2WPKHBitcoinAddress and P2WSHBitcoinAddress (Dmitry Petukhov)
7c2b4e1 add Bech32-encoded address support (Dmitry Petukhov)
737380e Add python2 support to bech32 (Martino Salvetti)
01083b7 Add BECH32_HRP in network parameters (Martino Salvetti)
dfaa0c2 Add Bech32 encoding/decoding; add CBech32Data (Martino Salvetti)

Pull request description:

  Add Bech32-encoded address support

  This is based on #154

  Introduce CBase58Address and CBech32Address

  make CBitcoinAddress a wrapper that returns CBase58Address or CBech32Address depending on input data

  introduce to_redeemScript() method, because for P2WPKHBitcoinAddress redeem script is not the same as scriptPubKey.

  unfortunately, for P2WSHBitcoinAddress to_redeemScript() cannot
  be implemented, as we need all pubkeys for that, and not only the hash.

Top commit has no ACKs.

Tree-SHA512: c2ea9a690c5f1a3d4f6f5d043396e8265adcfa0dc582daafb122a3f56e7eda2656051a07c294ea377034a221d83cb7864bc57265be0d02903f002412d86e384c
@dgpv
Copy link
Contributor

dgpv commented Sep 9, 2019

This was merged via #189

@petertodd petertodd closed this Sep 10, 2019
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.

5 participants