I get a not a P2TR scriptPubKey error when trying to generate a bech32m taproot complient P2TR address with python
I have the following script that is supposed to derive a taproot P2TR address:
from bitcointx import set_custom_secp256k1_path set_custom_secp256k1_path('./bitcointx_secp256k1_here/libsecp256k1.2.dylib') from bitcointx.wallet import P2TRBitcoinTestnetAddress, P2TRCoinAddress, CBitcoinTestnetKey, CBitcoinTestnetExtKey from bitcointx.core.script import (CScript, OP_CHECKSIG, OP_NUMEQUAL, CScriptWitness) sender_priv_key = CBitcoinTestnetExtKey('PRIVATE KEY TESTNET EXTENDED WIF') sender_pub_key = sender_priv_key.pub csript_from_pub = CScript([sender_pub_key, OP_CHECKSIG]) addrs_for_script = P2TRBitcoinTestnetAddress.from_scriptPubKey(csript_from_pub) print(addrs_for_script)
But all that this prints in my terminal is:
Traceback (most recent call last): File "/Users/MYUSERNAME/Desktop/Dev/bit_useful_scripts/simple_send_from_segv1.py", line 12, in <module> addrs_for_script = P2TRBitcoinTestnetAddress.from_scriptPubKey(csript_from_pub) File "/Users/MYUSERNAME/.virtualenvs/py_scratch_310_071722/lib/python3.10/site-packages/bitcointx/util.py", line 331, in wrapper return fn(*args, **kwargs) File "/Users/MYUSERNAME/.virtualenvs/py_scratch_310_071722/lib/python3.10/site-packages/bitcointx/wallet.py", line 504, in from_scriptPubKey raise P2TRCoinAddressError('not a P2TR scriptPubKey') bitcointx.wallet.P2TRCoinAddressError: not a P2TR scriptPubKey
It fails with a "not a P2TR scriptPubKey" error.
I know that PRIVATE KEY TESTNET EXTENDED WIF is capable of producing a P2TR address. What am I doing wrong?
06 June 2023
Blockstream Greenlight: Scalable, Non-Custodial Lightning Infrastructure Now Open to Developers
Just over two years ago, Blockstream conceived of Greenlight: a groundbreaking Lightning hosting infrastructure that scales your Lightning deployments without compromise or custody. The last year of testing with partners has proven Greenlight both stable and simple to use. Today, we are open-sourcing the client repository and opening sign-ups to
06 June 2023
Fees are finally low again. Time for some UTXOs Consolidation.
Optimize your wallet with UTXO consolidation. Unify all the Unspent Transaction Outputs for efficient asset management and lower fees.
06 June 2023
SEC Sues US-Based Crypto Exchange Coinbase
The SEC sued Coinbase accusing the exchange of operating without registering as a broker, among other charges.