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

whats the configurations for HDwallet to be included for taproot #30

Open
jjhesk opened this issue Feb 5, 2024 · 2 comments
Open

whats the configurations for HDwallet to be included for taproot #30

jjhesk opened this issue Feb 5, 2024 · 2 comments

Comments

@jjhesk
Copy link

jjhesk commented Feb 5, 2024

Looking to another lib that does generate some private keys and public keys around bechm32. I have wrote some issues about the generation of the taproot Pay To Tap Root (P2TR). still not being confirmed. talonlab/python-hdwallet#84. are there any better ways to include into the library with given easy format.

class TaprootP2TR(Cryptocurrency):
    NAME = "BTC Coin"
    SYMBOL = "btc"
    NETWORK = "mainnet"
    SOURCE_CODE = None
    COIN_TYPE = CoinType({
        "INDEX": 800,
        "HARDENED": True
    })

    SCRIPT_ADDRESS = 0x55
    PUBLIC_KEY_ADDRESS = 0x1a
    SEGWIT_ADDRESS = SegwitAddress({
        "HRP": None,
        "VERSION": 0x00
    })

    EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({
        "P2PKH": 0x488ade4,
        "P2SH": 0x488ade4,
        "P2WPKH": None,
        "P2WPKH_IN_P2SH": None,
        "P2WSH": None,
        "P2WSH_IN_P2SH": None
    })
    EXTENDED_PUBLIC_KEY = ExtendedPublicKey({
        "P2PKH": 0x488b21e,
        "P2SH": 0x488b21e,
        "P2WPKH": None,
        "P2WPKH_IN_P2SH": None,
        "P2WSH": None,
        "P2WSH_IN_P2SH": None
    })

    MESSAGE_PREFIX = "\x19Beetlecoin Signed Message:\n"
    DEFAULT_PATH = f"m/86'/{str(COIN_TYPE)}/0'/0/0"
    WIF_SECRET_KEY = 0x99
@Donno1994
Copy link
Owner

Hi, I'm not sure what youre asking for.
Do you want to know how I create the taproot private and public keys?

Take a look at window.py / def enter_seed_details(self,seed_words=None)

root_key=bitcoinlib.keys.HDKey().from_passphrase(seed_words,password=self.entry_passphrase.get())
if(seed_counter!=self.seed_counter):return
account_0=root_key.subkey_for_path("m/86'/0'/0'")
self.ext_key=account_0

This will give you the extended key. The taproot path is "m/86'/0'/0'"

In container.py / class c_Container_PubKey (c_Container): / def init

priv_parent = self.ext_key.child_private(change_index) if(self.ext_key.secret is not None) else None
pub_parent = self.ext_key.child_public(change_index)

prv=test_framework.ECKey().set(priv_parent.child_private(address_index).secret)
pub=test_framework.ECPubKey().set(pub_parent.child_public(address_index).public_byte)

I'm not sure if this helps you.
I haven't worked on this project for almost two years now.

@jjhesk
Copy link
Author

jjhesk commented Feb 5, 2024

its all good. I am looking to solve the problems from finding the correct address for P2TR standard as mentioned works of OKX wallet and the works of unisats wallet they both have different ways to generate the bitcoin taproot address.

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

No branches or pull requests

2 participants