MetacoSA / NBitcoin.Litecoin

Litecoin extensions for NBitcoin
MIT License
21 stars 24 forks source link

Invalid Hex String when SetGenesis #4

Open weijia-yu opened 6 years ago

weijia-yu commented 6 years ago

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 commented 6 years ago

What is your code and which line the error?

weijia-yu commented 6 years ago

@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 commented 6 years ago

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 commented 6 years ago

@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 commented 6 years ago

please copy paste your code here.