
Chukwuma Zikora
Software Engineer. RPA and DevOps Enthusiast
Setting Up Bitcoin Core, Fulcrum, and Electrum in Regtest
A step-by-step guide on how to set up Bitcoin Core, Fulcrum, and Electrum in regtest mode for local development and testing.

Bitcoin enables developers to create decentralized applications (dApps) that can process transactions and interact with smart contracts. However, running a full node on a local machine can be challenging, especially for developers who are new to blockchain technology. An alternative solution could be to use a testnet, which is a simulated version of the Bitcoin blockchain. However, setting up a testnet can be time-consuming and requires additional configurations. In this blog post, we will explore how to set up Bitcoin for local development and testing.
This blog guides you through the process of downloading, setting up Bitcoin Core, Fulcrum, and connecting your electrum wallet to the regtest network. We will also cover how to transfer bitcoin from your Bitcoin Core to your Electrum wallet, create and view your wallet addresses on Electrum and Bitcoin Core, and check the your wallet balances.
Contents
- Download and Setup Bitcoin Core and Fulcrum
- Running Bitcoin Core, Fulcrum, and Electrum
- Transfer Bitcoin from Bitcoin Core to Electrum
Download and Setup Bitcoin Core, Fulcrum, and Electrum
Bitcoin Core
Bitcoin Core is a full-node implementation of the Bitcoin protocol. It allows you to participate in the Bitcoin network and perform various operations such as sending and receiving transactions, mining, and validating blocks. Bitcoin Core is written in C++ and is open-source.
To download and install Bitcoin Core, follow these steps:
- Download the Bitcoin Core binary from the official website.
- Extract the downloaded archive and place the binary in a directory, e.g.,
~/apps/bitcoin
. - Verify the checksum or signature to ensure the binary is genuine.
Fulcrum.
Fulcrum is a fast SPV server for Bitcoin. It is written in C++ and is open-source. Fulcrum is designed to be lightweight and fast, making it suitable for use in resource-constrained environments.
To download and install Fulcrum, follow these steps:
- Download a Fulcrum pre-built binary from the official website.
- Extract the downloaded archive and place the binary in a directory, e.g.,
~/apps/fulcrum
.
NOTE: If you do not find a prebuilt binary for your operating system, you can build it from source. Follow the instructions in this readme.
Electrum
Electrum is a lightweight Bitcoin wallet for Windows, Mac, and Linux. It is open-source and free to use. It can be used to create, manage, and secure your Bitcoin wallet. Electrum is a command-line tool, which means you can use it from the command line or integrate it into your own applications.
Since we need to be able to connect to our local Bitcoin Core node, we will choose an installation that allows us start up the application using the --regtest
flag. Following the instructions in the official documentation: Installation from Python sources, we can install Electrum using pip:
- Download the Python source code from the official repository
- Install the required dependencies depending on your operating system
- Install the package using pip
python3 -m pip install --user Electrum-*.tar.gz
Configuration Files
Create a configuration file for Bitcoin Core at ~/.bitcoin/bitcoin.conf
. Bitcoin core looks for this file in this location by default.
server=1
rpcuser=user
rpcpassword=password
regtest=1
zmqpubrawblock=tcp://0.0.0.0:28334
zmqpubrawtx=tcp://0.0.0.0:28335
zmqpubhashblock=tcp://0.0.0.0:28336
datadir=/home/<your-username>/.blockchain/bitcoin-regtest
txindex=1
dnsseed=0
upnp=0
[regtest]
rpcbind=0.0.0.0
rpcallowip=0.0.0.0/0
rpcport=18444
listenonion=0
fallbackfee=0.0003
connect=127.0.0.1
- Explanation:
regtest=1
: Runs Bitcoin in regression testing mode (a local, isolated blockchain).zmqpub*
: Enables ZeroMQ for Fulcrum to communicate with Bitcoin Core.datadir
: Specifies the directory for blockchain data.fallbackfee
: Sets a fallback fee for transactions.
Similarly, create a Fulcrum configuration file at ~/.bitcoin/fulcrum.conf
:
datadir=/home/<your-username>/.blockchain/fulcrum-data
bitcoind=127.0.0.1:18444
rpcuser=user
rpcpassword=password
ssl=127.0.0.1:51002
cert=/home/<your-username>/apps/fulcrum/cert.pem
key=/home/<your-username>/apps/fulcrum/key.pem
peering=false
log-level=DEBUG
utxo_cache=3000
- Explanation:
bitcoind
: Points to Bitcoin Core's regtest RPC server.ssl
: Configures SSL for Electrum clients to connect securely.utxo_cache
: Sets the RAM size for the UTXO cache.
To generate the certificates for Fulcrum, run the following command:
cd ~/apps/fulcrum
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
Create Aliases for Easier Access
To simplify command usage, create aliases in your shell configuration file (~/.bashrc
or ~/.zshrc
):
alias bitcoin-cli="~/apps/bitcoin/bin/bitcoin-cli"
alias bitcoind="~/apps/bitcoin/bin/bitcoind --regtest"
alias fulcrum="~/apps/fulcrum/Fulcrum ~/.bitcoin/fulcrum.conf"
Add other aliases as needed. To apply the changes, run source ~/.bashrc
or source ~/.zshrc
.
Running Bitcoin Core, Fulcrum, and Electrum
Bitcoin Core
Start the Bitcoin Core daemon in regtest mode:
bitcoind
Note: We added the --regtest flag to the bitcoind command when we set our alias in the previous step. This flag tells Bitcoin Core to run in regtest mode, which is a local, isolated blockchain for testing purposes. Create a Wallet:
bitcoin-cli -regtest createwallet main
Load the Wallet:
bitcoin-cli -regtest loadwallet "main"
Generate Initial Balance
Generate a new address for mining:
bitcoin-cli -regtest getnewaddress
Mine 101 blocks to this address:
bitcoin-cli -regtest generatetoaddress 101 <address>
- This generates 50 BTC per block and unlocks spendable coins.
You can also generate a new address and mine the coins to it in one command:
bitcoin-cli -regtest generatetoaddress 101 $(bitcoin-cli -regtest getnewaddress)
You can check the balance of your loaded wallet with the following command:
bitcoin-cli -regtest getbalance
Fulcrum
Start the Fulcrum server:
fulcrum
If all goes well, you should see the Fulcrum server start and begin syncing with the Bitcoin Core node.
Electrum
Run Electrum in regtest mode:
electrum --regtest
Follow the system prompt to create a standard wallet.
Transfer Bitcoin from Bitcoin Core to Electrum
Now that we have services and wallets set up, we can transfer some Bitcoin from Bitcoin Core to Electrum.
Receive Bitcoin in Electrum
To receive Bitcoin in Electrum, we need to first get our Electrum bitcoin address. To do this, navigate to the Receive tab in Electrum. You may need to fill a fund request form with payment amount and create a request to see the receiving address.
With that address in hand, run the following command to send some Bitcoin to it:
bitcoin-cli -regtest sendtoaddress <electrum-address> <amount>
Be sure to replace <electrum-address>
with the address you copied from Electrum and <amount>
with the amount you want to send. The fund should immediately appear in your Electrum wallet with a status of "unconfirmed".
Confirm the Transaction
Transactions in Bitcoin are confirmed by miners. To confirm a transaction, we need to generate a new block in the Bitcoin blockchain. This process is called mining. You can mine a block by running the following command:
bitcoin-cli -regtest generatetoaddress 1 <bitcoin-core-wallet-address>
This will reward you, the miner, with 50 BTC. The fund transfer should now be confirmed. You can check the balance of your Bitcoin Core wallet to verify the transfer. bitcoin-cli -regtest getbalance
Additional Tips
- List All Addresses:
bitcoin-cli -regtest listreceivedbyaddress 0 true
- Monitor Transactions:
bitcoin-cli -regtest getrawmempool
Troubleshooting
- Transaction Stuck in Mempool: Check
fallbackfee
inbitcoin.conf
. Increase it if necessary. - Electrum Not Connecting: Ensure Fulcrum is running and SSL configuration matches.