0

I'm very new (as of today) to NBitcoin library, just trying to figure out how I might use it to develop some integration tests.

Ultimately my question is: How do I use NBitcoin with existing bitcoin core testnet?

Background:

I'm going through this example from the docs Alice sends through Bob through Bitcoin RPC And I'm confused (unsurprisingly) about the behavior I'm seeing.

It starts out like this:

            using (var env = NodeBuilder.Create(NodeDownloadData.Bitcoin.v0_18_0, Network.RegTest))
        {
            // Removing node logs from output
            env.ConfigParameters.Add("printtoconsole", "0");

            var alice = env.CreateNode();
            var bob = env.CreateNode();
            var miner = env.CreateNode();
            env.StartAll(); //etc...

Then it proceeded to run for over 4 hours until I stopped it at ~15gb. I gather it was downloading an entire testnet node into the project folder which would be over 30gb.

2022-06-14T21:59:34Z Requesting block 0000000084cc951412348cf341a7ba90232248a280318d4f8bf740a8659074da (1668) peer=1
2022-06-14T21:59:34Z sending getdata (37 bytes) peer=1
2022-06-14T21:59:34Z received: block (216 bytes) peer=0
2022-06-14T21:59:34Z received block 00000000be752294d937ba5fe0ee228b01bf5b11e26691e44a6a3cfb50fe1018 peer=0

Then when I tried to restart it, I got an error that existing bitcoind instance was running and to kill it. Then when I restart it, it STARTED OVER downloading.

I understand it I guess, but it seems impractical. I never made it as far as the point of the example.

How do more experienced people set up their environment for use? Connect to a local instance of bitcoin core?

Thanks,

Joel

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.