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

Unable to decode segwit blocks #1236

Open
Newbitcoinerhere opened this issue Oct 28, 2024 · 0 comments
Open

Unable to decode segwit blocks #1236

Newbitcoinerhere opened this issue Oct 28, 2024 · 0 comments

Comments

@Newbitcoinerhere
Copy link

Newbitcoinerhere commented Oct 28, 2024

when we give segwit blocks for decoding. It decodes just the header. But the inputs and outputs remain 0. Example block {0000000000000000006ccd22f57e946189f5213ce49ef3fef43df46bfd0b6c86}. https://www.blockchain.com/explorer/blocks/btc/0000000000000000006ccd22f57e946189f5213ce49ef3fef43df46bfd0b6c86. Header and transaction count is decoded but the input details and output details come as 0. Tried many files post 1000. may its issue with the witness data??

Note: bitcoin core ccli can decode to json without any issues. So the local files are not corrupt.

Code:
var wholeBlock = streamReader.ReadBytes((int)blockMemoryStreamReader.BaseStream.Length);
var rawBlockHex = BitConverter.ToString(wholeBlock).Replace("-", "").ToLower();
byte[] rawData = NBitcoin.DataEncoders.Encoders.Hex.DecodeData(rawBlockHex);
NBitcoin.Block block = NBitcoin.Block.Load(rawData, Network.Main);

@Newbitcoinerhere Newbitcoinerhere changed the title Unable to decode segit blocks Unable to decode segwit blocks Oct 28, 2024
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

1 participant