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

Invalid Hex String when SetGenesis #4

Open
weijia-yu opened this issue Nov 9, 2017 · 5 comments
Open

Invalid Hex String when SetGenesis #4

weijia-yu opened this issue Nov 9, 2017 · 5 comments

Comments

@weijia-yu
Copy link

I am having this error when decoding genesis block data:
rror when CreateAndStorePrivateKey System.FormatException: Invalid Hex String
at NBitcoin.DataEncoders.HexEncoder.DecodeData (System.String encoded) [0x00019] in <10b18eedccec443eb5e12121cb174cf4>:0

We are using bitcoin-like blockchain and trying to modify the Network.cs,
also, weirdly the SetGenesis() does not reply on magic number? Even I set Genesis using litecoin test net data, and use our blockchain's magic number, it still successfully registeres.

@NicolasDorier
Copy link
Contributor

What is your code and which line the error?

@weijia-yu
Copy link
Author

@NicolasDorier line 186, when .SetGenesis(new Block(Encoders.Hex.DecodeData("data"))), We generate the data with the header. which headers should we use to generate the byte data? Should we include HashGenesisBlock ?

@NicolasDorier
Copy link
Contributor

I don't understand, just serialize your block in byte array and call SetGenesis. If the crypto currency in question has the same format as bitcoin it should work.

@weijia-yu
Copy link
Author

@NicolasDorier does the error relate to other parameters I set? For example, if i set the wrong magic number, will it produce invalid hex string?

@NicolasDorier
Copy link
Contributor

please copy paste your code here.

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

2 participants