Repository navigation
Fix DigiByte network parameters - #1361
Conversation
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>
|
@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? |
|
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. |
|
@saltedlolly fix the tests then (or remove them) |
|
I am on vacation until |
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>
|
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 The other failure on the netstandard2.0 job, |
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>
|
pushed NBitcoin.Altcoins 6.0.12 |
The DigiByte network definition added in #1268 can't be used against a real DigiByte node yet:
GenesisHashon all three DigiByte networks returned Bitcoin's hash.MIN_PEER_PROTO_VERSION) and disconnects the peer straight afterversion.SupportSegwitandSupportTaprootare false and no Taproot HRP is set, so a Taproot address on the DigiByte network is encoded asbc1p…, 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)7497ea1b465eb39f1c8f507bc877078fe016d6fcb6dfad3a64c98dcc6e1e84960xDDB6C3FA, ports 12026 / 140230c9af936f28f7bd0e90c8f6235399063a026ed267bb53da398313b5d7aa55d82, magic0xE7B9C6FE, P2P 12033, RPC 14026, testnetseed.digibyte.io / .link / .services4598a0f2b823aaf9e77ee6d5e46f1edb824191dcd48b08437b7cec17e6ae6e26SupportSegwit/SupportTaproot(all networks)bc)dgb/dgbt/dgbrtI rebuilt each genesis block from the
CreateGenesisBlock(...)parameters in DigiByte Core'ssrc/kernel/chainparams.cpp. The hashes match the values Core asserts.Tests
Two new tests in
AltcoinTests.cs:DigiByteHasCorrectGenesisBlockschecks the genesis hash of each network and that each genesis merkle root is consistent.DigiByteSupportsSegwitAndModernPeerschecks the protocol version and SegWit/Taproot flags on each network, and thedgb1q/dgb1p/dgbrt1qaddress prefixes.Run locally on net10.0: the DigiByte tests,
NoCrashQuickTestandNetworkTestsall pass.NBitcoin.Altcoinsbuilds for all target frameworks.I also connected with
Node.Connectand 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 toD…anddgb1q…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 unlessSkipPoWCheckis 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