I'm using https://github.com/MetacoSA/NBitcoin for a simple C# application, that just downloads the Bitcoin blockchain.
What I already achieved is downloading the block headers via NodesGroup
:
var parameters = new NodeConnectionParameters();
parameters.TemplateBehaviors.Add(new ChainBehavior());
var group = new NodesGroup(Network.Main, parameters, new NodeRequirement()
{
RequiredServices = NodeServices.Network
});
group.Connect();
//wait some time
var chain = parameters.TemplateBehaviors.Find<ChainBehavior>().Chain;
The only way of downloading the full blocks (with transactions) I found is using a single Node
:
var node = new Node(/*whatever*/)
var blocks = node.GetBlocks(/*hash of the last block I want*/)
So here is my question: Is there a way of downloading the full blocks (with transactions) directly and in parallel from the connected nodes in NodesGroup
, just like I did with the block headers?
Thanks in advance!
I just got informed, that NBitcoin currently does not support this feature. I will have to stick to the one node solution:
var node = new Node(/*whatever*/)
var blocks = node.GetBlocks(/*hash of the last block I want*/)