ofek / bit

Bitcoin made easy.
https://ofek.dev/bit/
MIT License
1.25k stars 216 forks source link

Looking to generate a bech32 address #180

Open ChristianOConnor opened 1 year ago

ChristianOConnor commented 1 year ago

Does bit allow for the creation of bech32 addresses?

Igor-san commented 1 year ago

Does bit allow for the creation of bech32 addresses?

Try like this `from bit import Key from bit.crypto import ripemd160_sha256 from bit.base32 import encode

key = Key.from_hex('0000000000000000000000000000000000000000000000000000000000000001') byte_public_key_comp = key._pk.public_key.format(compressed=True) witprog = ripemd160_sha256(byte_public_key_comp) segwit = encode('bc', 0, witprog) print("segwit", segwit)`