Skip to content

Fix DigiByte network parameters - #1361

Merged
NicolasDorier merged 5 commits into
MetacoSA:masterfrom
saltedlolly:fix/digibyte-genesis
Oct 26, 2026
Merged

NicolasDorier merged 5 commits into
MetacoSA:masterfrom
saltedlolly:fix/digibyte-genesis

Conversation

@saltedlolly

@saltedlolly saltedlolly commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

The DigiByte network definition added in #1268 can't be used against a real DigiByte node yet:

  • It used Bitcoin's genesis blocks, so GenesisHash on all three DigiByte networks returned Bitcoin's hash.
  • It advertises P2P protocol version 70016. DigiByte Core v8.22+ requires at least 70017 (MIN_PEER_PROTO_VERSION) and disconnects the peer straight after version.
  • SupportSegwit and SupportTaproot are false and no Taproot HRP is set, so a Taproot address on the DigiByte network is encoded as bc1p…, a Bitcoin address. SegWit and Taproot are both active on DigiByte mainnet.

This PR fixes these and brings the other parameters in line with DigiByte Core v9.26.7.

Changes (NBitcoin.Altcoins/DigiByte.cs)

Before After
Mainnet genesis Bitcoin's 7497ea1b465eb39f1c8f507bc877078fe016d6fcb6dfad3a64c98dcc6e1e8496
Mainnet DNS seeds seed.digibyte.org / .co, digiexplorer.info seed.digibyte.io, seed.diginode.tools, seed.digibyte.link, seed.aroundtheblock.app, seed.tuyul.cc
Testnet Bitcoin genesis, magic 0xDDB6C3FA, ports 12026 / 14023 testnet26: genesis 0c9af936f28f7bd0e90c8f6235399063a026ed267bb53da398313b5d7aa55d82, magic 0xE7B9C6FE, P2P 12033, RPC 14026, testnetseed.digibyte.io / .link / .services
Regtest genesis Bitcoin's 4598a0f2b823aaf9e77ee6d5e46f1edb824191dcd48b08437b7cec17e6ae6e26
P2P protocol version (all networks) 70016 (default) 70017
SupportSegwit / SupportTaproot (all networks) false true
Taproot HRP unset (fell back to bc) dgb / dgbt / dgbrt

I rebuilt each genesis block from the CreateGenesisBlock(...) parameters in DigiByte Core's src/kernel/chainparams.cpp. The hashes match the values Core asserts.

Tests

Two new tests in AltcoinTests.cs:

  • DigiByteHasCorrectGenesisBlocks checks the genesis hash of each network and that each genesis merkle root is consistent.
  • DigiByteSupportsSegwitAndModernPeers checks the protocol version and SegWit/Taproot flags on each network, and the dgb1q / dgb1p / dgbrt1q address prefixes.

Run locally on net10.0: the DigiByte tests, NoCrashQuickTest and NetworkTests all pass. NBitcoin.Altcoins builds for all target frameworks.

I also connected with Node.Connect and default settings to live DigiByte Core 9.26.7 peers. On mainnet and testnet the handshake succeeds and headers fetched from genesis link to the new genesis hashes. A recent mainnet block deserializes with a matching hash and merkle root, and its outputs resolve to D… and dgb1q… addresses.

Known limitation: header proof of work

DigiByte mines with five algorithms (SHA256d, Scrypt, Skein, Qubit, Odocrypt). BlockHeader.CheckProofOfWork() only knows SHA256d, so it returns false for most DigiByte headers, and P2P header sync fails unless SkipPoWCheck is set. This PR doesn't change that. NBXplorer reads headers over RPC, so it isn't affected.

Note on testnet

DigiByte's testnet is reset alongside DigiDollar release candidates, so the testnet parameters may need occasional updates. I maintain DigiNode Tools and plan to add DigiByte to NBXplorer and BTCPay next, so I'll send those updates when they're needed.

🤖 Generated with Claude Code

saltedlolly and others added 2 commits October 16, 2026 23:32
The DigiByte genesis blocks were copied from Bitcoin, so the networks
had Bitcoin's genesis hash. Replace them with DigiByte's real genesis
blocks (hashes match the asserts in DigiByte Core v9.26 chainparams).

Also bring testnet in line with DigiByte Core v9.26 (testnet26: new
genesis, magic, P2P port 12033, RPC port 14026, seeds), update the
mainnet DNS seeds, and add a unit test for the genesis hashes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X472vV1yZebyxsjWJTkuT3
DigiByte Core v8.22+ disconnects peers below protocol version 70017
(MIN_PEER_PROTO_VERSION), so NBitcoin's default of 70016 could not
complete a handshake. Advertise 70017.

SegWit and Taproot are active on DigiByte, but SupportSegwit and
SupportTaproot were left false and no Taproot HRP was set, so Taproot
addresses were encoded with Bitcoin's "bc" prefix. Enable both and set
TAPROOT_ADDRESS to the network's HRP.

Checked against live DigiByte Core 9.26.7 peers on mainnet and testnet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NicolasDorier

Copy link
Copy Markdown
Collaborator

@saltedlolly do I understand correctly that this shitcoin never worked since May 11, 2025 and nobody saw it?

Because I'm not really for maintaining dead code in NBitcoin. Are you really using this?

@saltedlolly

saltedlolly commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

I intend to use it, hence the PR. I was not involved in the previous PR so can't speak to that, though undoubtedly it should not have been merged given that it was incomplete, and did not work.

@NicolasDorier

NicolasDorier commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

@saltedlolly fix the tests then (or remove them)

@saltedlolly

Copy link
Copy Markdown
Contributor Author

I am on vacation until
Saturday with limited data. I will try and do it before then, but if not, on Sunday.

NBitcoin can't derive Taproot addresses without HAS_SPAN, so the check
threw NotSupportedException on the net472 and netstandard2.0 CI jobs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@saltedlolly

Copy link
Copy Markdown
Contributor Author

Fixed in 6a27152. The new DigiByte test generated a Taproot address, which NBitcoin doesn't support on .NET Framework, so it threw on the net472 and netstandard2.0 jobs. That assertion now only runs under HAS_SPAN.

The other failure on the netstandard2.0 job, TransactionBuilderFuzzying, isn't related to this PR. It uses random inputs and passes locally in the same configuration (all 438 UnitTest/Altcoins tests pass).

saltedlolly and others added 2 commits October 25, 2026 18:07
Lets RPCClient find ~/.digibyte/.cookie (and testnet26/, regtest/)
without explicit credentials, as it already does for Litecoin and others.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Consensus.PowTargetSpacing was left at zero, so GetExpectedBlocksFor
divided by zero. NBXplorer uses it to turn a pruning window into a block
count, so DigiByte wallets were never pruned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NicolasDorier
NicolasDorier merged commit e6bdd6f into MetacoSA:master Oct 26, 2026
6 checks passed
@NicolasDorier

Copy link
Copy Markdown
Collaborator

pushed NBitcoin.Altcoins 6.0.12

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.

2 participants