Skip to content

Use different datadirs for different signets #27494

Closed

Description

@ajtowns

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.

Activity

  1. ajtowns commented on Apr 19, 2023

    @ajtowns
    ContributorAuthor

    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?

  2. maflcko commented on Apr 19, 2023

    @maflcko
    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.

  3. theartpiece commented on Oct 25, 2023

    @theartpiece

    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

  4. maflcko commented on Oct 25, 2023

    @maflcko
    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.

  5. moawnallah commented on Dec 12, 2023

    @moawnallah

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

  6. jsarenik commented on Jan 29, 2024

    @jsarenik

    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

  7. InsanityMatrix commented on Jan 29, 2024

    @InsanityMatrix

    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! :)

  8. added a commit that references this issue on Sep 16, 2026
    d32a515
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions