Donno1994 / TapWallet

A taproot dedicated wallet. It can spend via keypath and scriptpath
Other
22 stars 4 forks source link

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

Open jjhesk opened 8 months ago

jjhesk commented 8 months ago

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. https://github.com/meherett/python-hdwallet/issues/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 commented 8 months ago

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 commented 8 months ago

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.