Skip to content

Commit ad0a093

Browse files
author
leonardojobim
authored
Update A3_0_Using_Bitcoin_Regtest for version 0.21
. It adds a " Generate Regtest Wallet" since Bitcoin Core v.021 does not automatically create new wallets on startup. If the reader try to mine without a wallet, it will receive the erro: "No wallet is loaded. Load a wallet using loadwallet or create a new one with createwallet. (Note: A default wallet is no longer automatically created)" . The command "bitcoin-cli -regtest generate" throws the error: " generate has been replaced by the -generate cli option.". So it fixes the command. . "bitcoin-cli -regtest sendtoaddress" throws the error: "Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee.", so the "fallbackfee." is added to the bitcoind startup.
1 parent 5ac748e commit ad0a093

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

A3_0_Using_Bitcoin_Regtest.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ The majority of this course presumes that you will either use the Mainnet or Tes
88

99
After [setting up your Bitcoin-Core VPS](02_0_Setting_Up_a_Bitcoin-Core_VPS.md) or [compiling from source](A2_0_Compiling_Bitcoin_from_Source.md), you are now able to use regtest. To start your `bitcoind` on regtest and create a private Blockchain, use the following command:
1010
```
11-
$ bitcoind -regtest -daemon
11+
$ bitcoind -regtest -daemon -fallbackfee=1.0 -maxtxfee=1.1
1212
```
1313

14+
The argments `-fallbackfee=1.0 -maxtxfee=1.1` will prevent the `Fee estimation failed. Fallbackfee is disabled` error.
15+
16+
On regtest, usually there are not enough transactions so bitcoind cannot give a reliable estimate and, without it, the wallet will not create transactions unless it is explicitly set the fee.
17+
1418
### Reset the Regtest Blockchain
1519

1620
If you wish, you can later restart your Regtest with a new blockchain.
@@ -25,12 +29,20 @@ To start a brand new Blockchain using regtest, all you have to do is delete the
2529
```
2630
$ rm -rf regtest
2731
```
32+
## Generate Regtest Wallet
33+
34+
Before generating blocks, it is necessary to load a wallet using `loadwallet` or create a new one with `createwallet`. Since version 0.21, Bitcoin Core does not automatically create new wallets on startup.
35+
36+
The argument `descriptors=true` creates a native descriptor wallet, that stores scriptPubKey information using output descriptors. If it is `false`, it will create a legacy wallet, where keys are used to implicitly generate scriptPubKeys and addresses.
37+
```
38+
$ bitcoin-cli -regtest -named createwallet wallet_name="regtest_desc_wallet" descriptors=true
39+
```
2840

2941
## Generate Blocks
3042

3143
You can generate (mine) new blocks on a regtest chain using the RPC method `generate` with an argument for how many blocks to generate. It only makes sense to use this method on regtest; due to the high difficulty it's very unlikely that it will yield to new blocks on the mainnet or testnet:
3244
```
33-
$ bitcoin-cli -regtest generate 101
45+
$ bitcoin-cli -regtest -generate 101
3446
[
3547
"57f17afccf28b9296048b6370312678b6d8e48dc3a7b4ef7681d18ed3d91c122",
3648
"631ff7b8135ce633c774828be3b8505726459eb65c339aab981b10363befe5a7",
@@ -109,7 +121,7 @@ $ bitcoin-cli -regtest gettransaction e834a4ac6ef754164c8e3f0be4f34531b74b768199
109121
However, you must now finalize it by creating blocks on the blockchain.
110122
Most applications require a six-block confirmations to consider the transaction as irreversible. If that is your case, you can mine additional six blocks into your regtest chain:
111123
```
112-
$ bitcoin-cli -regtest generate 6
124+
$ bitcoin-cli -regtest -generate 6
113125
[
114126
"33549b2aa249f0a814db4a2ba102194881c14a2ac041c23dcc463b9e4e128e9f",
115127
"2cc5c2012e2cacf118f9db4cdd79582735257f0ec564418867d6821edb55715e",

0 commit comments

Comments
 (0)