Using regtest for Bitcoin Testing: A Practical Guide

10 replies 160 views
hawk42Full Member
Posts: 6 · Reputation: 346
#1Mar 16, 2018, 06:04 PM
I see a lot of questions about where to get test bitcoins for testing stuff. People often suggest using regtest instead of the testnet, but honestly, it’s not always clear what regtest really is or how to get it going. So I thought I’d throw together this guide to help anyone get started from the ground up.
3 Reply Quote Share
hawk42Full Member
Posts: 6 · Reputation: 346
#2Mar 16, 2018, 11:39 PM
Alright, moving on to part two. Here we’re gonna set up the environment for transactions. Sure, you can stick with bitcoin-cli commands, but I’m thinking you want to get into some Python code to really get the hang of regtest for your own projects.
1 Reply Quote Share
hawk42Full Member
Posts: 6 · Reputation: 346
#3Mar 17, 2018, 12:49 AM
If you’ve been following along, you should have a fully functional regtest environment now. Time to have some fun and create a raw transaction, sign it, and send it all from a Python script. Let’s get coding!
0 Reply Quote Share
hawk42Full Member
Posts: 6 · Reputation: 346
#4Mar 19, 2018, 07:41 AM
Now, let’s get into some details. One main difference between regtest and testnet/mainnet is the lack of a nice block explorer. But you might still need to check stuff on regtest. So, I wrote another Python script to grab basic info on the regtest chain and transactions.
3 Reply Quote Share
gang2015Member
Posts: 682 · Reputation: 62
#5Mar 19, 2018, 10:49 AM
Awesome guide! Nice to see you included example Python code with outputs.
4 Reply Quote Share
hawk42Full Member
Posts: 6 · Reputation: 346
#6Mar 19, 2018, 11:30 AM
Thanks for the feedback! I added the setup details like Bitcoin Core version and Python info to the first post, just for clarity.
1 Reply Quote Share
sat_laserMember
Posts: 6 · Reputation: 86
#7Mar 19, 2018, 03:43 PM
Cool to see a fellow Belgian sharing this kind of helpful info. Really nice thread!
0 Reply Quote Share
ben69Member
Posts: 1 · Reputation: 62
#8Mar 19, 2018, 05:41 PM
Thanks for all the info! As a non-coder, I find testnet pretty user-friendly and quick for testing projects.
2 Reply Quote Share
kevinlynxNewbie
Posts: 1 · Reputation: 15
#9Mar 21, 2018, 06:12 AM
Hey, quick question. Why can’t I connect two Bitcoin Core instances in regtest mode over the internet? What am I doing wrong?
6 Reply Quote Share
ape21Member
Posts: 13 · Reputation: 242
#10Mar 22, 2018, 02:30 AM
I’m a bit lost here. I found a PyPI library called bitcoinrpc that's at version 0.7.0 but it’s missing the "authproxy" module. What’s the deal with the bitcoinrpc you mentioned?
1 Reply Quote Share
0xChadNewbie
Posts: 513 · Reputation: 3
#11Mar 22, 2018, 05:03 AM
That must be the library from jgarzik. Check out this link for it: pypi.org/project/python-bitcoinrpc. It's got the authproxy and was around before this thread started.
5 Reply Quote Share

Related topics