MultiversX Tracker is Live!

Understanding NBitcoin node creation in Bitcoin RPC docs example

Bitcoin Stack Exchange

Bitcoin News / Bitcoin Stack Exchange 117 Views

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


Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments