Skip to content

Conversation

@sipsorcery
Copy link
Contributor

With testnet full of spam a custom sigent has become more appealing.

This PR is an attempt at allowing NBitcoin to initialise a signet with a custom challenge (no more flakey faucets).

I got this approach to work with nbxplorer to index my custom signet blockchain but despite that I'm not sure if this is the ideal approach or not. Happy to take any advice on alternatives.

Signed-off-by: Aaron Clauson <aaron@sipsorcery.com>
@Kukks
Copy link
Contributor

Kukks commented Sep 16, 2024

Does #1222 help you?

@sipsorcery
Copy link
Contributor Author

Thanks for the follow-up.

Does #1222 help you?

I don't think so. Isn't MutinyNet just hard coding another signet variation?

This PR is so the hard coded parameters are not required and NBitcoin can be used with any arbitrary signet challenge.

@NicolasDorier
Copy link
Collaborator

@sipsorcery concept ACK, but can you rebase as I merged #1222 which moved some stuff around

@sipsorcery
Copy link
Contributor Author

@Kukks I was looking at the signet and mutinynet initialisation and the only differences are:

  • chain name and aliases
  • POW target spacing
  • network seeds
  • challenge

One thing not different, that I suspect should be, is the genesis block. I think NBXplorer uses it to detect the start of the chain. MutinyNet can't be using the same genesis block as the default signet chain given they have different block signing keys. Might not matter if NBXplorer is not being used.

I could add another partial class to initialise a custom signet but it would seem better to create a single bitcoin signet class that can be initialised with different options for the parameters above. wdyt?

@dangershony
Copy link
Contributor

ACK good idea, we also use a custom signet.

@Kukks
Copy link
Contributor

Kukks commented Feb 27, 2025

I believe this should be possible now without this PR. Could you check?

@sipsorcery
Copy link
Contributor Author

@Kukks unless I've missed something there's still no way to register a custom signet provider.

I'm running a set of signet nodes that aren't using the default signet or mutinynet signing key. The idea bheind this PR was to be bale to register a network with an arbitrary signet challenge and genesis block.

The approach in this PR is outdated. It would now be better to either use a new Bitcoin.SignetCustom class or avoid a lot of repeated code and combine Bitcoin.Signet, Bitcoin.MutinyNet and BitcoinSignetCustom into a common class with some way to set the different properties, e.g. block spacing, name, challenge and genesis block.

@1ma
Copy link

1ma commented Jan 15, 2026

I would like to add a BtcPayServer service to my signet-playground Docker stack, but doesn't seem possible without this PR.

The other option seem to be hacking at the code in personal forks of NBitcoin, NBXplorer and BtcPayServer, which I'm not willing to do :(

@sipsorcery
Copy link
Contributor Author

@NicolasDorier @Kukks I just ended up using my own build for NBitcoin so I could run a custom signet. I'm happy to update this PR if you think it's of value?

@NicolasDorier
Copy link
Collaborator

@sipsorcery I think that would be nice yes.

@NicolasDorier
Copy link
Collaborator

@sipsorcery there seems to have still conflict

@sipsorcery
Copy link
Contributor Author

@NicolasDorier the new PR is #1293. This one is redundant now.

@knocte
Copy link
Contributor

knocte commented Jan 20, 2026

@sipsorcery but CI is broken in that one.

@sipsorcery
Copy link
Contributor Author

@knocte I spotted the broken tests as well. The tests all fail locally as well and as best I can tell are unrelated to the PR. The two new tests added for the custom signet do pass.

@knocte
Copy link
Contributor

knocte commented Jan 20, 2026

But master branch is passing CI recently: https://github.com/MetacoSA/NBitcoin/actions?query=branch%3Amaster

Are you sure they are unrelated?

@sipsorcery
Copy link
Contributor Author

Running the tests locally on master I get:

nbitcoin-master-tests

Running on my new signet-custom brnach I get:

nbitcoin-signet-custom-tests

The only difference is the two new tests passing.

@knocte
Copy link
Contributor

knocte commented Jan 20, 2026

Mmm you're right, i just pushed master to my fork and there's a lot of tests failing because of 404s. Maybe because tests rely on some BtcCore version that was taken down from the releases page? I recall there was a security bug recently. Ideally we should fix this before merging any PR.

@1ma
Copy link

1ma commented Jan 21, 2026

This should do it: #1295

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.

6 participants