Skip to content

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

Open

Description

@edilmedeiros

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.

Activity

  1. deleted a comment from TAO92996my on May 25, 2026
  2. stickies-v commented on May 27, 2026

    @stickies-v
    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?

  3. sedited commented on May 27, 2026

    @sedited
    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: sedited@e79d107 , 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.

  4. stickies-v commented on May 27, 2026

    @stickies-v
    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)?

  5. edilmedeiros commented on May 29, 2026

    @edilmedeiros
    ContributorAuthor

    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.

  6. added a commit that references this issue on Jul 7, 2026
  7. added a commit that references this issue on Jul 10, 2026
  8. added a commit that references this issue on Aug 19, 2026
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