Author

Topic: Cant generate regtest coins (Read 109 times)

legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
October 31, 2021, 10:35:26 PM
#6
Oh wow I had no idea it was like that, I assumed it acted the way mainnet does. So I just delete the directory and it will start from block 0 again? Definitely too many blocks lol
-snip-
The halving interval is low because mining should be easy in RegTest, if it's set like in mainnet,
you'll likely wont be able to mine any more blocks using the same hardware after the next difficulty retarget if you generate blocks too fast.
You won't be needing too much coins in Regtest anyway since you can send satoshis instead of whole coins for tests.

From the above, you can skip editing consensus.fPowAllowMinDifficultyBlocks and consensus.fPowNoRetargeting to keep retarget disabled.
Just the consensus.nSubsidyHalvingInterval to copy mainnet's halving.
newbie
Activity: 3
Merit: 2
October 31, 2021, 10:33:48 AM
#5
Thank you i will do that, i built it from source on linux but still kind of new to programming it.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
October 31, 2021, 10:26:32 AM
#4
Oh wow I had no idea it was like that, I assumed it acted the way mainnet does.
If you want it to be just like main net, then download the source code and change the following from src/chainparams.cpp.

1. Set the consensus.nSubsidyHalvingInterval equal with 210000. (#L393)
2. Set the consensus.fPowAllowMinDifficultyBlocks to false. (#L405)
3. Set the consensus.fPowNoRetargeting to false. (#L406)

Now, build it, preferably, using a Linux LTS. I assume you're not a newbie in this field and know how to do it; otherwise just say it and we'll show you the steps.
newbie
Activity: 3
Merit: 2
October 31, 2021, 10:05:15 AM
#3
Oh wow I had no idea it was like that, I assumed it acted the way mainnet does. So I just delete the directory and it will start from block 0 again? Definitely too many blocks lol

bitcoin-cli -regtest getblockchaininfo
{
  "chain": "regtest",
  "blocks": 17930,
  "headers": 17930,
  "bestblockhash": "4de81b08c13b92fb7c2be25d31de2602ec478d923270f6a77d3a7348afac7f07",
  "difficulty": 4.656542373906925e-10,
  "time": 1635627965,
  "mediantime": 1635627964,
  "verificationprogress": 1,
  "initialblockdownload": false,
  "chainwork": "0000000000000000000000000000000000000000000000000000000000008c16",
  "size_on_disk": 5379150,
  "pruned": false,
  "softforks": {
    "bip34": {
      "type": "buried",
      "active": true,
      "height": 1
    },
    "bip66": {
      "type": "buried",
      "active": true,
      "height": 1
    },
    "bip65": {
      "type": "buried",
      "active": true,
      "height": 1
    },
    "csv": {
      "type": "buried",
      "active": true,
      "height": 1
    },
    "segwit": {
      "type": "buried",
      "active": true,
      "height": 1
    },
    "testdummy": {
      "type": "bip9",
      "bip9": {
        "status": "active",
        "start_time": 0,
        "timeout": 9223372036854775807,
        "since": 432,
        "min_activation_height": 0
      },
      "height": 432,
      "active": true
    },
    "taproot": {
      "type": "bip9",
      "bip9": {
        "status": "active",
        "start_time": -1,
        "timeout": 9223372036854775807,
        "since": 0,
        "min_activation_height": 0
      },
      "height": 0,
      "active": true
    }
  },
  "warnings": "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"
}

legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
October 30, 2021, 10:30:14 PM
#2
Have you used RegTest before and been using the same data directory since start?
I'm thinking that you might have already too much blocks that the newest's block rewards received by your new wallets' addresses are all zero.
Note: Regtest's halving interval is much faster than mainnet - 150 compared to 210000 (chainparams.cpp)

   "confirmations": 6920,
That's a lot of confirmations, you may be overdoing the block generation, try to start with fresh data directory.
The fastest way is to delete the "regtest" folder inside your bitcoin data dir.
newbie
Activity: 3
Merit: 2
October 30, 2021, 04:26:55 PM
#1
> bitcoind -regtest -daemon
Bitcoin server starting

Start bitcoind in regtest mode to create a private block chain.

## Bitcoin Core 0.10.1 and earlier
bitcoin-cli -regtest setgenerate true 101

## Bitcoin Core 17.1 and earlier
bitcoin-cli -regtest generate 101

## Bitcoin Core 18.0 and later
bitcoin-cli -regtest generatetoaddress 101 $(bitcoin-cli -regtest getnewaddress)



I have 4 wallets that i created in regtest. I load one of them and generate blocks like the developer guide says to but my balance stays 0. I have tried restarting the daemon creating new wallets adding rpcwallet flags etc

as well when i use the command below all utxo's (i think what theyre called lol) have amiunt 0
bitcoin-cli -regtest listunspent
{
    "txid": "73b2dc290280fbddc2015298229430638ddd9b54863969f2cc54a6b4b1fbeffd",
    "vout": 0,
    "address": "bcrt1qujyfn08jlpwcqe0hsmcs327hh73gn7082p24kj",
    "label": "",
    "scriptPubKey": "0014e48899bcf2f85d8065f786f108abd7bfa289f9e7",
    "amount": 0.00000000,
    "confirmations": 6920,
    "spendable": true,
    "solvable": true,
    "desc": "wpkh([fa09decd/0'/0'/6']02c261e771faebb13a82863d965b4478ca04bddac42c8d254500e610b87a9a7a3a)#f4cmxk3u",
    "safe": true
  }


Jump to: