Skip to content

feature: Use different datadirs for different signets - #34566

Merged
sedited merged 5 commits into
bitcoin:masterfrom
ekzyis:signet-datadirs
Sep 16, 2026
Merged

sedited merged 5 commits into
bitcoin:masterfrom
ekzyis:signet-datadirs

Conversation

@ekzyis

@ekzyis ekzyis commented Feb 11, 2026 •

Copy link
Copy Markdown
Contributor

closes #27494

This adds support for syncing multiple signets.

Each custom signet is stored in a different datadir, using the network magic (message start) as the suffix.

The default signet is always stored without a suffix for backward compatibility, even if the default challenge is provided explicitly via -signetchallenge.

This builds upon #29838.

For those already familiar with #29838, here are the differences between #29838 and this that are visible to the user:

Unlike #29838, this PR does not update tests that didn't break (rpc_bind.py, interface_bitcoin_cli.py). I have found other tests where datadir_path is used in combination with self.chain (regexp: datadir_path.*chain). I considered it inconsistent to update some tests but not all of them. I've decided to not update all of them to keep the scope of this PR low until feedback. I can go through all tests in a follow-up PR to make sure they don't break when they are ever used with (custom) signet, however unlikely that might be.

I have done some manual testing like this:

manual testing
  1. 'signet' directory is used, IBD:
$ bitcoind -signet
  1. 'signet' directory is used, no IBD without -addnode (see #29838 (comment)) or existing peers.dat:
$ bitcoind -signet -signetchallenge=512103ad5e0edad18cb1f0fc0d28a3d4f1f3e445640337489abb10404f2d1e086be430210359ef5021964fe22d6f8e05b2463c9540ce96883fe3b278760f048f5189f2e6c452ae
  1. 'signet' directory is used
$ bitcoind -conf="signet_default.conf"
# signet_default.conf
signet=1
[signet]
signetchallenge=512103ad5e0edad18cb1f0fc0d28a3d4f1f3e445640337489abb10404f2d1e086be430210359ef5021964fe22d6f8e05b2463c9540ce96883fe3b278760f048f5189f2e6c452ae
  1. 'signet_f6ac8550' directory is used:
$ bitcoind -conf="signet_custom.conf"
# signet_custom.conf
signet=1
[signet]
signetchallenge=0014d4528367459d54e1545b0d0a677d2a7d71d648e0

Tested RPC with bitcoin-cli getblockchaininfo with the same options (-signet, -conf, or -signet -signetchallenge)

I'm new to contributing to Bitcoin Core so it's entirely possible that I've missed something obvious.

Footnotes

  1. could be something for a follow-up PR, or maybe it's intentional to not mix explicit with implicit options? ↩

@DrahtBot

DrahtBot commented Feb 11, 2026 •

Copy link
Copy Markdown
Contributor

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

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34566.

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK ViniciusCestarii, sedited, pinheadmz
Concept ACK RandyMcMillan
Approach ACK ajtowns

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

No conflicts as of last run.

LLM Linter (✨ experimental)

Possible places where comparison-specific test macros should replace generic comparisons:

  • [test/functional/tool_signet_miner.py] assert get_signet_commitment(get_segwit_commitment(node)) is None -> use assert_equal(get_signet_commitment(get_segwit_commitment(node)), None) instead.

2026-09-11 21:13:26

@ekzyis
ekzyis marked this pull request as draft February 11, 2026 20:03
@ekzyis

ekzyis commented Feb 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Will keep this in draft until I fix why tool_signet_miner.py is failing in CI (but not locally for some reason)

Update: Ah, it's because the CI runs it with --usecli

@ekzyis
ekzyis force-pushed the signet-datadirs branch 3 times, most recently from f848e12 to 6dadea4 Compare February 12, 2026 00:56
@ekzyis ekzyis changed the title feature: Use separate datadirs for each signet feature: Use different datadirs for different signets Feb 12, 2026
@ekzyis
ekzyis force-pushed the signet-datadirs branch 2 times, most recently from 3fe04ed to 5454907 Compare February 12, 2026 08:10
@ekzyis
ekzyis marked this pull request as ready for review February 12, 2026 09:24
@sedited

sedited commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

This hasn't gotten any attention so far. @ajtowns do you want to take a look here since you opened the original issue?

@ekzyis

ekzyis commented Apr 6, 2026

Copy link
Copy Markdown
Contributor Author

rebased on master (b730dc3)

Comment thread test/functional/feature_signet.py Resolved
Comment thread src/chainparamsbase.cpp Resolved
@ekzyis
ekzyis force-pushed the signet-datadirs branch 2 times, most recently from a2d7551 to 63cf334 Compare April 8, 2026 14:08
@ekzyis
ekzyis marked this pull request as draft April 8, 2026 14:26
@ekzyis
ekzyis force-pushed the signet-datadirs branch from 63cf334 to 3649690 Compare April 8, 2026 15:12
@DrahtBot DrahtBot removed the CI failed label Apr 8, 2026
Comment thread test/functional/tool_signet_miner.py Resolved
@pinheadmz

Copy link
Copy Markdown
Member

concept ACK, I use a lot of different signets for educational projects and we could really use this. Personally I feel like using the magic bytes (message start) makes more sense and is less likely to collide between signet challenges

@ekzyis
ekzyis marked this pull request as ready for review April 8, 2026 16:46
@ekzyis
ekzyis force-pushed the signet-datadirs branch from 3649690 to ce67587 Compare April 8, 2026 19:31

@ViniciusCestarii ViniciusCestarii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ab56c78

Reviewed and tested changes locally.

Comment thread test/functional/feature_signet.py Resolved
@DrahtBot
DrahtBot requested a review from pinheadmz July 28, 2026 14:45

@pinheadmz pinheadmz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ab56c78

Built and tested (with and without --cli) on macos/arm64. Reviewed all changes, everything looks good. Tested with various arguments, challenges and cli commands. Tried running several signets from same machine. Happy to re-ack if @ViniciusCestarii nits are addressed.

A few non blocking notes below.

Show Signature
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

ACK ab56c78a9929a8e62d377de3dc64d8a81fd85284
-----BEGIN PGP SIGNATURE-----

iQJPBAEBCAA5FiEE5hdzzW4BBA4vG9eM5+KYS2KJyToFAmpo5R4bFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMCwzAAoJEOfimEtiick69L8P/1rJg++qSndTVfJs2obF
/4pmz7CrgGMaJ6fZZRc62pjGUFHYNtYQOqt9EfAP7sGUwAWXemvAiYacrXk6Am/u
OoxZC64wWcAOJgmHdxcAMK7UlErxe6oeUXzRKeLhbAlynzCjihiNtJFeeNGf3Mq4
z7mqiyaeCeq3U2JlRPVgUyI9lQcbhUhOC1hg1MuxaDnEtsAT1RfMhRvPYk5qfh/U
/wpsVQKowDL0CoxYbcuyHRvyRWJNfqDMWUJixEZwJvt4qL/56AGFArxvcYkR00ZJ
r17sHl/263L9FYLCk+OAAPZKhRIyXvMOXePAe1JRAkFDGzlbdiiUrbVncu3dJ8cT
kg2SMSsWMY05rBUj7GEsjfNQYz64+08yJaqdoouLZ/3uTL9WfHhKzC1LlUinQtUy
x5+Zfw1QFf/WDxoTl7zudpmYgLZm/avfmyiuedyPSncCJ8kaG1VlBsZdejscTjmI
2c5RG+bQSVp7Hg/8fYkRJr95wQF43Tk8uI2SOyaLvdiSZzHuFU/TqnMaOBPnmdon
KMS8zY6NGp2Nrd1GMpg8f/6xp9bWSW0UG46eEG+cT/7tOkJoXnUTz1RT4q6zmLH6
n1cXAaPbKDn7dXJIAFdRWbczxz1qt1zSCrAfV8IkXAAcPqyTaEIziqxxGNH+p56T
ir2Uz/aHIDqVjmxjiHRNJ+c2
=lFTf
-----END PGP SIGNATURE-----

pinheadmz's public key is on openpgp.org

Comment thread src/chainparamsbase.cpp Resolved
@ekzyis

ekzyis commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for all the reviewz ❤️

40b712e removed unnecessary test testing the test framework, see #34566 (comment)

git range-diff master ab56c78 40b712e
$ git range-diff master ab56c78 40b712e80b
1:  b3d54514bf = 1:  b3d54514bf refactor: Import signet constant and helper from signet.h
2:  5418bf352a = 2:  5418bf352a Use different datadirs for different signets
3:  40a538ad83 ! 3:  e84bcd07c3 test: Add signet datadir tests
    @@ test/functional/feature_signet.py: class SignetBasicTest(BitcoinTestFramework):
     +
     +        self.log.info("Test that the signet data directory with -signetchallenge=SIGNET_DEFAULT_CHALLENGE is 'signet'")
     +        assert_node_datadir(self.nodes[6], "signet")
    -+
    -+        self.log.info("Test that a custom signet node with -rpcwait will read the auth cookie correctly")
    -+        self.nodes[0].wait_for_cookie_credentials()
     +
              self.log.info("test that signet logs the network magic on node start")
              with self.nodes[0].assert_debug_log(["Signet derived magic (message start)"]):
4:  e09e45c5c3 = 4:  4e3d41a68c doc: Update documentation for signet datadir
5:  ab56c78a99 = 5:  40b712e80b cli: Add -signetchallenge info on RPC auth error

@ViniciusCestarii ViniciusCestarii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK 40b712e

@pinheadmz pinheadmz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK 40b712e

Minimal change since last review, just remove an unnecessary functional test.

Show Signature
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

ACK 40b712e80ba1930766892ac5da9dc50e1837f5fd
-----BEGIN PGP SIGNATURE-----

iQJPBAEBCAA5FiEE5hdzzW4BBA4vG9eM5+KYS2KJyToFAmpqC0gbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMCwzAAoJEOfimEtiick66Q4P/ims1GazlwLyVwwBSfZ3
7+DaxyZxlRlskkAOfa7lrt+txC3MYpNktIZ1swZQ7w4DbYyE7pyp4SLpwkrNEhgd
bZE4kWAvwBU2xrKT0SQx0SPKDc2mpkjOpBCqstZS0sR/t872/DkIh2gJE4JoxAOF
Bmmi0C1oxJ8QHVJT6QoM1J7GQym0hplBcRSDEfhDdH2NtjqMGF42n1E1tamPjKSG
LacGk1PxBhAF/BVn6Rg029GD8d6QzV+W6nSmpDSX6wP2VmguVn6heRbzDdZf20oE
hElJvY6bY8okzJDJkt+xNDsGCQjfmXDfct/i7mtHmkwJYnsawhhVhtFDN1xsWNBN
x9nRDjbXlEGJpz5JIJXX1W8ReK4q234jwaS0fXZUiUlLzA8jlfsJ6ZEe1VcJyX8l
nIEtKSaL41v5x15JjXcxZcGwTIcZ5DQg2h8j8ZDOPXvO1CwABngYLteDGs9aEseQ
iplcI+YgOR/jBqwrZmkA05M5I8BDZ0O/2Ruvgalok9nsgvrXoz2T53gNBJYzm8f8
GeSkFmK/Ok+LeKLeq3fP5fyVkCFaqUyfgaOwrT5R9aeFKSgtXthSmG3mDP+v9SLW
JI+oIPeHVLUpxs6CxP0UlNGlb3jQsZajhhmTbx0veqtSAslKwDqw7SusgE+gEEfi
hX2XKSzmoSCNZujNY7LDepNB
=sGEv
-----END PGP SIGNATURE-----

pinheadmz's public key is on openpgp.org

@pinheadmz

Copy link
Copy Markdown
Member

I also built and ran the fuzzer from this branch just to make sure nothing got bumped 👍

@ajtowns ajtowns left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach ACK 40b712e

Comment thread src/CMakeLists.txt Resolved
Comment thread src/chainparamsbase.cpp Resolved
Comment thread src/chainparamsbase.cpp Resolved
@sedited

sedited commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

@ajtowns @pinheadmz @ViniciusCestarii can you take another look? Would be nice to ship this.

@ViniciusCestarii ViniciusCestarii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK f3be3f6

@pinheadmz pinheadmz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK f3be3f6

Built and tested on macos/arm64. Left a few non-blocking comments below. Major change since last review is moving the signet constants to a header file for cleaner build. New test coverage for empty challenge is nice too.

Show Signature
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

ACK f3be3f67a1817348f0aa219bfab7c3382c840333
-----BEGIN PGP SIGNATURE-----

iQJPBAEBCAA5FiEE5hdzzW4BBA4vG9eM5+KYS2KJyToFAmqhumUbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMCwzAAoJEOfimEtiick6F6QP/RaB91lhoD2YKgSajK51
eWNVehrfg80gp0amVijL7xer3nt11TkJTYrI1u52HXshsid6VAUH5I2eYaYdxSLF
vUWtYIIeP6/H71hb74ns8AOShMO+dOy0BssFBi1uycWuU0aEjvIs5eyY7gM4fYsU
vfN1CrnFQ8QixdIdtMn8XQ2sCAX66kVVJU+/HE9yV9QxnsWqVvziSmbjC0FeP/bo
KH+RI0aP2Gol2PhK/hQtn59+KNNPs6O5Kv74voKgtdM3kE1Llhb4oh95jDjfsl/f
/oTYlPBn8iCf9Z/IDfzHLroOeD7hKTeByh3JbF7r0Gu+YAg1RAoOZPNwZ9ZXZoSs
aofg1cVrNQz+PnUT12DNwF5+aE/f9vgkKrXg3FOyvc7hQ6qKMdwsxTt8YnDlFd+S
NEGYwaG6qtMOPXpeqmFTZDMP74JXkBLhpEm0d5soyoyn36+lDeGPMETSs9Asq9Hy
/s+vK2Fh/ihHpR2N8eerx8brUVVK0KicAKULr/gLYjjl17bIdsKljO4wWnQMWzfp
f6cCU29HSweyV1IynCrrgRJZm3o5gzySaGvt9RWOJEUbMfHUXJrMnWDToJBwLwyq
pksxkWqtOcJt2YA1g1k86z4SOqtl7UmptIB4dAq2dcKLKhQxRYAlDW3hcE64sLpA
icxpTE3TTiquEyK2YyHGtzJV
=yQq9
-----END PGP SIGNATURE-----

pinheadmz's public key is on openpgp.org

Comment thread doc/release-notes-34566.md Resolved
Comment thread src/bitcoin-cli.cpp Resolved
ekzyis and others added 5 commits September 11, 2026 22:18
We want to reuse SIGNET_DEFAULT_CHALLENGE and GetSignetMessageStart in
the following commit, so we import them from a new signet header in
src/kernel.

We created a new header file instead of reusing src/signet.h to avoid
unnecessary changes to any CMakeLists.txt.
This adds support for syncing multiple signets.

Each custom signet is stored in a different datadir, using the network
magic (message start) as the suffix.

The default signet is always stored without a suffix for backward
compatibility, even if the default challenge is provided explicitly via
-signetchallenge.

Co-authored-by: Brandon Odiwuor <[email protected]>
Co-authored-by: Brandon Odiwuor <[email protected]>
@ekzyis

ekzyis commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor Author

f3be3f6..feeb00a: rebased on master (f3fec67), updated documentation, hint and tests.

@ViniciusCestarii ViniciusCestarii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-ACK feeb00a

@sedited sedited left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK feeb00a

@@ -0,0 +1,20 @@
Network changes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this belongs in network changes, but not sure what header to give this either. Maybe "Updated Settings"?

@ekzyis ekzyis Sep 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "Updated Settings" is better! IIRC I tried to find examples in the past of similar changes to see what they used, but couldn't find any or it was a skill issue.

(I'll wait a few days for more feedback before force-pushing a different commit.)

Comment thread doc/files.md
-------------------------------|--------------------
`-signet -signetchallenge=...` | *path_to_datadir*`/signet_XXXXXXXX/`

(It will still use `/signet/` for the default signet or if the default signet challenge is passed to `-signetchallenge`.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe "still" here is bad because it unnecessarily refers to missing context (the past) (like LLMs that include context of the conversation in their comments 😅)

@pinheadmz

Copy link
Copy Markdown
Member

ACK feeb00a

Changes since last review are rephrasing an error message, adding a test for it, and rephrasing the release note.
Reviewed but did not build or test since last ACK.

p.s. "Network Changes" may not be right for the release note, could just be "Signet Changes". Doesn't really matter until release time though right?

Show Signature
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

ACK feeb00af8cf361ba9d2f7de0334abf875b3103d9
-----BEGIN PGP SIGNATURE-----

iQJPBAEBCAA5FiEE5hdzzW4BBA4vG9eM5+KYS2KJyToFAmqpgqAbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMCwzAAoJEOfimEtiick6tlwP/0j6++vbQj0PvoQ3yz3M
hQTfqrnTjhf8GJHfaMXheVnmPu7i54AotTbfSacWmckA7iXn71kTpGG47rzu7bLp
mDyz1YM+ODgHxlqMMT7sCxjza2sBSiaugwKbGH4IXa/L1guClahP+npZb/5oIP+Y
jCnsn+2eREfSULQYXzd5+DeZ1Eyi0XYttaFx7zHc90Ll9/1JawDboS2MY30jU95/
oVRFAq0Ce+hA6AnM3xlwh8FaCn12xB/K/dVaTHV0exY100y6n6zfQrWcZ2wx+Zfl
QSm9HCDMVdnSHCi67lXflB5y6jGogFuuSbbiwm98gKESH6krP9AY/It6onQBcg87
dpWED2zudVyTfoXLkcEnF91OKzcqC4dP8DqnApeYZSjF6o9KiMz/aAjnIBibydse
SqIfKib8z1Y+3ur8ETpvEYMgEauPx7qbsJ6t5D+vUx44sCSkJ6uHh2SiRenvDqxp
cKK5/3zrmDKuBtj0/XsX5AyMOLCAHg0G6MtctQx27g5wYolj9hKdBWOwiimvPHRb
jxjF+KH046nqyGcTN/ue/WCzG70yTpec7RJqbC9Qx7WVkFNYowbMzn8zsLB3kBMQ
aNj3b65h3thE6/8OOtb/tuEfNMjUJ9O8/J9oFsQZQoW2vPX511n3cOFzSC9xzRJA
TaJWfPGXW64+/z9Hf7ucdmDr
=7Msf
-----END PGP SIGNATURE-----

pinheadmz's public key is on openpgp.org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use different datadirs for different signets

7 participants