kernel: can't load blocks from a custom signet #35362

issue edilmedeiros opened this issue on May 22, 2026
  1. edilmedeiros commented at 2:56 PM on May 22, 2026: contributor

    libbitcoinkernel public api define btck_ChainType as a single byte. As such, there's no way to inform the signetchallenge parameters so that the resulting btck_ChainstateManager can work with signets other than the "public" one.

    Also, as far as I can understand, none of the functions exported in the public API can be used to achieve such a result. This information comes from ArgsMann in the node, which is abstracted away in the kernel library.

    I wonder what would be the best approach to solve this. Maybe a richer btck_ChainType capable of carrying more information.

    Found this with @oleonardolima during a @vinteumorg bitcoinkernel study session. We were trying to load this datadir, a custom chain we use in the educational programs.

  2. bitcoin deleted a comment on May 25, 2026
  3. stickies-v commented at 11:10 AM on May 27, 2026: contributor

    I wonder what would be the best approach to solve this.

    The CChainParams::SigNet factory method takes an optional SigNetOptions struct, so it should be fairly straightforward to add an optional signet_challenge parameter to btck_chain_parameters_create?

  4. sedited commented at 11:21 AM on May 27, 2026: contributor

    so it should be fairly straightforward to add an optional signet_challenge parameter to btck_chain_parameters_create

    I'm not sure about adding a paramter, seems like that could get very crowded and confusing quickly. I was working on solving this issue on the weekend: https://github.com/sedited/bitcoin/commit/e79d107f092d177691b8b3bc7cd35a1671c192b9 , but then saw darosior's #35335, which adds dedicated methods for every network. So maybe we can keep the btck_chain_parameters_create function as is, and just add new functions for every available network with their respective options.

  5. stickies-v commented at 1:54 PM on May 27, 2026: contributor

    I'm not sure about adding a paramter, seems like that could get very crowded and confusing quickly.

    You're right. And especially test-only options should minimally leak into the non-test interface.

    and just add new functions for every available network with their respective options.

    So you mean something like void btck_chain_parameters_set_signet_challenge(btck_ChainParameters* params, const char* challenge, size_t challenge_len)?

  6. edilmedeiros commented at 2:30 PM on May 29, 2026: contributor

    So maybe we can keep the btck_chain_parameters_create function as is, and just add new functions for every available network with their respective options.

    I think this would be a better design overall. That way the api will resemble more a builder pattern: you create a default btck_ChainParameters with btck_chain_parameters_create() and have methods to modify/configure the opaque structure.


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-06-11 10:51 UTC

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