Categories
Bitcoin

Regnet – Don’t blocks get mined every 10 minutes?

How can I enable this option on regtest?

The following content was written by BlackHatCoiner on July 14, 2020, 07:23:46 PM in the thread Regnet – Don’t blocks get mined every 10 minutes?. All content is owned by the author of the bitcointalk.org post. (original)


How can I enable this option on regtest? Right now if I want to mine 10000 blocks, I can do it within a minute. But I want to try being Satoshi. That mined the first blocks with 10 minutes difference on average.

The following content was written by vjudeu on July 14, 2020, 08:57:43 PM in the thread Regnet – Don’t blocks get mined every 10 minutes?. All content is owned by the author of the bitcointalk.org post. (original)


Just mine blocks at higher difficulty. For example you can make sure that first 32 bits are zeroes, then you will get exactly the same as in mainnet in 2009. Also, you can just run mainnet detached from the network and start mining on top of Genesis Block with mainnet difficulty.

The following content was written by BlackHatCoiner on July 14, 2020, 09:13:44 PM in the thread Regnet – Don’t blocks get mined every 10 minutes?. All content is owned by the author of the bitcointalk.org post. (original)


Just mine blocks at higher difficulty. For example you can make sure that first 32 bits are zeroes, then you will get exactly the same as in mainnet in 2009. Also, you can just run mainnet detached from the network and start mining on top of Genesis Block with mainnet difficulty.

And how exactly do I increase difficulty?

The following content was written by jackg on July 14, 2020, 09:19:40 PM in the thread Regnet – Don’t blocks get mined every 10 minutes?. All content is owned by the author of the bitcointalk.org post. (original)


I think you can change the difficulty to be set on 10 minutes per block bere: https://bitcoin.stackexchange.com/questions/84433/mining-difficulty-is-not-changed-on-regtest

(note it’s an average of 10 minutes – you might want to isolate the process to a single thread if you try this as your computer might go slow).

The following content was written by vjudeu on July 15, 2020, 06:08:01 AM in the thread Regnet – Don’t blocks get mined every 10 minutes?. All content is owned by the author of the bitcointalk.org post. (original)


You don’t have to change source code. If running regtest, you can just configure your miner to produce blocks with higher difficulty. If running mainnet detached from the network, you will get it by default, if your wallet is not synchronized and you will start from Genesis Block. So the easiest option is probably just running mainnet and making sure it will be detached from the network.

So, to begin with, you can just:
1) make sure there is no “.bitcoin” or similar directory, so you begin from Genesis Block, it is probably enough to just rename existing dir (if any)
2) run mainnet
3) disable network activity (click icon in bottom right corner)
4) start mining using “generatetoaddress”

The following content was written by BlackHatCoiner on July 15, 2020, 06:34:52 AM in the thread Regnet – Don’t blocks get mined every 10 minutes?. All content is owned by the author of the bitcointalk.org post. (original)


You don’t have to change source code. If running regtest, you can just configure your miner to produce blocks with higher difficulty. If running mainnet detached from the network, you will get it by default, if your wallet is not synchronized and you will start from Genesis Block. So the easiest option is probably just running mainnet and making sure it will be detached from the network.

So, to begin with, you can just:
1) make sure there is no “.bitcoin” or similar directory, so you begin from Genesis Block, it is probably enough to just rename existing dir (if any)
2) run mainnet
3) disable network activity (click icon in bottom right corner)
4) start mining using “generatetoaddress”

When I use that command:
Code:
generatetoaddress 1 “bc1q33hjxx9wfnantaze4xd3j4jnjeq0srhzmp563q”

I get the following error:
Code:
CreateNewBlock: TestBlockValidity failed: bad-fork-prior-to-checkpoint (code 67) (code -1)

The following content was written by vjudeu on July 15, 2020, 07:04:28 AM in the thread Regnet – Don’t blocks get mined every 10 minutes?. All content is owned by the author of the bitcointalk.org post. (original)


You have to use legacy address (starting from one), because segwit is a soft-fork that was activated many, many blocks after the Genesis Block. You wanted to “try being Satoshi” and he used this coin many years before segwit was introduced.

The following content was written by BlackHatCoiner on July 15, 2020, 07:09:36 AM in the thread Regnet – Don’t blocks get mined every 10 minutes?. All content is owned by the author of the bitcointalk.org post. (original)


You have to use legacy address (starting from one), because segwit is a soft-fork that was activated many, many blocks after the Genesis Block. You wanted to “try being Satoshi” and he used this coin many years before segwit was introduced.

Code:
generatetoaddress 1 “3FFEdtxyXkLFHoL8Gn91aXTNrxevraKnEK”

returns:

Code:
CreateNewBlock: TestBlockValidity failed: bad-fork-prior-to-checkpoint (code 67) (code -1)

The following content was written by vjudeu on July 15, 2020, 07:22:57 AM in the thread Regnet – Don’t blocks get mined every 10 minutes?. All content is owned by the author of the bitcointalk.org post. (original)


Ok, I will demonstrate it step-by-step:
Code:
$ getnewaddress “” “legacy”
1Y83rK42gC2KHctMmzkaqB9BgZiyYZYH9
$ dumpprivkey 1Y83rK42gC2KHctMmzkaqB9BgZiyYZYH9
L2rirSQXXu3fy77BPr1gEen1SgoNuKUu89cGvEoysrPaYZyyK67f
$ generatetoaddress 1 “1Y83rK42gC2KHctMmzkaqB9BgZiyYZYH9” 1000000000
[
  “0000000056d13c49bc63b0d4a121496419d74e27a5ea0986611df1dcad787150”
]
$ getblock 0000000056d13c49bc63b0d4a121496419d74e27a5ea0986611df1dcad787150
{
  “hash”: “0000000056d13c49bc63b0d4a121496419d74e27a5ea0986611df1dcad787150”,
  “confirmations”: 1,
  “strippedsize”: 216,
  “size”: 216,
  “weight”: 864,
  “height”: 1,
  “version”: 536870912,
  “versionHex”: “20000000”,
  “merkleroot”: “a2f6aa713a1cf5d7ca6bd97e214e04b65abbac11fe06594de5d32371aaba5685”,
  “tx”: [
    “a2f6aa713a1cf5d7ca6bd97e214e04b65abbac11fe06594de5d32371aaba5685”
  ],
  “time”: 1594797319,
  “mediantime”: 1594797319,
  “nonce”: 5153686,
  “bits”: “1d00ffff”,
  “difficulty”: 1,
  “chainwork”: “0000000000000000000000000000000000000000000000000000000200020002”,
  “nTx”: 1,
  “previousblockhash”: “000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f”
}
$ gettransaction a2f6aa713a1cf5d7ca6bd97e214e04b65abbac11fe06594de5d32371aaba5685
{
  “amount”: 0.00000000,
  “confirmations”: 1,
  “generated”: true,
  “blockhash”: “0000000056d13c49bc63b0d4a121496419d74e27a5ea0986611df1dcad787150”,
  “blockheight”: 1,
  “blockindex”: 0,
  “blocktime”: 1594797319,
  “txid”: “a2f6aa713a1cf5d7ca6bd97e214e04b65abbac11fe06594de5d32371aaba5685”,
  “walletconflicts”: [
  ],
  “time”: 1594797319,
  “timereceived”: 1594797324,
  “bip125-replaceable”: “no”,
  “details”: [
    {
      “address”: “1Y83rK42gC2KHctMmzkaqB9BgZiyYZYH9”,
      “category”: “immature”,
      “amount”: 50.00000000,
      “label”: “”,
      “vout”: 0
    }
  ],
  “hex”: “02000000010000000000000000000000000000000000000000000000000000000000000000ffffffff03510101ffffffff0200f2052a010000001976a91405e2c775de292850af856a685308c5de0f39d3cf88ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf900000000”
}

Edit:
Quote
Code:
generatetoaddress 1 “3FFEdtxyXkLFHoL8Gn91aXTNrxevraKnEK”
It is not legacy address. Legacy address should start with one, not three!

By Ali Sherief

Editor-in-chief and serial coder & blogger.