Use different datadirs for different signets #27494

issue ajtowns opened this issue on April 19, 2023
  1. ajtowns commented at 3:26 PM on April 19, 2023: contributor

    Please describe the feature you'd like to see added.

    From #27446 (comment):

    This brings up a related issue in that we can't have multiple signets in the same base datadir. All signets use the signet datadir, so any change of parameter may result in a bad chainstate for that signet node.

    I think we should instead look at implementing a more robust multiple signet solution that allows for multiple configurable consensus rules in a clean and simple way since clearly that's desired. Ideally we would have a single parameter that contains all of the rules being configured rather than having multiple for each rule. We should also make datadirs specific to each set of rules, ideally in a deterministic way.

  2. ajtowns added the label Feature on Apr 19, 2023
  3. maflcko added the label Tests on Apr 19, 2023
  4. ajtowns commented at 3:32 PM on April 19, 2023: contributor

    cc @achow101 @kallewoof

    An option might be to name the chain dir signet-XXXXXXXX instead of signet where the XXs are the pchMessageStart, or perhaps to have ~40 XXs instead of 8 and have them be the hash160 of the signet challenge?

  5. maflcko commented at 3:35 PM on April 19, 2023: member

    This looks like a breaking change, so one could carve out the current global default signet to keep the current folder name. Though, for other signets this breaking change seems fine.

  6. maflcko added the label good first issue on May 22, 2023
  7. theartpiece commented at 9:20 PM on October 25, 2023: none

    Hi

    We're students at UT Austin looking for an issue to work on for our course project. We are interested in this issue and aim to raise PR and get it approved within a month. We will appreciate your help.

    Regards

  8. maflcko commented at 9:23 PM on October 25, 2023: member

    Useful Skills

    • Compiling Bitcoin Core from source
    • Running the C++ unit tests and the Python functional tests
    • Basic signet understanding, Running signet
    • Basic understanding of the datadir handling in Bitcoin Core

    Guidance for new contributors

    Want to work on this issue?

    For guidance on contributing, please read CONTRIBUTING.md before opening your pull request.

  9. mohamedawnallah commented at 5:45 PM on December 12, 2023: none

    Hey, @theartpiece, Are you still working on this issue? If not, I’d like to pick it up. Thanks

  10. jsarenik commented at 10:29 AM on January 29, 2024: none

    I think that following scripts are related and may serve as an inspiration while keeping backward-compatibility.

    bch.sh

    For bitcoin-cli, this is bch.sh ("bitcoin cli here")

    #!/bin/sh
    
    test -d "$1" && { cd "$1"; shift; }
    test -d .bitcoin && cd .bitcoin
    
    # Handling of inside-the-wallet-dir cases
    echo $PWD | grep -q '/wallets' && {
      mypwd=$PWD
      until test "${PWD##*/}" = "wallets"; do cd ..; done
      wn=${mypwd##$PWD/}
      w="-rpcwallet=${wn}"
      test "$1" = "loadwallet" && add="$wn"
      cd ..
    }
    
    test "${PWD##*/}" = "signet" && chain=signet
    test "${PWD##*/}" = "testnet3" && chain=test
    test "${PWD##*/}" = "regtest" && chain=regtest
    test "$chain" = "" || ddir=${PWD%/*}
    
    exec bitcoin-cli $w -datadir=${ddir:-$PWD} -chain=${chain:-main} "$@" $add
    

    bdh.sh

    Following is bdh.sh (“bitcoin daemon here")

    #!/bin/sh
    
    test -d "$1" && { cd "$1"; shift; }
    test -d .bitcoin && cd .bitcoin
    
    test "${PWD##*/}" = "signet" && chain=signet
    test "${PWD##*/}" = "testnet3" && chain=test
    test "${PWD##*/}" = "regtest" && chain=regtest
    test "$chain" = "" || ddir=${PWD%/*}
    
    exec bitcoind "-datadir=${ddir:-$PWD}" -chain=${chain:-main} "$@"
    

    Usage

    cd /tmp
    mkdir -p tmpb/regtest
    cd tmpb/regtest
    bdh.sh -daemon
    bch.sh help
    

    HTH

  11. InsanityMatrix commented at 9:57 PM on January 29, 2024: none

    Hey, as I haven't seen this being tackled I will happily undertake it. Currently working on it at https://github.com/InsanityMatrix/bitcoin on branch "signet-datadir-changes"

    I plan to start with the initialization files and work my way through the files to change any references to the block directory depending on if it is a signet chain. and also plan on making it backwards compatible. Any help would be appreciated, just mention me if you have any ideas or contributions! :)

  12. maflcko removed the label good first issue on Feb 4, 2025

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-15 15:13 UTC

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