Coder Social home page Coder Social logo

Comments (5)

rockygsm avatar rockygsm commented on August 28, 2024 1

update:
keyx1 = Key(bytes_to_wif(bytes.fromhex('hexdata'),compressed=False)) seems fastest way currently. still 8% to 10% down from compressed address.

from bit.

anshukrsingh avatar anshukrsingh commented on August 28, 2024 1

so you know , how to get native segwit address,
key.segwit_address returns only nested p2sh segwit address, not native one that starts from bc1

from bit.

aserxmail avatar aserxmail commented on August 28, 2024

@rockygsm
Is there any way to generate the Native segwit address, and tabroot address.
I hope if not, it will be supported soon.

from bit.

mcauser avatar mcauser commented on August 28, 2024

public_key_to_address can display the uncompressed address without creating a new Key instance.

>>> from bit import Key
>>> from bit.format import public_key_to_address
>>> k = Key.from_hex('0000000000000000000000000000000000000000000000000000000000000001')

>>> k.address
'1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH'
# compressed P2PKH

>>> public_key_to_address(k._pk.public_key.format(compressed=True),'main')
'1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH'
# compressed P2PKH

>>> public_key_to_address(k._pk.public_key.format(compressed=False),'main')
'1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm'
# uncompressed P2PKH

from bit.

a-n-d-r avatar a-n-d-r commented on August 28, 2024

Is there any way to generate the Native segwit address

from bit import PrivateKey

def get_bech32_address():
    byte_public_key_comp = PrivateKey("your_private_key")._pk.public_key.format()
    witprog = ripemd160_sha256(byte_public_key_comp)
    bech32_address = encode('bc', 0, witprog)
    return bech32_address

print("SegWit Native:", get_bech32_address())

from bit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.