Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Testnet4 #1210

Open
claytantor opened this issue May 12, 2024 · 6 comments
Open

Support for Testnet4 #1210

claytantor opened this issue May 12, 2024 · 6 comments

Comments

@claytantor
Copy link

claytantor commented May 12, 2024

TestNet4 is coming and it would be awesome if there was an easy way to configure Network.TestNet to use testnet3, testnet4, or whatever.

I see something like Network.GetNetwork("testnet3") in some tests, is it possible to self configure for "testnet4"

in the implementation of Network.TestNet I see the following:

_TestNet = new Network("TestNet",
				Encoders.Hex.DecodeData("0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4adae5494dffff001d1aa4ae180101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000"),
				0x0709110B,
				null,
				NBitcoin.Bitcoin.Instance);

If I got some pointers/breadcrumbs on the appropriate encoding values for testnet4 I could probably implement it in a branch...

bitcoin/bitcoin#29775

@jlopp
Copy link

jlopp commented May 12, 2024

Here's the raw hex of the (current) testnet4 genesis block; it's subject to change until such time as the PR is merged though hopefully it won't.

0100000000000000000000000000000000000000000000000000000000000000000000004e7b2b9128fe0291db0693af2ae418b767e657cd407e80cb1434221eaea7a07a046f3566ffff001dbb0c78170101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff5504ffff001d01044c4c30332f4d61792f323032342030303030303030303030303030303030303030303165626435386332343439373062336161396437383362623030313031316662653865613865393865303065ffffffff0100f2052a010000002321000000000000000000000000000000000000000000000000000000000000000000ac00000000

@claytantor
Copy link
Author

claytantor commented May 13, 2024

Do you have any idea what 0x0709110B represents? Seems like its the magic number? Do we know the magic number for testnet4 ?

https://www.anintegratedworld.com/unravelling-the-mysterious-block-chain-magic-number/

@jlopp
Copy link

jlopp commented May 13, 2024

Looks like the network magic.

In the Bitcoin Core PR it's not very well commented; netmagic in chainparams.cpp is "pchMessageStart" which means the netmagic for testnet4 is 0x1c163f28.

Though note how testnet3 is defined in kernel/chainparams.cpp:

        pchMessageStart[0] = 0x0b;
        pchMessageStart[1] = 0x11;
        pchMessageStart[2] = 0x09;
        pchMessageStart[3] = 0x07;

Which is 0x0b110907 compared to NBitcoin's 0x0709110B.

This leads me to believe that Bitcoin Core and NBitcoin are using different endian notations. So the NBitcoin network magic string for testnet4 should be 0x283F161C

@claytantor
Copy link
Author

This leads me to believe that Bitcoin Core and NBitcoin are using different endian notations. So the NBitcoin network magic string for testnet4 should be 0x283F161C

Sooper helpful. PR incoming.

@mathis1337
Copy link

Just curious if there was any progress on this?

@turbolay
Copy link

I made a PR for that, #1216, but I'm not sure what to use as vSeeds for TestNet4

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

No branches or pull requests

4 participants