Use different datadirs for different signets #27494

issue ajtowns openend 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”)

     0#!/bin/sh
     1
     2test -d "$1" && { cd "$1"; shift; }
     3test -d .bitcoin && cd .bitcoin
     4
     5# Handling of inside-the-wallet-dir cases
     6echo $PWD | grep -q '/wallets' && {
     7  mypwd=$PWD
     8  until test "${PWD##*/}" = "wallets"; do cd ..; done
     9  wn=${mypwd##$PWD/}
    10  w="-rpcwallet=${wn}"
    11  test "$1" = "loadwallet" && add="$wn"
    12  cd ..
    13}
    14
    15test "${PWD##*/}" = "signet" && chain=signet
    16test "${PWD##*/}" = "testnet3" && chain=test
    17test "${PWD##*/}" = "regtest" && chain=regtest
    18test "$chain" = "" || ddir=${PWD%/*}
    19
    20exec bitcoin-cli $w -datadir=${ddir:-$PWD} -chain=${chain:-main} "$@" $add
    

    bdh.sh

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

     0#!/bin/sh
     1
     2test -d "$1" && { cd "$1"; shift; }
     3test -d .bitcoin && cd .bitcoin
     4
     5test "${PWD##*/}" = "signet" && chain=signet
     6test "${PWD##*/}" = "testnet3" && chain=test
     7test "${PWD##*/}" = "regtest" && chain=regtest
     8test "$chain" = "" || ddir=${PWD%/*}
     9
    10exec bitcoind "-datadir=${ddir:-$PWD}" -chain=${chain:-main} "$@"
    

    Usage

    0cd /tmp
    1mkdir -p tmpb/regtest
    2cd tmpb/regtest
    3bdh.sh -daemon
    4bch.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! :)


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: 2024-12-22 06:12 UTC

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