Signet mining is not possible when using descriptor wallet #28911

issue fujicoin opened this issue on November 19, 2023
  1. fujicoin commented at 7:18 AM on November 19, 2023: none

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    Signet mining is not possible when using descriptor wallet. The error message is "PSBT signing failed"

    Errors were confirmed in the following two cases.

    1. In an environment where mining is performed using a legacy wallet, the wallet is changed to a descriptor type using the "migratewallet" command.
    2. A case where the private key descriptor of the address that generated the signetchallenge was imported into a new descriptor wallet.

    Expected behaviour

    signet mining

    Steps to reproduce

    bitcoin core v25.0, v26.0rc2

    Relevant log output

    PSBT signing failed

    How did you obtain Bitcoin Core

    Pre-built binaries

    What version of Bitcoin Core are you using?

    v25.0, v26.0rc2

    Operating system and version

    ubuntu22.04

    Machine specifications

    No response

  2. maflcko added the label Tests on Nov 19, 2023
  3. furszy commented at 3:32 PM on November 19, 2023: member

    Could you share the signet challenge?

    Quick guess; you defined the block script as a multisig, and you didn't import the multisig descriptor. The wallet will not automatically infer the multisig redeem script if it imported pk()/pkh()/wpkh() descriptors.

  4. fujicoin commented at 6:39 PM on November 19, 2023: none

    @furszy You can reproduce the phenomenon by following the steps below.

    wget https://bitcoincore.org/bin/bitcoin-core-25.0/bitcoin-25.0-x86_64-linux-gnu.tar.gz
    tar -xzvf bitcoin-25.0-x86_64-linux-gnu.tar.gz
    cd bitcoin-25.0
    mv bin/* .
    
    git clone https://github.com/bitcoin/bitcoin.git
    cd bitcoin
    git checkout v25.0
    cd ..
    cp -r bitcoin/test/functional/test_framework .
    cp bitcoin/contrib/signet/miner .
    
    ./bitcoind -regtest -daemon
    ./bitcoin-cli -regtest createwallet "test" false false "" false false
    ADDR=$(./bitcoin-cli -regtest getnewaddress "" "legacy")
    echo $ADDR
    mqKkNvg2zGLp7LrEkKzZyheg2RKxLpVGdx
    
    PRIVKEY=$(./bitcoin-cli -regtest dumpprivkey $ADDR)
    echo $PRIVKEY
    cPVg1oJmHSwWCgzAbAeH7ZcBHyqtGJBZCr79tj6fWgnVD4YNXcii
    
    ./bitcoin-cli -regtest getaddressinfo $ADDR | grep pubkey
      "pubkey": "03176706ed990b936e2348392c08cfc9b7a8550d88b2b4cde4175bfb3b8af6398e",
    
    ./bitcoin-cli -regtest stop
    
    CHALLENGE=512103176706ed990b936e2348392c08cfc9b7a8550d88b2b4cde4175bfb3b8af6398e51ae
    
    ./bitcoind -signet -daemon -signetchallenge=$CHALLENGE
    CLI="./bitcoin-cli -signet"
    $CLI createwallet "signet" false false "" false false
    $CLI -signet importprivkey $PRIVKEY
    
    MINER="./miner"
    GRIND="./bitcoin-util grind"
    ADDR=$(./bitcoin-cli -signet getnewaddress "" "legacy")
    echo $ADDR
    mvESocNVHsEmWurJ4V62CA6C4C8cwKYfLH
    
    NBITS=1e0377ae
    
    $MINER --cli="$CLI" generate --grind-cmd="$GRIND" --address="$ADDR" --nbits=$NBITS --set-block-time=1696086000
    2023-11-19 18:23:42 INFO Mined block at height 1; next in -1203h13m42s (mine)
    
    $MINER --cli="$CLI" generate --grind-cmd="$GRIND" --address="$ADDR" --nbits=$NBITS --ongoing
    2023-11-19 18:24:05 INFO Mined block at height 2; next in -1203h4m5s (mine)
    2023-11-19 18:24:06 INFO Mined block at height 3; next in -1202h54m5s (mine)
    2023-11-19 18:24:08 INFO Mined block at height 4; next in -1202h44m8s (mine)
    2023-11-19 18:24:11 INFO Mined block at height 5; next in -1202h34m11s (mine)
    2023-11-19 18:24:12 INFO Mined block at height 6; next in -1202h24m12s (mine)
    2023-11-19 18:24:13 INFO Mined block at height 7; next in -1202h14m13s (mine)
    2023-11-19 18:24:16 INFO Mined block at height 8; next in -1202h4m16s (mine)
    2023-11-19 18:24:16 INFO Mined block at height 9; next in -1201h54m16s (mine)
    2023-11-19 18:24:17 INFO Mined block at height 10; next in -1201h44m16s (mine)
    [Ctrl/C]
    
    $CLI migratewallet signet
    {
      "wallet_name": "signet",
      "backup_path": "/root/.bitcoin/signet/wallets/signet/signet-1700418526.legacy.bak"
    }
    
    $MINER --cli="$CLI" generate --grind-cmd="$GRIND" --address="$ADDR" --nbits=$NBITS --ongoing
    PSBT signing failed
    
  5. furszy commented at 7:39 PM on November 19, 2023: member

    Ok, yes. Thats what I imagined.

    Your challenge 512103176706ed990b936e2348392c08cfc9b7a8550d88b2b4cde4175bfb3b8af6398e51ae, is a 1-of-1 multisig of your pubkey. This script is not watched by your wallet by default, is a consensus parameter. The wallet migration process will not create the matching multisig descriptor without further instructions from your end.

    You either can:

    1. Import the multisig redeem script on the legacy wallet (pre-migration).
    2. Import the multisig descriptor on the descriptor wallet (post-migration).

    My advice for you is to create a descriptor wallet by default, not the legacy one anymore. And, if you still want to use the 1-of-1 multisig challenge; import the descriptor in the following form: multi(1, <priv_key>)#<checksum>. You can obtain the checksum by calling getdescriptorinfo "multi(1, $PRIVKEY)".

  6. fujicoin commented at 11:38 PM on November 19, 2023: none

    @furszy Thank you for your accurate advice. I confirmed that signet mining can be executed successfully using the second method (Import the multisig descriptor on the descriptor wallet).

  7. fujicoin closed this on Nov 20, 2023

  8. bitcoin locked this on Nov 19, 2024
Contributors
Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-29 03:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me