json rpc – BIP67 + importmulti + multisig descriptors

I am trying to set up a Bitcoin Core watch only wallet using importmulti and a sh(multi(m,xpub1/*,...,xpubn/*)) remote descriptor, and then use deriveaddresses to receive receiving addresses.

Is it possible to import only BIP-67 compatible addresses in some way? With a remote descriptor I cannot manually order the multigrade script pubkeys on my side as suggested in this abandoned PR because my client only touches the xpubs of the account.

I could manually inspect and omit addresses until the pubkeys ask me, but that's really ugly and fragile.

bitcoind: using importmulti to import a single address to keypool does not work

I create a wallet with private keys disabled.

Then use importmulti like:


command curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "importmulti", "params":(({ "scriptPubKey": { "address": "bcrt1qeappehxje9d46zjeyvh3cqslzzda9p92nx2xg495e8memcjvppvqhk6hcn" }, "label": "Imported Address", "timestamp": "now", "watchonly": true, "keypool": true, "internal": false }), ''{"rescan": false}'') }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:18443/wallet/Test
result = Optional({
    error = "";
    id = curltest;
    result =     (
                {
            success = 1;
        }
    );
})

But when I run getnewaddress says empty keypool:

curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params":("", "bech32") }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:18443/wallet/Test
result = Optional({
    error =     {
        code = "-4";
        message = "Error: This wallet has no available keys";
    };
    id = curltest;
    result = "";
})

This also happens when I use importmulti Focus descriptor to import a multisig.

I am trying to create a watch-only wallet for my multisig, where the only key found in the key set is the multisig address, just to make the transactions with the wallet perfect.

Why importmulti does not support zpub and ypub?

As far as I can tell importmulti it does not work with zpub / ypub

Why not?

FWIW I prefer to deal only with xpubs, but I'm curious.

Bitcoin Core – How to import multi sig using importmulti correctly?

I create a 2 out of 2 with Createmultisig using 02254aba14091e45a9067fbe5b225b3863d1c49650226d583dcede06a7c33f8613 Y 02ad64a03b7fc53c02f68eac04743b819bfeeabe6ca7007f473dbaf7c3570f5dc9 pubkeys.

then I

curl --data-binary & # 39; {"jsonrpc": "1.0", "id": "curltest", "method": "importmulti", "params":[[{ "scriptPubKey": { "address": "2NETfDLgh1VmER2RGRnEeWqx73Hn4xhJpU5" }, "label": "Imported MultiSig", "timestamp": "now", "keypool": false, "internal": false, "redeemscript": "522102254aba14091e45a9067fbe5b225b3863d1c49650226d583dcede06a7c33f86132102ad64a03b7fc53c02f68eac04743b819bfeeabe6ca7007f473dbaf7c3570f5dc952ae", "pubkeys": ["02254aba14091e45a9067fbe5b225b3863d1c49650226d583dcede06a7c33f8613", "02ad64a03b7fc53c02f68eac04743b819bfeeabe6ca7007f473dbaf7c3570f5dc9"] }], & # 39; & # 39; {"rescan": false} & # 39; & # 39;]} & # 39; -H & # 39; content type: text / plan; & # 39; http: // user: password@127.0.0.1: 18332 /

What a warning returns:

success = 1;
warnings = (
"Import as not solvable: redeemScript does not match thePubKey script, if this is intentional, do not provide any key, access key, witness script or retransmission."
);

I'm using the redemption script and address. Createmultisig returns.

What am I doing wrong? Why is the redemption script incorrect?

My goal is to add the multi sig wallet to my node so that I can generate transactions with the wallet without having to manually enter the redemption script.

Bitcoin Core – How to properly use importmulti with coldcard wallet BIP84 xpub?

I've seen the HWI scripts, but I'm trying to do this while keeping my Coldcard with space in the air.

First I create a wallet in the bitcoin kernel with the private keys disabled.

I return the summary of the wallet on the SD card of the memory card and it goes out:

# Coldcard Wallet Summary file

## Wallet operates in blockchain: Bitcoin Testnet

For BIP44, this is coin_type & # 39; 1 & # 39 ;, and internally we use the XTN symbol for this chain of blocks.

## Top level extended public key, & # 39; master & # 39; (& # 39; m / & # 39;):

tpubD6NzVbkrYhZ4Y7XQkmZe9fchT8GBdsx9MSjEbnTPAhC1FPUHJLD9dcEudPWUayLGy1MtVqu73a2QfaUv3YB54yUNesAc8dShcUTUNmMhopy

Derived public keys, as necessary for different systems:


## For Bitcoin Core: m / {account} & # 39; / {change} & # 39; / {idx} & # 39;

m => tpubD6NzVbkrYhZ4Y7XQkmZe9fchT8GBdsx9MSjEbnTPAhC1FPUHJLD9dcEudPWUayLGy1MtVqu73a2QfaUv3YB54yUNesAc8dShcUTUNmMhopY

... 5 first receiving addresses (account = 0, change = 0):

m / 0 & # 39; / 0 & # 39; / 0 & # 39; => mwokgDX6HQREsFgevxZwKDxmVfDjEqwPuC
m / 0 & # 39; / 0 & # 39; / 1 & # 39; => mwGmYgnd3MDjaTXfp5dgq5YxNtGjfRyTuT
m / 0 & # 39; / 0 & # 39; / 2 & # 39; => mntHLuyhXr6QsVsWstRs3XFHaMXD8AKuLo
m / 0 & # 39; / 0 & # 39; / 3 & # 39; => msU7yGFgbqTJF9n55jYB8e3Hxh4hi7vhhF
m / 0 & # 39; / 0 & # 39; / 4 & # 39; => mjdKAoMcyieEwcscdvrnKzqu4r6bnfQMj1


## For Bitcoin Core (Segregated Witness, P2PKH): m / {account} & # 39; / {change} & # 39; / {idx} & # 39;

m => tpubD6NzVbkrYhZ4Y7XQkmZe9fchT8GBdsx9MSjEbnTPAhC1FPUHJLD9dcEudPWUayLGy1MtVqu73a2QfaUv3YB54yUNesAc8dShcUTUNmMhopY
Style # SLIP-132
m => vpub5SLqN2bLY4WeZixKds1JXa6Kn4sdmFU5yb6VgScU4mgMPuB7io2wF3FoLwW4f5CVVVVVVVVVVVVVGVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV: / / Serv.

... 5 first receiving addresses (account = 0, change = 0):

m / 0 & # 39; / 0 & # 39; / 0 & # 39; => tb1qk2hk9sdh0akzyc99nx65a2erpuftcek3v4mret
m / 0 & # 39; / 0 & # 39; / 1 & # 39; => tb1q4nfn0gme6yr9fezwlrdzdycfpztswal0j4l38m
m / 0 & # 39; / 0 & # 39; / 2 & # 39; => tb1q2rgcg659h4fte2c6dzljzskyjz5qfftrfwcyv7
m / 0 & # 39; / 0 & # 39; / 3 & # 39; => tb1qsvv9dv4g7uepe5pk0tf3cp7hdgnmtx5hp626ap
m / 0 & # 39; / 0 & # 39; / 4 & # 39; => tb1q952xefka88ep3s8htxgnw0n60a4spqwfppm5mu


## For Electrum (not BIP44): m / {change} / {idx}

m => tpubD6NzVbkrYhZ4Y7XQkmZe9fchT8GBdsx9MSjEbnTPAhC1FPUHJLD9dcEudPWUayLGy1MtVqu73a2QfaUv3YB54yUNesAc8dShcUTUNmMhopY

... 5 first receiving addresses (account = 0, change = 0):

m / 0/0 => mu7NuiLq1PsK7ncvE5cN3YPwU89wCjz4fC
m / 0/1 => mvSCNC4w9wBRksZwQsLPL4pyNMbHB8rFKy
m / 0/2 => mooEuT4TzKte4yvNxk4T7Du9K9vG1ZfjyK
m / 0/3 => mpuSJdR1W3WLEH1FN3KN3Mxye9dBnnJYd6
m / 0/4 => miwaFWAkjmAggdFGix4SGiSxaq4zzue78B


## For BIP44 / Electrum: m / 44 & # 39; / 1 & # 39; / {account} & # 39; / {change} / {idx}

m / 44 & # 39; / 1 & # 39; => tpubDALcajyQQtb5HRLZ8jAJhVhxbGVY7vSJWfxuYUknNMQDZzjQdWtge5GDNnqw5jB8wCDuDXp1tJQkFbZyE1YDNfqz

... 5 first receiving addresses (account = 0, change = 0):

m / 44 & # 39; / 1 & # 39; / 0 & # 39; / 0/0 => n2sEggcZ9vztixvwaEtf9aJPXTze4qcyEK
m / 44 & # 39; / 1 & # 39; / 0 & # 39; / 0/1 => mix1rdoLEzR1n7pmfkRLJRL2eCVhoL9xD6
m / 44 & # 39; / 1 & # 39; / 0 & # 39; / 0/2 => mwAy5FLgdKzGnjTwUbkpd7Fp97cRKNjY56
m / 44 & # 39; / 1 & # 39; / 0 & # 39; / 0/3 => mi5RvZpkR9yKtxLiVwWqYXiHaYzjskSKgF
m / 44 & # 39; / 1 & # 39; / 0 & # 39; / 0/4 => mujhjLQ9cpyqNjbv6NAPTUA6HWjBP64HZv


## For BIP49 (P2WPKH-nested-in-P2SH): m / 49 & # 39; / 1 & # 39; / {account} & # 39; / {change} / {idx}

m / 49 & # 39; / 1 & # 39; => tpubDBJSfnStqiS6NpVyZjTGpR27FQQG5x6nAKwycydndiNUcuexWGYbc5aW5KE9bAKmkpcP.pcWQF6ihZySoZHRLZk3hCFGKkbcpcP.p.C.P.P.P.P.P.P.P.G.
Style # SLIP-132
m / 49 & # 39; / 1 & # 39; => upub5CS2EYcTgPrCZ8jmcU7JzEQEQNsGGhdDsMo1vEtz9nUwiKYZSMFqqwcq1pcpc3e6rTVbd5P6R9etZ7DF631nqQwqqpcp

... 5 first receiving addresses (account = 0, change = 0):

m / 49 & # 39; / 1 & # 39; / 0 & # 39; / 0/0 => 2NFLZEZVQizq4j1RbPmrM4PDCBVBJT8yz8g
m / 49 & # 39; / 1 & # 39; / 0 & # 39; / 0/1 => 2MtnK8YM3trNgW1SGKnHVLxUGQinHJ9gzJN
m / 49 & # 39; / 1 & # 39; / 0 & # 39; / 0/2 => 2Muj9cwcCCm6r7qpLxUHe1mRz4D1ikmuGSu
m / 49 & # 39; / 1 & # 39; / 0 & # 39; / 0/3 => 2NAwepU6eSdb1c6nnV13SJAqSJEYjbUeNGB
m / 49 & # 39; / 1 & # 39; / 0 & # 39; / 0/4 => 2N7bVgw1d1jmipnFL95droVt5JgKvfw9cRr


## For BIP84 (Native Segwit P2PKH): m / 84 & # 39; / 1 & # 39; / {account} & # 39; / {change} / {idx}

m / 84 & # 39; / 1 & # 39; => tpubDAZhhJ9SaAKCt2gngU8aA2babxVAM93oBgo2wGknMUDmtLrzvLnynFuAYo4eME3MqWpcTM3DpGL9J45nQw7CA7VroAY8e7v9zo
Style # SLIP-132
m / 84 & # 39; / 1 & # 39; => vpub5WXYZiyvZXGnue7hZZaEXw5Cvu6cUWZjoqAJ1vusFYi82rZqLocmPgppacepp

... 5 first receiving addresses (account = 0, change = 0):

m / 84 & # 39; / 1 & # 39; / 0 & # 39; / 0/0 => tb1qtymulkjmx26pvq6n45sly2gmttwc4g5vtgzxez
m / 84 & # 39; / 1 & # 39; / 0 & # 39; / 0/1 => tb1q4gcq8et9qvjy3cffzqmhr2qtchhvdy9x6v08cd
m / 84 & # 39; / 1 & # 39; / 0 & # 39; / 0/2 => tb1qnmw70uefcns626xu4umftmqx8n7wjusxej7k32
m / 84 & # 39; / 1 & # 39; / 0 & # 39; / 0/3 => tb1qzdtj4cn6kj3lt3uha9my2skh0a99e0u59tw45r
m / 84 & # 39; / 1 & # 39; / 0 & # 39; / 0/4 => tb1q27ysu4ut4v3wv4xsq55wvrlyn7n4xqjfsslz4h

I want to import the BIP84 tpub, so I use the BIP84 tpub as indicated above.

In the bitcoin core I call:

bitcoin-cli getdescriptorinfo "wpkh ([18734cbe/84h/1h/0h]tpubDAZhhJ9SaAKCt2gngU8aA2babxVAM93oBgo2wGknMUDmtLrzvLnynFuAYo4eME3MqWpcTM3DpGL9J45nQw7CA7VroAY8e7v9Zo6r7mddUUMS
/ 0 / *) "

responseString = {

"descriptor": "wpkh ([18734cbe/84'/1'/0']tpubDAZhhJ9SaAKCt2gngU8aA2babxVAM93oBgo2wGknMUDmtLrzvLnynFuAYo4eME3MqWpcTM3DpGL9J / Pp.
"isrange": true,
"available": true,
"hasprivatekeys": false

}

bitcoin-cli -rpcwallet = BIP84 importmulti & # 39;[{ "desc": "wpkh([18734cbe/84'"'"'/1'"'"'/0'"'"']tpubDAZhhJ9SaAKCt2gngU8aA2babxVAM93oBgo2wGknMUDmtLrzvLnynFuAYo4eME3MqWpcTM3DpGL9JPPNGNPPGNPPNGPPPGNPPGPGPPGPPPGPJPGPGPPGPJPPPGPPGPGPGPGPPPGPJPPPGPGPPPGPGPPPGPJPPPGPGPPPGPJPPPGPGPPPGPJPPPGPGPPPPGPPPGPPPPGPPPPGPPPGPPPPGPPPPGPPPGG [0, 99], "watchonly": true, "label": "Cold storage completely ignored", "keypool": true, "internal": false}]& # 39; & # 39; {"re-scan": false} & # 39;

result = (
{
success = 1;
}
)

I have tried many combinations, but this reflects the instructions I found here https://github.com/bitcoin-core/HWI/blob/master/docs/bitcoin-core-usage.md

When he called:

bitcoin-cli -rpcwallet = BIP84 getnewaddress "*", "bech32"
responseString = tb1qf3fvy6s4a6y659cmrp829z9g8743ne7zynrzdu

That is not a correct address. Can someone point out what I'm doing wrong here?

Bitcoin Core – Importmulti with BIP84 derivation always fails

I've been trying to prove importmulti with BIP84 derivation like this:

bitcoin-cli -rpcwallet = BIP84Test importmulti & # 39;[{ "desc": "wpkh([18734cbe/84'/0'/0']xpub6AC5B4KkrtMkXmzUWAiVVYWvhzwMJDX46ZJhm2tusm7SPc2KjeSqwEjLTaB8vAo7evpkportepcggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg [0, 99], "watchonly": true, "tag": "Cold storage completely ignored", "set of keys": true, "internal": false, "re-scan": false}]& # 39;

But I always get an error:

-bash: syntax error near the unexpected token `) & # 39;

I tried to replace [18734cbe/84'/0'/0'] with [18734cbe/84h/0h/0h]

Y [18734cbe/84'/0'/0']

But everything returns errors. Is there something obvious that I am doing wrong?

I get the descriptor of getdescriptorinfo

Bitcoin Core: the use of importmulti with the internal set in true does not add any change key. What am I doing wrong?

First, I call:

curl --data-binary & # 39; {"jsonrpc": "1.0", "id": "curltest", "method": "createwallet", "params":["ColdWallet", true] } & # 39; -H & # 39; content type: text / plan; & # 39; http: // user: password@127.0.0.1: 18332 /

What it returns:

result = {
name = ColdWallet;
warning = "";
}

Then I import the keys to the keyset:

bitcoin-cli getdescriptorinfo "wpkh (tpubDFLL8VNUhpLNVLw8179WCEuMZtKtTDd7EeYeFDtThzis jc /

responseString = {

"descriptor": "wpkh"
"isrange": true,
"available": true,
"hasprivatekeys": false

}

bitcoin-cli -rpcwallet = ColdWallet importmulti & # 39;[{ "desc": "wpkh(tpubDFLL8VNUhpLNVLw8179WCEuMZtKtTDd7EeYeFDtThzisj6wfJ4Zi43qUvCE7ciCFxVKZYssRr9P9PerLefkVEjKL6CphUvbGv1CrSCS2KUB/*)#udrnh6f5", "timestamp": "now", "range": [0, 99], "watchonly": true, "tag": "Cold storage completely ignored", "set of keys": true, "internal": false, "re-scan": false}]& # 39;

result = (
{
success = 1;
}
)

Then I put myself keypool to false Y internal to true:

bitcoin-cli -rpcwallet = ColdWallet importmulti & # 39;[{ "desc": "wpkh(tpubDFLL8VNUhpLNVLw8179WCEuMZtKtTDd7EeYeFDtThzisj6wfJ4Zi43qUvCE7ciCFxVKZYssRr9P9PerLefkVEjKL6CphUvbGv1CrSCS2KUB/*)#udrnh6f5", "timestamp": "now", "range": [100, 199], "watchonly": true, "set of keys": false, "internal": true, "re-scan": false}]& # 39;

result = (
{
success = 1;
}
)

I can use getnewaddress -rpcwallet = ColdWallet No problem but if I try:

curl --data-binary & # 39; {"jsonrpc": "1.0", "id": "curltest", "method": "walletcreatefundedpsbt", "params":[[],[{"mxV3ojsAHKuYHoDVqYczs6iPAfCCYESEDc":0.0001}]]} & # 39; -H & # 39; content type: text / plan; & # 39; http: // user: password@127.0.0.1: 18332 / wallet / ColdWallet

result = {

error = {
code = "-4";
message = "Unable to generate an address change key. There are no keys in the internal key set and no key can be generated.";
};
id = curltest;
result = "";

}

Also calling bitcoin-cli rpcwallet = ColdWallet getwalletinfo

returns:

{
"walletname": "ColdWallet",
"Walletversion": 169900,
"balance": 0.00000000,
"balance not confirmed": 0.00000000,
"immature_balance": 0.00000000,
"txcount": 1,
"keypoololdest": 1561077339,
"keypoolsize": 98,
"keypoolsize_hd_internal": 0,
"paytxfee": 0.00000000,
"private_keys_enabled": false
}

Is this an error? Or am I doing something wrong?

I am using Bitcoin Core as a back-end for an application that I am developing and I want the user to be able to easily create cold transactions with the keys that matter in the wallet without having to specify a change address each time.

Bitcoin Core: when I use importmulti with an xprv, private keys never matter. What am I doing wrong?

When he called:

bitcoin-cli getdescriptorinfo "pkh (tpv8iDvhA6eaMDbRuH3D2DTNuH6N6LvMTVrcv7z6sVxyyY v.

returns:

{
"descriptor": "pkh (tpubDEuxqa8tiiuGKNJq6ft3nJwCw7rrWngmCDimPPYGQFMKJBhLpqPdtYT some of the main parts of this article in English).
"isrange": true,
"available": true,
"hasprivatekeys": true
}

Then I call

bitcoin-cli importmulti & # 39;[{ "desc": "pkh(tpubDEuxqa8tiiuGKNJq6ft3nJwCw7rrWngmCDimPPYGQFMKJBhLpqPdtYT7fzuDbk1AppxRdYjzeUrLaVNQRP7EYghzLDBMguY2LHHHeHMtzhm/*)#0wkkha79", "timestamp": "now", "range": 100, "watchonly": false, "label": "Hot Storage", "keypool": false, "rescan": false }]& # 39;

Returns:

{
"success": true,
"warnings": [
      "Some private keys are missing, outputs will be considered watchonly. If this is intentional, specify the watchonly flag."
    ]
  }

I am importing an xprv because I want to import the private keys, but they are always imported as just surveillance.

Why is this? Is it intentional?

Bitcoin Core: how does the portfolio prioritize imported keypool addresses through importmulti?

I want to use importmulti to import 100 addresses from an xpub descriptor.

If I put keypool: true As one of the arguments, the keys are added to the set of keys.

How does the wallet prioritize what keys it generates when calling? get new address? Will you prioritize the imported addresses or do I have to request the imported address through label argument in get new address? What happens if I do not add a label argument to the importmulti I send?

bitcoin core – How to import an xprv using descriptors and importmulti?

I discovered how to import an xpub, but when I use it getdescriptorinfo in an xprv:

getdescriptorinfo "wpkh (xprvA1Gpa5TRogN9eRoBFZLAEKjfvxzXTZpNpuJ9WXvTsRT3ZoW1EFnrAzxji4aYpacespacespacespacespacespacespacespacespacespapaspacespacespacespacespacespacespacesparespacespacespacespacespacespacespacesblests

returns

{
""
"isrange": true,
"available": true,
"hasprivatekeys": true
}

The descriptor is an xpub? Why? See that the key has private keys. If I use this descriptor with importmulti and specify a range, will it import the keys and private addresses? I was waiting getdescriptorinfo to return an xprv. If this is not the way an xprv matters, how does it do it?