2

how to dump private key from multisig address ? I tried with dumpprivkey RPC function but return error : Address does not refer to a key

1

You can't dump the private key for a multisig address because there are multiple key pairs (thus multiple possible private keys) assigned to the address. You need to specify which key pair you want. First, get the public keys belonging to that address by using:

$ bitcoin-cli getaddressinfo <your address>

{
  "address": "<your address>",
  ...
  "embedded": {
    ...
    "pubkeys": [
      "<pubkey 1>",
      "<pubkey n>",
      "..."
    ],
   ...
}

Assuming you want the private key corresponding to <pubkey 1>, you can convert it to a simple P2PKH address and then use dumpprivkey, for example:

$ hash160 <pubkey 1>
  <pubkey 1 hash>
$ echo 00<pubkey 1 hash> | xxd -r -p | base58 -c
  <P2PKH address>
$ bitcoin-cli dumpprivkey <P2PKH address>
  <privkey>

Where hash160 is just a bash script that uses openssl:

#!/bin/bash
## Command Line parsing
#######################

if [[ $# -lt 1 ]]; then
    echo "Usage: $ hash160 <input-hex>"
    exit 1
fi

inputHex=$1

hash1="$(printf $inputHex | xxd -r -p | openssl sha256 | cut -c 10-)"
printf $hash1 | xxd -r -p | openssl ripemd160 | cut -c 10-
1
  • very usefull, work on my case – Billy Adelphia Nov 27 '18 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.