Home Bitcoin pockets – descriptor and Customized script

pockets – descriptor and Customized script

0
pockets – descriptor and Customized script

[ad_1]

I’ve a Multisignature handle 1-3 with a verification of OP_3, only a easy script to grasp customized scripts in Bitcoin

Script definition

#OP_1 <Public Key> <Public Key> <Public Key> 3 OP_CHECKMULTISIGVERIFY OP_3 OP_EQUAL
SCRIPT="5121"$(cat compressed_public_key_1.txt)"21"$(cat compressed_public_key_2.txt)"21"$(cat compressed_public_key_3.txt)"53AF5387"

Now, I wish to import my handle utilizing descriptor

PK1=`cat compressed_private_key_WIF_1.txt`
PK2=`cat compressed_private_key_WIF_2.txt`
PK3=`cat compressed_private_key_WIF_3.txt`
CHECKSUM=$(bitcoin-cli getdescriptorinfo "sh(multi(1,$PK1,$PK2,$PK3))" | jq -r .checksum)
bitcoin-cli importdescriptors '[{ "desc": "sh(multi(1,'$PK1','$PK2','$PK3'))#'$CHECKSUM'", "timestamp": "now", "internal": true }]'

The issue is I can not have the identical handle as a result of the script is completely different.
I’ll do the signature manually, just for examine functions.
I learn https://github.com/bitcoin/bitcoin/blob/grasp/doc/descriptors.md however I did not discover any assist about my drawback.

Utilizing Legacy code, I used to be capable of import

bitcoin-cli importaddress $ADDR_P2SH

The place $ADDR_P2SH is the results of my handle 1-3.

Is it attainable to make use of a customized script utilizing a descriptor? If I perceive, a descriptor is “like a perform,” so I do not know if a “customized” perform is obtainable.

Replace

Because of Antoine Poinsot, I’m posting the answer. Perhaps it may very well be helpful to somebody.

ADDR_P2SH=`cat address_P2SH.txt`
bitcoin-cli -named createwallet wallet_name="bia" disable_private_keys=true


CHECKSUM=$(bitcoin-cli getdescriptorinfo "addr($(cat address_P2SH.txt))" | jq -r .checksum)
bitcoin-cli -rpcwallet=bia importdescriptors '[{ "desc": "addr('$(cat address_P2SH.txt)')#'$CHECKSUM'", "timestamp": "now", "internal": true }]'

and I get the UTXO with

UTXO=`bitcoin-cli -rpcwallet=bia listunspent 1 101 '["'$ADDR_P2SH'"]'`

[ad_2]

Supply hyperlink

LEAVE A REPLY

Please enter your comment!
Please enter your name here