script: add script to generate example bitcoin.conf #22235

pull josibake wants to merge 6 commits into bitcoin:master from josibake:josibake-auto-generate-example-bitcoin-conf-file changing 7 files +114 −193
  1. josibake commented at 6:30 pm on June 13, 2021: member

    create a script for parsing the output from bitcoind --help to create an example conf file for new users

    problem

    per #10746 , bitcoin.conf not being put into the data directory during installation causes some confusion for users when running bitcoin. in the discussion on the issue, one proposed solution was to have an example config file and instruct users to cp it into their data directory after startup. in addition to #10746 , there have been other requests for a “skeleton config file” (https://github.com/bitcoin/bitcoin/issues/19641) to help users get started with configuring bitcoind.

    the main issue with an example config file is that it creates a second source of truth regarding what options are available for configuring bitcoind. this means any changes to the options (including the addition or removal of options) would have to be updated for the command line and also updated in the example file.

    this PR addresses this issue by providing a script to generate an example file directly from the bitcoind --help on-demand by running contrib/devtools/gen-bitcoin-conf.sh. this solution was originally proposed on #10746 and would also solve #19641 . this guarantees any changes made to the command-line options or the command-line options help would also be reflected in the example file after compiling and running the script.

    the main purpose of this script is to generate a config file to be included with releases, same as gen-manpages.sh. this ensures every release also includes an up-to-date, full example config file for users to edit. the script is also available for users who compile from source for generating an example config for their compiled binary.

    special considerations

    this removes the bitcoin.conf example file from the repo as it is now generated by this script. the original example file did contain extra text related to how to use certain options but going forward all option help docs should be moved into init.cpp

    this also edits init.cpp to have the option help indicate that -conf is not usable from the config file. this is similar to how -includeconf ’s help indicates it cannot be used from the command line

  2. DrahtBot added the label Build system on Jun 13, 2021
  3. DrahtBot added the label Scripts and tools on Jun 13, 2021
  4. in contrib/generate-example-bitcoin-conf.sh:10 in 634becfdcf outdated
    0@@ -0,0 +1,48 @@
    1+#!/usr/bin/env bash
    2+#
    3+# Copyright (c) 2019 The Bitcoin Core developers
    4+# Distributed under the MIT software license, see the accompanying
    5+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
    6+#
    7+
    8+# script for generating an example bitcoin.conf file from bitcoind -h
    9+
    


    jarolrod commented at 9:28 pm on June 13, 2021:

    to fix linter

    0export LC_ALL=C
    

    josibake commented at 2:30 pm on June 14, 2021:
    :+1:
  5. in share/examples/bitcoin.conf:9 in 634becfdcf outdated
    155-# Pre-generate this many public/private key pairs, so wallet backups will be valid for
    156-# both prior transactions and several dozen future transactions.
    157-#keypool=100
    158-
    159-# Maintain coinstats index used by the gettxoutsetinfo RPC (default: 0).
    160+#alertnotify=<cmd>
    


    jarolrod commented at 9:32 pm on June 13, 2021:
    The option should really appear after the help text

    josibake commented at 2:30 pm on June 14, 2021:
    good call-out, added an awk line for this
  6. klementtan commented at 4:50 pm on June 14, 2021: contributor

    Good effort on this. Having a generated bitcoin.conf would be very useful!

    Tested on macOs and built cleanly.

    I think it might be better to add bitcoin.conf to .gitignore since it would be generated from the build system. You can refer to this for what should be in .gitnore:

    https://github.com/bitcoin/bitcoin/pull/21911#issuecomment-838133285: If it is produced by our build system it should go into .gitignore.

  7. josibake commented at 4:58 pm on June 14, 2021: member

    I think it might be better to add bitcoin.conf to .gitignore since it would be generated from the build system.

    thanks for the feedback, @klementtan , i was conflicted on whether or not to remove bitcoin.conf from the repo, but the link you provided seems to indicate it should be removed. ill add it to the .gitignore

  8. josibake requested review from jarolrod on Jun 14, 2021
  9. in contrib/generate-example-bitcoin-conf.sh:3 in c4e94db152 outdated
    0@@ -0,0 +1,53 @@
    1+#!/usr/bin/env bash
    2+#
    3+# Copyright (c) 2019 The Bitcoin Core developers
    


    jarolrod commented at 3:41 am on June 15, 2021:
    0# Copyright (c) 2021 The Bitcoin Core developers
    
  10. jarolrod commented at 4:24 am on June 15, 2021: member

    This is definitely a nice-to-have

    The first three commits should be squashed (634becfdcf6bda55ec0c57b2f001a54ae6abaf5a, 54235a32b5b2b871c6e9d44ede743326def91a74, cf90dc75faf20ee9daeef68939cf2b6737a59e4f) because the addition of the generate-example-bitcoin-conf.sh script should be atomic.

    In regards to: c4e94db15266e613969d7e43690f8fa69e1e8fa2 I don’t think that we should remove the bitcoin.conf example file. We should keep the file as part of the repo. The script can update the bitcoin.conf example whenever there is a PR that changes an option or introduces an option.

    You should update bitcoin-conf.md where appropriate to mention the inclusion of this script. This can included in the commit that will be created when you squash the first three commits.

  11. josibake commented at 1:43 pm on June 15, 2021: member

    thanks, @jarolrod , will definitely update the bitcoin-conf.md

    I don’t think that we should remove the bitcoin.conf example file.

    do you have a reason you think it should be committed to the repo? #21911 indicates files generated by the build shouldn’t be committed.

    id also be worried about someone changing either the options or option help text and not running the script. this would cause

    1. weird conflicts when running in CI
    2. users modifying their local copy of the repo unexpectedly just by doing a make install
    3. the example conf being out of date with the command line options

    if the developer always remembers to run the script, none of the above would be problems, but im hesitant to rely on developers remembering to do a manual step.

    thoughts? also tagging @laanwj for input as he was the one who made the comment about build generated files being in .gitignore and originally suggested the idea of generating the bitcoin.conf example from bitcoind -h in #10746

  12. josibake requested review from jarolrod on Jun 15, 2021
  13. josibake force-pushed on Jun 17, 2021
  14. josibake force-pushed on Jun 18, 2021
  15. DrahtBot commented at 6:23 pm on June 27, 2021: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #24969 (Update bitcoin.conf by BradleyC)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  16. jonatack commented at 6:38 pm on June 27, 2021: contributor

    Reviewers, this pull request conflicts with the following ones:

    * [doc: repository IRC updates [#22349](/bitcoin-bitcoin/22349/)](https://github.com/bitcoin/bitcoin/pull/22349) by jonatack
    

    Removed the one-line change behind the conflict.

  17. shaavan commented at 6:09 pm on August 6, 2021: contributor

    tACK 9fab9de36db3b6aae3b2b51fa14357c2fdc90f0d Tested successfully on Ubuntu 20.04

    The PR is adding a script-based functionality to generate an example bitcoin.conf file instead of having a premade example bitcoin.conf file. This is done using a script generate-example-bitcoin-conf.sh, which uses some predefined text and the output of ./src/bitcoind --help to create an example bitcoin.conf file.

    Test failed while using both make install and ./contrib/generate-example-bitcoin-conf.sh command from root directory. Worked only after giving sudo permission to these commands. So tested successfully using sudo make install and sudo ./contrib/generate-example-bitcoin-conf.sh. This happened because the ./share/examples folder was protected by default and could not be modified until given sudo access.

    I agree with the changes made by this PR because now the example bitcoin.conf file is very highly detailed and arranged so that understanding and changing something on the file has become very easy compared to the master’s example bitcoin.conf file. Also in the current master the example bitcoin.conf file is fixed so we have to keep updating it, with each change that might effect working of bitcoin.conf file. With this PR the op is able to mitigate the example bitcoin.conf maintenance cost, by basically generating the file from ./src/bitcoind --help command. Which makes sure ./src/bitcoind --help and example bitcoin.conf file are always in sync.

    Though I agree with the concept I would highly recommend adding the following changes to the PR:

    1. In doc/bitcoin-conf.md file it should be mentioned that if both ways of creating the bitcoin.conf example file (make file and ./contrib/generate-example-bitcoin-conf.sh) fails then the issue could be that they require sudo permission to edit the ./share/examples folder.

    2. The PR describes the problem that it is trying to solve as:

      per #10746 , bitcoin.conf not being put into the data directory during installation causes some confusion for users when running bitcoin. more details in the issue

      But in reality, the PR is not doing anything to make it easier to put example bitcoin.conf file in the data directory. The aim of the PR, as far as I can see, is to improve example bitcoin.conf file’s flexibility wrt future changes in ./src/bitcoind --help, and to make it easy to use. So the PR description should be modified to display its motivations more accurately.

  18. josibake force-pushed on Aug 9, 2021
  19. josibake commented at 1:59 pm on August 9, 2021: member
    2\. So the PR description should be modified to display its motivations more accurately.
    

    good call out, i have updated the PR description to more accurately describe the problem this PR is addressing

    regarding your recommendation that the docs be updated to suggest running sudo make install, in general i am against recommending in docs that users run commands with sudo. id rather leave it to them to evaluate the error message and determine for themselves if running with sudo is necessary. i was also not able to reproduce the issue you are describing.

    while trying to recreate your issue, i did note that the script will fail if --prefix is used with ./configure and have updated the script to use src/bitcoind when generating the file. this change is reflected in https://github.com/bitcoin/bitcoin/pull/22235/commits/9df03cb5c5abd8f31a4e93b006d5d3dd09e52a1d

  20. josibake commented at 2:12 pm on August 9, 2021: member

    i was also not able to reproduce the issue you are describing

    worth mentioning, outside of this PR i normally encounter a failure running make install without sudo with the following error:

    0 /usr/bin/mkdir -p '/usr/local/lib'
    1 /bin/bash ../libtool --preserve-dup-deps  --mode=install /usr/bin/install -c   libbitcoinconsensus.la '/usr/local/lib'
    2libtool: install: /usr/bin/install -c .libs/libbitcoinconsensus.so.0.0.0 /usr/local/lib/libbitcoinconsensus.so.0.0.0
    3/usr/bin/install: cannot create regular file '/usr/local/lib/libbitcoinconsensus.so.0.0.0': Permission denied
    

    to re-create your issue, i first configured with ./configure --without-bdb --prefix=/tmp to get around running sudo make install (based on this: https://askubuntu.com/questions/424786/permission-denied-while-running-make-install). this is how i uncovered the issue with using bitcoind vs src/bitcoind.

    after updating the script to use src/bitcoind i was able to run make install without errors. perhaps if you could post the exact error you were getting when running make install?

  21. Rspigler commented at 0:33 am on August 10, 2021: contributor

    Love this! tACK 98d8482d37cb3d562b3d7f1f085d75074c3f2b6d

    I also didn’t run into any issues with the contrib/generate-example-bitcoin-conf.sh script

  22. in configure.ac:1860 in 98d8482d37 outdated
    1856@@ -1857,6 +1857,7 @@ AC_SUBST(ANDROID_ARCH)
    1857 AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist test/config.ini])
    1858 AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/split-debug.sh])
    1859 AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile])])
    1860+AC_CONFIG_LINKS([contrib/generate-example-bitcoin-conf.sh:contrib/generate-example-bitcoin-conf.sh])
    


    jarolrod commented at 1:57 am on August 10, 2021:
    nit, It seems like there is alphabetical sorting here, as so we’d probably want this after: https://github.com/bitcoin/bitcoin/blob/8193294caba03b996370873db79cf4fc22a1e95b/configure.ac#L1868
  23. in contrib/generate-example-bitcoin-conf.sh:28 in 98d8482d37 outdated
    23+## edit options you would like to change, and save the file.
    24+##
    25+
    26+EOF
    27+
    28+# parse the output from bitcoind --help
    


    jarolrod commented at 2:25 am on August 10, 2021:

    configuration options are categorized under groups (Connection Options, ZeroMQ notification options, …). As such, when looking at the bitcoind -h output, these can be considered headers. In the help output, you can easily distinguish the headers from options because they have different indentation. In the generated example introduced by this PR, there is no visual specialty, they are not so evident and get lost within all the other text.

    I suggest making the headers more visible. My current suggestion is to prepend another new line at the start of a new section and prepend the header text with more #. A benefit of making these headers more visible is that it will aid users find what they are looking for more quickly.

    in terms of a rule for your script, headers end with :. Additionally, you’re skipping the first section header which is simply Options:


    josibake commented at 12:33 pm on August 10, 2021:

    agree, the groups do get lost in the text. i tried a few options and

    0### Group Name
    1
    2
    3# help text
    4#option=1
    

    seemed to stand out well without being too cluttered. open to other suggestions


    jarolrod commented at 4:54 am on August 27, 2021:
    Just tested, this separation looks good to me 👍
  24. in contrib/generate-example-bitcoin-conf.sh:39 in 98d8482d37 outdated
    33+	| sed -E '/[=[:space:]]/!s/#.*$/&=1/' \
    34+	| awk '/^#[a-z]/{x=$0;next}{if (NF==0) print x"\n";else print}' >> ${EXAMPLE_CONF_FILE}
    35+
    36+# create the footer text
    37+cat >> ${EXAMPLE_CONF_FILE} << 'EOF'
    38+# [Sections]
    


    jarolrod commented at 2:45 am on August 10, 2021:

    you forgot about regtest 🥺

     0diff --git a/contrib/generate-example-bitcoin-conf.sh b/contrib/generate-example-bitcoin-conf.sh
     1index 84285850d..d6f1f2047 100755
     2--- a/contrib/generate-example-bitcoin-conf.sh
     3+++ b/contrib/generate-example-bitcoin-conf.sh
     4@@ -36,18 +36,22 @@ src/bitcoind --help | sed '1,/Print this help message and exit/d' \
     5 # create the footer text
     6 cat >> ${EXAMPLE_CONF_FILE} << 'EOF'
     7 # [Sections]
     8-# Most options apply to mainnet, testnet, signet and regtest.
     9-# If you want to confine an option to just one network, you should add it in the
    10-# relevant section below.
    11-# EXCEPTIONS: The options addnode, connect, port, bind, rpcport, rpcbind and wallet
    12-# only apply to mainnet unless they appear in the appropriate section below.
    13+# Most options will apply to all networks. To confine an option to a specific
    14+# network, add it under the relevant section below.
    15+#
    16+# Note: If not specified under a network section, the options addnode, connect,
    17+# port, bind, rpcport, rpcbind, and wallet will only apply to mainnet.
    18+
    19 
    20-# Options only for mainnet
    21+# Options for mainnet
    22 [main]
    23 
    24-# Options only for testnet
    25+# Options for testnet
    26 [test]
    27 
    28-# Options only for signet
    29+# Options for signet
    30 [signet]
    31+
    32+# Options for regtest
    33+[regtest]
    34 EOF
    

    josibake commented at 10:46 am on August 10, 2021:
    whoops, i forget why i took that out? i think i was copying this section from the lopp config generator
  25. in doc/bitcoin-conf.md:64 in 98d8482d37 outdated
    60@@ -61,4 +61,9 @@ Windows | `%APPDATA%\Bitcoin\` | `C:\Users\username\AppData\Roaming\Bitcoin\bitc
    61 Linux | `$HOME/.bitcoin/` | `/home/username/.bitcoin/bitcoin.conf`
    62 macOS | `$HOME/Library/Application Support/Bitcoin/` | `/Users/username/Library/Application Support/Bitcoin/bitcoin.conf`
    63 
    64-You can find an example bitcoin.conf file in [share/examples/bitcoin.conf](../share/examples/bitcoin.conf).
    65+An example configuration file is generated by [contrib/generate-example-bitcoin-conf.sh](../contrib/generate-example-bitcoin-conf.sh) during `make install`. The output is placed in [share/examples/bitcoin.conf](../share/examples/bitcoin.conf). If you don't see this file, you can generate it by running `./contrib/generate-example-bitcoin-conf.sh` from the root directory, or you can run `make install` again. To use, copy the example file into the correct data directory for your system and edit it there, like so:
    


    jarolrod commented at 3:02 am on August 10, 2021:

    You can’t include the link to the example configuration file here because we’re removing it from the repo under this PR. This link is invalid link if left on the repo. It is only viable locally, after the user has generated the example file.

    suggestions here:

     0diff --git a/doc/bitcoin-conf.md b/doc/bitcoin-conf.md
     1index 98517f2fc..3babf176a 100644
     2--- a/doc/bitcoin-conf.md
     3+++ b/doc/bitcoin-conf.md
     4@@ -61,7 +61,10 @@ Windows | `%APPDATA%\Bitcoin\` | `C:\Users\username\AppData\Roaming\Bitcoin\bitc
     5 Linux | `$HOME/.bitcoin/` | `/home/username/.bitcoin/bitcoin.conf`
     6 macOS | `$HOME/Library/Application Support/Bitcoin/` | `/Users/username/Library/Application Support/Bitcoin/bitcoin.conf`
     7 
     8-An example configuration file is generated by [contrib/generate-example-bitcoin-conf.sh](../contrib/generate-example-bitcoin-conf.sh) during `make install`. The output is placed in [share/examples/bitcoin.conf](../share/examples/bitcoin.conf). If you don't see this file, you can generate it by running `./contrib/generate-example-bitcoin-conf.sh` from the root directory, or you can run `make install` again. To use, copy the example file into the correct data directory for your system and edit it there, like so:
     9+An example configuration file can be generated by [contrib/generate-example-bitcoin-conf.sh](../contrib/generate-example-bitcoin-conf.sh).
    10+You can run this script directly or have it automatically executed during the `make install` stage.
    11+The output is placed under `share/examples/bitcoin.conf`.
    12+To use the generated configuration file, copy the example file into your data directory and edit it there, like so:
    

    josibake commented at 10:47 am on August 10, 2021:
    ah, good catch!
  26. jarolrod commented at 3:03 am on August 10, 2021: member
    Approach ACK
  27. josibake force-pushed on Aug 10, 2021
  28. josibake commented at 3:23 pm on August 10, 2021: member

    hey @jarolrod , thanks so much for the thorough review. i incorporated the fixes and style changes you suggested.

    i was also able to re-create @ShaMan239 ’s issue: because files were being created in the script, if you ran a sudo make install, the generated conf file was owned by root. thus, subsequent make install runs would fail unless you ran as root again (sudo make install). to ensure the file is created with the correct permissions, i moved the file creation into Makefile.am, which creates an empty file.

    i tested that this does fix the permissions issue by running the following commands:

    1. deleting the exambles directory
    2. running sudo make install
    3. verify directory and file created with correct permissions (local user)
    4. ran make install and verified no failures
  29. josibake force-pushed on Aug 11, 2021
  30. jarolrod commented at 6:00 am on August 27, 2021: member

    ACK d6eac4f0d237ba502aca8a4f6af239e369d6e9af

    What i like about this is that it severely reduces any maintainance cost behind having an example bitcoin.conf file. Addditionally, it’s nice that the generated example file will only contain relevant options. For example, if i configure without wallet functionality, then the generated bitcoin.conf will not include these options.

    The presentation of sections in the output file looks good, thanks for picking up that suggestion!

  31. shaavan commented at 2:56 pm on September 20, 2021: contributor

    I tested that this does fix the permissions issue by running the following commands:

    1. deleting the exambles directory
    
    2. running `sudo make install`
    
    3. verify directory and file created with correct permissions (local user)
    
    4. ran `make install` and verified no failures
    

    I followed the steps you suggested here; I could not use make install without root permission even after that. I checked the created example bitcoin.conf permission, and I can see that it is -rw-r--r-- I am adding the error I am getting while using the make install command without sudo:

    0 /usr/bin/mkdir -p '/usr/local/lib'
    1 /bin/bash ../libtool --preserve-dup-deps  --mode=install /usr/bin/install -c   libbitcoinconsensus.la '/usr/local/lib'
    2libtool: install: /usr/bin/install -c .libs/libbitcoinconsensus.so.0.0.0 /usr/local/lib/libbitcoinconsensus.so.0.0.0
    3/usr/bin/install: cannot remove '/usr/local/lib/libbitcoinconsensus.so.0.0.0': Permission denied
    

    Though the error seems unrelated to this PR, I am can still not understand why sudo make install is creating the example bitcoin file with -rw-r--r-- permission.

  32. DrahtBot added the label Needs rebase on Sep 30, 2021
  33. josibake force-pushed on Oct 19, 2021
  34. DrahtBot removed the label Needs rebase on Oct 19, 2021
  35. josibake commented at 10:01 am on October 19, 2021: member

    rebased and force pushed to fix a conflict with the existing share/examples/bitcoin.conf file. this can be easily verified with git range-diff d6eac4f...b915eff

    worth pointing out that this PR is meant to fix needing to edit the existing example file to keep it up to date with option help. in #23123 , a parameter was removed and this required the contributor to also remember to change the wording in the example file. this extra step will not be necessary if this PR is merged.

  36. josibake commented at 10:18 am on October 19, 2021: member

    @shaavan the error you are getting is indeed unrelated to the PR and expected. this is because of permissions on /usr/local/lib. you can verify this by trying to do a fresh build on master and run make install (make sure to run sudo make uninstall first). you should see the same error.

    to get around this error, you can set a prefix like ./configure --prefix=/tmp/test.

    as for the permissions, it is now (correctly) being created with -rw-r--r-- because file creation and file permissions are determined by automake. this ensures that the correct owner and permissions are assigned regardless of whether sudo is used when running make install

  37. shaavan approved
  38. shaavan commented at 2:39 pm on October 25, 2021: contributor

    you can verify this by trying to do a fresh build on master and run make install (make sure to run sudo make uninstall first). you should see the same error. to get around this error, you can set a prefix like ./configure –prefix=/tmp/test.

    I followed the steps you suggested and was able to successfully use the command make install without any problems with permission denied. Finally!

    This PR would be a great addition to the codebase, potentially reducing a lot of maintenance burden. Thanks for this fantastic work, @josibake!

    ACK b915efffa1d77497e1056cddd945632f414d3cad

  39. laanwj commented at 1:03 pm on December 18, 2021: member

    Concept ACK.

    However I don’t think we should have scripts that call the built binaries in the build system. This gives problems with cross-compilation, for example. At most this can be a script that has to be manually invoked in the release process like the gen-manpages.sh (or manually executed by the user).

    So NACK of making this part of make install.

  40. Rspigler commented at 7:38 pm on December 21, 2021: contributor

    I’m getting these errors now:

    Generating example bitcoin.conf file in share/examples/ generate-example-bitcoin-conf.sh: line 16: share/examples/bitcoin.conf: No such file or directory generate-example-bitcoin-conf.sh: line 29: src/bitcoind: No such file or directory generate-example-bitcoin-conf.sh: line 34: share/examples/bitcoin.conf: No such file or directory generate-example-bitcoin-conf.sh: line 37: share/examples/bitcoin.conf: No such file or directory

    I’m now using sudo make install, not sure if that’s the issue.

  41. Rspigler commented at 7:39 pm on December 21, 2021: contributor
    Should bitcoin-conf.md be expanded as well? (could be done in another PR)
  42. josibake commented at 1:49 pm on December 22, 2021: member

    However I don’t think we should have scripts that call the built binaries in the build system.

    thanks for the review @laanwj!

    agreed, I ended up coming to the same conclusion trying to get this to work. I’ll rework this to just be a script that can be called by the user and add a note to release-process.md

  43. josibake force-pushed on Dec 22, 2021
  44. josibake force-pushed on Dec 22, 2021
  45. josibake commented at 4:27 pm on December 22, 2021: member

    generate-example-bitcoin-conf.sh: line 29: src/bitcoind: No such file or directory @Rspigler I’m not sure about the other errors, but this one is likely because there is no bitcoind binary present. I’ve added a check to the script to make sure the binary exists.

    Should bitcoin-conf.md be expanded as well? (could be done in another PR)

    I’m not sure what you mean by “expanded.” For now, I’ve included directions on how to run the script. If you’re referring to including more examples on how to use bitcoin.conf, then yes, I think it could be expanded but in a later PR.

  46. josibake commented at 4:32 pm on December 22, 2021: member

    UPDATE: I have made some minor edits to the script (inspired from gen-manpages.sh) and taken it out of make install. Users will need to run the script locally to generate a file.

    I’ve also included generating this file as part of the release process, same as gen-manpages.sh. This entails running the script and committing the file before building release candidates. If the file exists, it will be copied over into the build outputs.

  47. Rspigler commented at 8:53 pm on December 22, 2021: contributor
    tACK 0f7f46d3b590c19f3510a81a9a4648bfed63e85a works great for me now! Really love this.
  48. w0xlt approved
  49. w0xlt commented at 0:15 am on December 23, 2021: contributor
    tACK 0f7f46d contrib/devtools/gen-bitcoin-conf.sh was run successfully and bitcoin.conf was created in share/examples. Very useful script.
  50. theStack commented at 4:16 pm on December 27, 2021: contributor

    Conecpt ACK, very neat idea! 👌

    Nit that won’t affect most users, but is probably still worth mentioning: I tested executing the script on OpenBSD 7.0 and it seeems that each option category headline has an unexpected character ’n’ on the start of the line:

     0.....
     1n### Connection options
     2.....
     3n### Wallet options
     4.....
     5n### ZeroMQ notification options
     6.....
     7n### Debugging/Testing options
     8.....
     9n### Chain selection options
    10.....
    11n### Node relay options
    12.....
    13n### Block creation options
    14.....
    15n### RPC server options
    16.....
    

    Didn’t investigate deeper what’s the cause for this, but obviously one of the used tools awk/sed behave slightly differently than on Linux. Portability issues like this are one of the reasons why we usually prefer python instead of bash scripts (see #18132 as an example). On the other hand re-implementing short sed/awk-scripts in python could be quite a burden and lead to bloated code, so I think it’s fine as it is. If this specific issue can’t be resolved, maybe check the uname -s output and abort if it is not Linux? I’d prefer restricting to certain OSes (in case of Linux, a very popular one) rather than generating a bitcoin.conf that doesn’t work.

  51. josibake force-pushed on Dec 27, 2021
  52. josibake commented at 4:50 pm on December 27, 2021: member

    obviously one of the used tools awk/sed behave slightly differently than on Linux

    thanks for catching this @theStack ! it is indeed due to BSD sed not recognizing \n as a newline character. I found this as a solution: https://stackoverflow.com/a/24575385

    you can check with git range-diff 0f7f46d...4bb3cf3

    can you verify this fixes the issue for you? there is also a newline character used in the awk command, but i don’t think this causes an issue for BSD.

    if this doesn’t fix it, one other option is to remove the newline as it is only there for cosmetic reasons (to make the different sections more obviously differentiated). im also not opposed to re-writing it in python, but agree that feels a bit heavy for this use-case

  53. in contrib/guix/libexec/build.sh:396 in fc1fc62da2 outdated
    391+	if [ -f "${DISTSRC}/share/examples/bitcoin.conf" ]
    392+	then
    393+		cp "${DISTSRC}/share/examples/bitcoin.conf" "${DISTNAME}/"
    394+	else
    395+		echo "${DISTSRC}/share/examples/bitcoin.conf file not found. Make sure to run contrib/devtools/gen-bitcoin-conf.sh before building."
    396+	fi
    


    theStack commented at 11:56 pm on December 27, 2021:
    nit: to be consistent with the rest of the file, the tabs used for indentation should be replaced by spaces (this seems not be shown on a standard diff and is hence easy to miss)

    josibake commented at 9:56 am on December 28, 2021:
    good catch, i really need to fix my vim setup :roll_eyes:
  54. in contrib/devtools/gen-bitcoin-conf.sh:47 in b6951c09d0 outdated
    42+
    43+### Options
    44+EOF
    45+
    46+# parse the output from bitcoind --help
    47+# line 54 is a bit funky to ensure portability for BSD
    


    theStack commented at 0:01 am on December 28, 2021:
    Referring to concrete line numbers in comments is always a bit fragile, since it’s very likely forgotten to be updated if e.g. unrelated lines above are inserted. Maybe “line-break in next-to-last sed” or alike?

    josibake commented at 9:57 am on December 28, 2021:
    done!
  55. theStack commented at 0:30 am on December 28, 2021: contributor

    … can you verify this fixes the issue for you? there is also a newline character used in the awk command, but i don’t think this causes an issue for BSD.

    Thanks for fixing, I can confirm that the latest version (top-level commit 4bb3cf3dd4182b08da8fd7ef54dba2621598b315) now also works in OpenBSD 7.0! 🎉

    Running a diff on my example.conf output and the one you provided me only showed differences related to different hardware and build options (different range in number of script verification threads due to having less CPU cores, no “sandbox” option due to not running Linux, no wallet related options due to having configured --without-wallet), i.e. obviously everything works as expected.

    One concern that arose while looking at the manually created bitcoin.conf file in master that is removed in this PR: there is some parts that seem to contain more information than just the one provided from the help. E.g. we have a “Quick primer on addnode vs connect”, also the section on rpcauth is more detailled than from the help, explaining how it can be generated via the rpcauth.py script. I would assume it’s worth it to keep this information somehow?

    Also left two other nits below.

  56. unknown changes_requested
  57. unknown commented at 6:09 am on December 28, 2021: none

    Approach NACK

    Reasons:

    1. Bash scripts will not be helpful for Windows users and Windows is used by 75% desktop computers.

    image

    image

    image

    image

    image

    image

    A better approach would be to create bitcoin.conf with an option in GUI either during the first time user runs Bitcoin Core and data directory is selected or user can always create bitcoin.conf from options if required however UX can be improved with some templates.

    1. Open Source Bitcoin Core Config generator maintained by Jameson Lopp has better UI/UX to solve this problem which can be helpful for users looking to create config files with some templates, with each option categorized and explained in a better way.

    2. I don’t think contrib/devtools is the right place to add such scripts if this is an attempt to help users.

    3. #13761 could be a better approach for bitcoind users IMO with few changes based on review comments.

  58. josibake force-pushed on Dec 28, 2021
  59. josibake commented at 10:06 am on December 28, 2021: member

    thanks for the review, @theStack - I’ve incorporated your feedback here git range-diff 4bb3cf3...bc84a32

    One concern that arose while looking at the manually created bitcoin.conf file in master that is removed in this PR: there is some parts that seem to contain more information than just the one provided from the help. E.g. we have a “Quick primer on addnode vs connect”, also the section on rpcauth is more detailled than from the help, explaining how it can be generated via the rpcauth.py script. I would assume it’s worth it to keep this information somehow?

    personally, im not a fan of that information living in the comments of the config file. in the pr description, i mention that all help text should be moved to init.cpp; this ensures it will be in the generated config file and also the man pages.

    for stuff that doesn’t make sense to put in init.cpp but that we do want to keep, i think it should go in docs/bitcoin-conf.md. im working on a follow-up pr to this one to add some more info to docs/bitcoin-conf.md and was planning to see if it made sense to move the addnode and rpcauth sections over.

  60. josibake commented at 10:28 am on December 28, 2021: member

    thanks for the feedback, @prayank23!

    Bash scripts will not be helpful for Windows users and Windows is used by 75% desktop computers.

    I’ve included the script as part of the release process so that an up-to-date example config is included with the Windows release. For Windows users that compile from source, I believe most do it in a Linux VM/Windows subsystem for Linux/git bash/etc, so they would still be able to use the script. Check out https://medium.com/@HussainZaidi14/compiling-bitcoin-core-in-windows-10-environment-4723255e88a7 for more info.

    A better approach would be to create bitcoin.conf with an option in GUI

    I’m not sure what options currently exist in the GUI for editing config parameters, but I think editing/generating the config via the GUI solves a different problem and is best reserved for a separate PR.

    2. Open Source Bitcoin Core Config generator

    I feel that having an up-to-date example bitcoin.conf for users is important enough that it should be managed by this repository and not rely on a third party

    I don’t think contrib/devtools is the right place to add such scripts if this is an attempt to help users.

    The main benefit to end users is having the example bitcoin.conf file included with the release binaries. I chose contrib/devtools as the script is intended to be used during the release process and I think it keeps things simpler to have gen-manpages.sh and gen-bitcoin-conf.sh in the same place

    4. #13761 could be a better approach for bitcoind

    I didn’t get the sense there was strong support for the approach in #13761 and I tend to agree with the feedback here: #13761 (comment)

    In the discussion following #13761 in #10746 , I felt there was more support for this approach: #10746 (comment) , which was the inspiration for this PR

  61. theStack commented at 1:28 am on December 29, 2021: contributor

    Tested ACK bc84a32e9b8038fa59a322057b563b3f4e630919

    Works like a charm, tested config file generation on both OpenBSD 7.0 and Debian bookworm/sid by now. Didn’t look deeper into the sed/awk-magic extracting and transforming the relevant information.

    personally, im not a fan of that information living in the comments of the config file. in the pr description, i mention that all help text should be moved to init.cpp; this ensures it will be in the generated config file and also the man pages.

    Agree that the config file is not the ideal place for extended information and primers. By the way, the PR description part you mentioned (that I overlooked before) also says that init.cpp is changed, but it isn’t currently. Was this forgotten to commit or is it not relevant anymore? In the latter case, it would probably make sense to update the PR description accordingly.

    for stuff that doesn’t make sense to put in init.cpp but that we do want to keep, i think it should go in docs/bitcoin-conf.md. im working on a follow-up pr to this one to add some more info to docs/bitcoin-conf.md and was planning to see if it made sense to move the addnode and rpcauth sections over.

    Sounds like a plan, feel free to ping me up on the follow-up PR.

  62. theStack approved
  63. ghost commented at 1:56 am on December 29, 2021: none

    For Windows users that compile from source, I believe most do it in a Linux VM/Windows subsystem for Linux/git bash/etc, so they would still be able to use the script. Check out https://medium.com/@HussainZaidi14/compiling-bitcoin-core-in-windows-10-environment-4723255e88a7 for more info.

    Windows users that compile from source is a rare species. Also docs for compiling are available in Core repository and I have tried it: https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md

    I feel that having an up-to-date example bitcoin.conf for users is important enough that it should be managed by this repository and not rely on a third party

    Example bitcoin.conf already exists and there are lot of features which are not included in Core because someone wrote an open source python script which nobody uses.

    I’m not sure what options currently exist in the GUI for editing config parameters, but I think editing/generating the config via the GUI solves a different problem and is best reserved for a separate PR.

    Bash script in contrib/devtools solves problem for less than 1% users who can already find better solutions on stackexchange etc. So the OP is misleading and I do not agree with the approach.

    I chose contrib/devtools as the script is intended to be used during the release process and I think it keeps things simpler to have gen-manpages.sh and gen-bitcoin-conf.sh in the same place

    I am not sure how many users will check contrib/devtools for hidden scripts that help them generate config file.

    I didn’t get the sense there was strong support for the approach in #13761

    None of the disagreement make sense. Config file can already be generated using bitcoin-qt, there is nothing wrong in providing few templates.

    I support the approach in #13761 and NACK for this PR on adding bash scripts that won’t be helpful for most of the users.

  64. josibake commented at 12:21 pm on December 29, 2021: member

    Was this forgotten to commit

    indeed, looks like i dropped this commit when re-organizing the PR! thanks for catching. I’ve pushed a new commit (https://github.com/bitcoin/bitcoin/pull/22235/commits/f385d175c6d566ddea11df256e45e30d9bfa6604) with the init.cpp edit

  65. josibake commented at 12:33 pm on December 29, 2021: member

    @prayank23 there seems to be some confusion as to the intended purpose of this script. it is not intended for individual users to use for generating a file (tho it is available for use for users who are compiling from source).

    it is intended to be used as part of the release process. my apologies if the PR description confusing. I’ve updated the description to hopefully make this more clear:

    the main purpose of this script is to generate a config file to be included with releases, same as gen-manpages.sh. this ensures every release also includes an up-to-date, full example config file for users to edit. the script is also available for users who compile from source for generating an example config for their compiled binary.

  66. theStack approved
  67. theStack commented at 7:44 pm on December 29, 2021: contributor
    re-ACK f385d175c6d566ddea11df256e45e30d9bfa6604
  68. ghost commented at 0:36 am on December 30, 2021: none

    @prayank23 there seems to be some confusion as to the intended purpose of this script. it is not intended for individual users to use for generating a file (tho it is available for use for users who are compiling from source).

    it is intended to be used as part of the release process. my apologies if the PR description confusing. I’ve updated the description to hopefully make this more clear:

    It does not fix #10746 or https://github.com/bitcoin/bitcoin/issues/19641

  69. in doc/bitcoin-conf.md:72 in f385d175c6 outdated
    68+To use the generated configuration file, copy the example file into your data directory and edit it there, like so:
    69+
    70+```
    71+# example copy command for linux user
    72+cp share/examples/bitcoin.conf ~/.bitcoin
    73+```
    


    Rspigler commented at 10:16 pm on January 6, 2022:

    Add to line 74:

    Users should never make config changes which they do not understand. Furthermore, users should always be wary of accepting any config changes provided to them by another source.

    I believe this is a good compromise and would touch on @prayank23 ’s concerns


    josibake commented at 5:18 pm on January 7, 2022:
    hey @Rspigler , definitely agree that we can make some improvements to the documentation of bitcoin-conf.md related to security and usability, but I think that’s out of scope for this PR which is solely focused on generating the conf file. Happy to address this in a follow-up!

    Rspigler commented at 1:49 am on January 11, 2022:
    Agreed!
  70. in contrib/devtools/README.md:100 in f385d175c6 outdated
     95+
     96+Generates a bitcoin.conf file in `share/examples/` by parsing the output from `bitcoind -help`. This script is run during the
     97+release process to include a bitcoin.conf with the release binaries and can also be run by users to generate a file locally.
     98+
     99+With in-tree builds this tool can be run from any directory within the
    100+repostitory. To use this tool with out-of-tree builds set `BUILDDIR`. For
    


    niVelion commented at 2:09 pm on January 12, 2022:

    Nit.

    0repository. To use this tool with out-of-tree builds set `BUILDDIR`. For
    

    josibake commented at 4:16 pm on January 12, 2022:
    thanks for catching this!
  71. niVelion commented at 3:30 pm on January 12, 2022: none

    I’ve reviewed the code but am not a regular enough user of sed/awk to review the specifics of that section.

    I have compared the output to that of running bitcoind --help manually.

    And ran ShellCheck linter against the shell script.

    After initial hesitation at the use of shell script over Python (for the sake of readability/maintainability), I’ve changed my mind due to the high quality of code.

    Approach ACK.

  72. in contrib/devtools/gen-bitcoin-conf.sh:36 in f385d175c6 outdated
    31+mkdir -p "${SHARE_EXAMPLES_DIR}"
    32+
    33+# create the header text
    34+cat > "${EXAMPLE_CONF_FILE}" << 'EOF'
    35+##
    36+## bitcoin.conf configuration file. Lines beginning with # are comments.
    


    niVelion commented at 3:41 pm on January 12, 2022:
    0## bitcoin.conf configuration file.
    1##
    2## Generated by contrib/devtools/gen-bitcoin-conf.sh.
    3## Lines beginning with # are comments.
    

    I more commonly than not see automatically generated files such as this including some form of notice that they were generated automatically, may be worth including something like this.

  73. josibake force-pushed on Jan 12, 2022
  74. josibake commented at 4:46 pm on January 12, 2022: member
    thanks for the review @niVelion ! ive taken both your suggestions and one small edit of my own to improve the readability of the header. changes can be verified with git range-diff f385d17...caf4ab7
  75. josibake force-pushed on Jan 12, 2022
  76. josibake commented at 5:09 pm on January 12, 2022: member
    force pushed to fix trailing whitespace :man_facepalming:
  77. in contrib/devtools/README.md:96 in 3b0ef9054b outdated
    89@@ -90,6 +90,20 @@ example:
    90 BUILDDIR=$PWD/build contrib/devtools/gen-manpages.sh
    91 ```
    92 
    93+gen-bitcoin-conf.sh
    94+===================
    95+
    96+Generates a bitcoin.conf file in `share/examples/` by parsing the output from `bitcoind -help`. This script is run during the
    


    niVelion commented at 5:38 pm on January 12, 2022:

    Nit. I realize –help and -help does the same thing with the current version of bitcoind..

    0Generates a bitcoin.conf file in `share/examples/` by parsing the output from `bitcoind --help`. This script is run during the
    

    josibake commented at 7:16 pm on January 12, 2022:
    done!
  78. in contrib/devtools/gen-bitcoin-conf.sh:52 in 3b0ef9054b outdated
    47+EOF
    48+
    49+# parse the output from bitcoind --help
    50+# adding newlines is a bit funky to ensure portability for BSD
    51+# see here for more details: https://stackoverflow.com/a/24575385
    52+${BITCOIND} --help | sed '1,/Print this help message and exit/d' \
    


    niVelion commented at 5:46 pm on January 12, 2022:

    Nit. On re-visiting, I think this reads a little better.

    0${BITCOIND} --help \
    1    | sed '1,/Print this help message and exit/d' \
    

    josibake commented at 7:16 pm on January 12, 2022:
    done!
  79. josibake force-pushed on Jan 12, 2022
  80. josibake commented at 7:18 pm on January 12, 2022: member
    thanks for the additional suggestions @niVelion, took both suggestions for the script and readme. changes can be verified with git range-diff 3b0ef90...120fbba
  81. Rspigler commented at 8:03 am on January 13, 2022: contributor
    re-ACK 120fbbafdc820f7202d9c8777a933325692f8c51
  82. niVelion commented at 2:29 pm on January 13, 2022: none

    Off-topic - entirely regarding git range-diff:

    thanks for the additional suggestions @niVelion, took both suggestions for the script and readme. changes can be verified with git range-diff 3b0ef90...120fbba

    That command returns an error for me:

    0$ git range-diff 3b0ef90...120fbba
    1fatal: ambiguous argument '120fbba..3b0ef90': unknown revision or path not in the working tree.
    2Use '--' to separate paths from revisions, like this:
    3'git <command> [<revision>...] -- [<file>...]'
    4error: could not parse log for '120fbba..3b0ef90'
    

    Could I ask what command sequence could I run to get this working, assuming the below about my repo (i.e. that I’ve pulled down bitcoin/bitcoin and am on the master branch), would be appreciated :+1:

    0$ git remote -v
    1origin  git@github.com:bitcoin/bitcoin.git (fetch)
    2origin  git@github.com:bitcoin/bitcoin.git (push)
    3$ git branch
    4...
    5* master
    6$ git pull
    7Already up-to-date.
    
  83. josibake commented at 5:39 pm on January 13, 2022: member

    Off-topic - entirely regarding git range-diff @niVelion I’m not a git wizard (yet :smile: ) but i believe this is somehow related to you pulling down the branch after the force push? you can also verify the differences using this link: https://github.com/josibake/bitcoin/compare/3b0ef90..120fbba

  84. maflcko commented at 5:45 pm on January 13, 2022: member
    You can’t use ... in range-diff. I usually replace all dots between git hashes with space.
  85. josibake commented at 5:55 pm on January 13, 2022: member

    You can’t use ... in range-diff. I usually replace all dots between git hashes with space.

    perhaps we are on different versions of git @MarcoFalke ? the dots are valid in range-diff (on git 2.30.2): image

  86. maflcko commented at 6:57 pm on January 13, 2022: member

    Yes, as you can see in your screenshot: <base> <old> <new> doesn’t use dots, but spaces.

    See also https://github.com/bitcoin/bitcoin/blob/master/doc/productivity.md#diff-the-diffs-with-git-range-diff:

    git range-diff master previously-reviewed-head new-head

    Edit: I mean you can use dots here, but then it will also print all commits that were pushed to master in the meantime.

  87. josibake commented at 7:08 pm on January 13, 2022: member

    Edit: I mean you can use dots here, but then it will also print all commits that were pushed to master in the meantime.

    ah, gotcha! makes sense. the spaces syntax is much more readable. TIL :smile:

  88. maflcko commented at 7:24 pm on January 13, 2022: member
    And for fetching commits you can copy the full sha and do git fetch origin 120fbbafdc820f7202d9c8777a933325692f8c51
  89. niVelion commented at 1:19 pm on January 14, 2022: none

    Off-topic - entirely regarding git range-diff

    @niVelion I’m not a git wizard (yet smile ) but i believe this is somehow related to you pulling down the branch after the force push? you can also verify the differences using this link: https://github.com/josibake/bitcoin/compare/3b0ef90..120fbba

    Thanks, I tried https://github.com/bitcoin/bitcoin/compare/3b0ef90..120fbba before but not your fork.

    Not certain which particular thing I tried fixed it (amongst them, adding your fork as an additional remote) but it’s now working :grin:

    0$ git range-diff 3b0ef90...120fbba
    11:  dbaa3e5498 ! 1:  53826de216 script: add script to generate example bitcoin.conf
    2    @@ contrib/devtools/gen-bitcoin-conf.sh (new)
    3     +# parse the output from bitcoind --help
    4     +# adding newlines is a bit funky to ensure portability for BSD
    5     +# see here for more details: https://stackoverflow.com/a/24575385
    6...
    
  90. in share/examples/bitcoin.conf:30 in 53826de216 outdated
    24-
    25-# Bind to given address and add permission flags to peers connecting to it. Use [host]:port notation for IPv6
    26-#whitebind=perm@<addr>
    27-
    28-##############################################################
    29-##            Quick Primer on addnode vs connect            ##
    


    mzumsande commented at 5:54 pm on January 14, 2022:

    Just a small note, since there have been suggestions to save/migrate the “Quick Primer on addnode vs connect” section: Its first part is a mix of wrong information (“addnode will connect you to and tell you about the nodes connected to 4.2.2.4.” - if that was true, it would be a major privacy issue) and a crude description of addr relay - if not deleted, it should be rewritten.

    I almost opened an unrelated PR to correct this it, but then I saw that this PR would delete the entire file anyway.


    josibake commented at 1:21 pm on January 18, 2022:
    agreed! ideally, id like as much as possible to keep init.cpp as the source of truth as it is the most likely to stay up to date
  91. mzumsande commented at 6:23 pm on January 14, 2022: contributor
    Concept ACK
  92. DrahtBot added the label Needs rebase on Feb 21, 2022
  93. josibake force-pushed on Mar 17, 2022
  94. josibake force-pushed on Mar 17, 2022
  95. josibake commented at 11:37 am on March 17, 2022: member
    force pushed rebase; git range-diff master 120fbba 0488dd6
  96. DrahtBot removed the label Needs rebase on Mar 17, 2022
  97. BradleyC commented at 11:16 am on April 25, 2022: none

    @josibake ’s point from the initial comment is extremely valid:

    0 the main issue with an example config file is that it creates a second source of truth regarding what options are available for configuring bitcoind
    

    as a developer new to bitcoin, it’s a bit difficult to find all available / necessary options for setup on the first run. Stack and other help articles out of date, etc.

    this PR solves that problem elegantly.

  98. josibake force-pushed on Apr 25, 2022
  99. josibake commented at 1:44 pm on April 25, 2022: member
    force pushed to fix whitespace linter; git range-diff master 0488dd6 fa67840
  100. willcl-ark approved
  101. willcl-ark commented at 2:11 pm on April 25, 2022: contributor

    Partial tACK https://github.com/bitcoin/bitcoin/commit/fa678403bdc532180a435368e74b497c5dae0873

    Generating the config file worked perfectly and the documentation changes read well to me. I did not try with an out-of-tree build nor exercising contrib/guix/libexec/build.sh

  102. in contrib/devtools/gen-bitcoin-conf.sh:8 in fa678403bd outdated
    0@@ -0,0 +1,83 @@
    1+#!/usr/bin/env bash
    2+# Copyright (c) 2021 The Bitcoin Core developers
    3+# Distributed under the MIT software license, see the accompanying
    4+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
    5+
    6+export LC_ALL=C
    7+TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}
    8+BUILDDIR=${BUILDIR:-$TOPDIR}
    


    laanwj commented at 6:38 pm on April 28, 2022:
    s/BUILDIR/BUILDDIR/
  103. in contrib/devtools/gen-bitcoin-conf.sh:12 in fa678403bd outdated
     7+TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}
     8+BUILDDIR=${BUILDIR:-$TOPDIR}
     9+BINDIR=${BINDIR:-$BUILDDIR/src}
    10+BITCOIND=${BITCOIND:-$BINDIR/bitcoind}
    11+SHARE_EXAMPLES_DIR=${SHARE_EXAMPLES_DIR:-$BUILDDIR/share/examples}
    12+EXAMPLE_CONF_FILE=${EXAMPLE_CONF_FILE:-$SHARE_EXAMPLES_DIR/bitcoin.conf}
    


    laanwj commented at 6:40 pm on April 28, 2022:
    The gen-manpages.sh script generates its output in the source directory, not the build directory. This is slightly easier if the result is to be committed to the branch.

    josibake commented at 2:28 pm on May 2, 2022:
    good call out, this file does need to be committed
  104. in doc/release-process.md:11 in fa678403bd outdated
     7@@ -8,6 +8,7 @@ Release Process
     8 * Update translations see [translation_process.md](https://github.com/bitcoin/bitcoin/blob/master/doc/translation_process.md#synchronising-translations).
     9 * Update release candidate version in `configure.ac` (`CLIENT_VERSION_RC`).
    10 * Update manpages (after rebuilding the binaries), see [gen-manpages.py](https://github.com/bitcoin/bitcoin/blob/master/contrib/devtools/README.md#gen-manpagespy).
    11+* Generate a bitcoin.conf file, see [gen-bitcoin-conf.sh](https://github.com/bitcoin/bitcoin/blob/master/contrib/devtools/README.md#gen-bitcoin-confsh).
    


    laanwj commented at 6:40 pm on April 28, 2022:
    I would guess it also needs to be added to the repository, and committed?

    josibake commented at 2:30 pm on May 2, 2022:
    it does need to be committed for the build script to be aware of it. I went ahead and added a placeholder file (same as doc/man/ and added a note in the docs to make it clear that the file does need to be committed. as a bonus, having a placeholder file should make it easier for users to discover the script

    laanwj commented at 5:54 pm on May 4, 2022:
    Sounds like a good solution to me, thanks!
  105. laanwj commented at 6:41 pm on April 28, 2022: member
    Tested the script (except the guix part) and it seems to work great, left a few small nits.
  106. doc: replace bitcoin.conf with placeholder file b483084d86
  107. script: add script to generate example bitcoin.conf
    this ensures bitcoind option help is the source of truth and also
    gives an example conf file for users to customize and copy to their
    data directory.
    
    closes #10746
    1c7e820ded
  108. doc: update bitcoin-conf.md
    include instructions on how to run the script
    6aac946f49
  109. josibake force-pushed on May 2, 2022
  110. josibake commented at 3:07 pm on May 2, 2022: member

    Tested the script (except the guix part) and it seems to work great, left a few small nits.

    thanks for the review @laanwj, I took your suggestions and also added an empty placeholder file, share/examples/bitcoin.conf to make it more obvious that the file needs to be committed before doing a guix build

  111. in contrib/guix/libexec/build.sh:372 in 99c3ef3cbc outdated
    367@@ -368,6 +368,14 @@ mkdir -p "$DISTSRC"
    368                 ;;
    369         esac
    370 
    371+        # If a bitcoin.conf file has been generated, copy it over
    372+        if [ -f "${DISTSRC}/share/examples/bitcoin.conf" ]
    


    laanwj commented at 6:14 pm on May 4, 2022:
    Now that the placeholder is always there, this if/else is no longer necessary and can be replaced with just a copy.

    josibake commented at 6:46 pm on May 4, 2022:
    fixed!
  112. laanwj commented at 6:16 pm on May 4, 2022: member
    This seems ready for merge, sorry for finding a last-minute nit :smile:
  113. build: include bitcoin.conf in build outputs
    copy over bitcoin.conf during the build process.
    this means `contrib/devtools/gen-bitcoin-conf.sh` will need
    to be run and the generated file committed during the release process.
    
    this is the same process used for generating man pages for each release.
    50635d27b4
  114. doc: update devtools, release-process readmes
    include running `gen-bitcoin-conf.sh` as part of the release process.
    970b9987ad
  115. doc: update init.cpp -conf help text
    update help to reflect this option cannot be used from the config file
    b42643c253
  116. josibake force-pushed on May 4, 2022
  117. josibake commented at 6:46 pm on May 4, 2022: member

    This seems ready for merge, sorry for finding a last-minute nit smile

    thanks for circling back! I’ve added your suggestion

  118. laanwj commented at 7:10 pm on May 4, 2022: member
    Tested and code review ACK b42643c2537ffbe99d6d94fb1fb3b7f9d5234f93
  119. laanwj merged this on May 4, 2022
  120. laanwj closed this on May 4, 2022

  121. sidhujag referenced this in commit fb232170b1 on May 4, 2022
  122. in contrib/guix/libexec/build.sh:373 in b42643c253
    367@@ -368,6 +368,10 @@ mkdir -p "$DISTSRC"
    368                 ;;
    369         esac
    370 
    371+        # copy over the example bitcoin.conf file. if contrib/devtools/gen-bitcoin-conf.sh
    372+        # has not been run before buildling, this file will be a stub
    373+        cp "${DISTSRC}/share/examples/bitcoin.conf" "${DISTNAME}/"
    


    hebasto commented at 5:48 am on August 16, 2022:
    Install a bitcoin.conf file using Windows installer as well?

    fanquake commented at 8:07 am on August 16, 2022:
    I’ll combine this into #25829.
  123. fanquake referenced this in commit 239f59b35a on Aug 16, 2022
  124. fanquake referenced this in commit 46bc71db1c on Aug 16, 2022
  125. fanquake referenced this in commit 3741c1c7fb on Aug 16, 2022
  126. fanquake referenced this in commit 495caa9a01 on Aug 16, 2022
  127. fanquake referenced this in commit aa774f3e11 on Aug 17, 2022
  128. sidhujag referenced this in commit 6116fa8251 on Aug 17, 2022
  129. Rspigler referenced this in commit dc1860157a on Aug 21, 2022
  130. janus referenced this in commit 283b85cb66 on Jan 20, 2023
  131. bitcoin locked this on Aug 16, 2023
  132. josibake deleted the branch on Jan 26, 2024

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-11-21 12:12 UTC

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