Sunday, December 22, 2024

python – How can I tweak a personal key in bitcoin core

I’ve finished the bitcoin taproot workshop a pair occasions now and beginning to get a grip of what’s going on, however I can not discover the place I can do the identical issues within the workshop’s supplied python libraries with bitcoin core

I believe it’s good to be clearer on precisely what you wish to obtain. There may be Taproot code in Python within the Bitcoin Core purposeful checks if you wish to dig a bit deeper for academic functions in Python. However that is not set as much as be a standalone library to work together with. A Python library that does have Taproot assist (and MuSig2 assist) is buidl-python. Different Python libraries like python-bitcoinlib, ofek’s bit and darosior’s python-bip380 do not assist Taproot on the time of writing (Might 2023) sadly.

May bitcoin core profit from this added performance? Command’s like tweak add, Tapleaf development of csa, hashlock, csa hashlock delay and correct Tapscript development?

Bitcoin Core as a full node implementation already helps verifying any Taproot spend in C++. The Bitcoin Core pockets helps Taproot by way of the tr() descriptor once more written in C++. OP_CHECKSIGADD (CSA) is supported by way of the multi_a and sortedmulti_a descriptors throughout the tr() descriptor. Hashlocks is not on the time of writing (Might 2023) supported throughout the tr() descriptor however there’s a PR open (PR 27255) so as to add Taproot’d Miniscript to the Bitcoin Core pockets which might allow it.

I can generate a brand new tackle, however how do I tweak it with the faucet script?

A word on the terminology. You tweak the inner public key, you do not tweak the tackle. The way you tweak the inner public secret is defined within the Bitcoin Optech Taproot workshop right here.

I am additionally cautious of producing my very own keys, because the workshop says particularly not to try this. “Dangerous randomness and no aspect channel safety.” to loosely quote.

Proper now it looks like I must implement these options in a separate python library, perhaps by calling bindings to secp256k1 lib for protected randomness?

In case you are utilizing signet or testnet cash you needn’t fear about dangerous randomness and doubtlessly dropping your cash. However word the randomness for seeds, non-public keys is not generated in secp256k1, it’s generated in the primary Core repo (random.cpp).

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles