2

I'm new here. I met some problem when I use signet on bitcoin core in docker container. I used this command to work out the nbits value to set the average mining time which is 60s.

python3.8 miner --cli="bitcoin-cli" calibrate --grind-cmd="bitcoin-util grind" --seconds=60

But then I use this command to mine blocks, the average mining time is not what I set.

python3.8 miner --cli=”bitcoin-cli -datadir=/data/bitcoin/signet-custom” generate --address=$Address --grind-cmd=”bitcoin-util grind” --nbits=1d30783d --ongoing

I got this:

2022-07-11 18:09:20 INFO Mined block at height 25; next in 4m31s (mine)
2022-07-11 18:13:56 INFO Mined block at height 26; next in 2m40s (mine)
2022-07-11 18:16:37 INFO Mined block at height 27; next in 2m44s (mine)
2022-07-11 18:16:37 INFO Mined block at height 27; next in 2m44s (mine)
2022-07-11 18:19:26 INFO Mined block at height 28; next in 2m40s (mine)
2022-07-11 18:22:08 INFO Mined block at height 29; next in 2m43s (mine)
2022-07-11 18:24:52 INFO Mined block at height 30; next in 2m44s (mine)
2022-07-11 18:27:43 INFO Mined block at height 31; next in 2m38s (mine)
2022-07-11 18:30:22 INFO Mined block at height 32; next in 2m44s (mine)
2022-07-11 18:33:07 INFO Mined block at height 33; next in 2m44s (mine)
2022-07-11 18:35:54 INFO Mined block at height 34; next in 2m42s (mine)
2022-07-11 18:38:41 INFO Mined block at height 35; next in 2m40s (mine)
2022-07-11 18:41:25 INFO Mined block at height 36; next in 2m41s (mine)
2022-07-11 18:44:10 INFO Mined block at height 37; next in 2m41s (mine)
2022-07-11 18:46:53 INFO Mined block at height 38; next in 2m43s (mine)

I'm very confused. Maybe this question is stupid, but I will appreciate it if anybody can help me.

By the way, I wonder if I can use RPC command to control my signet remotely. Thanks a lot!

Harry
  • 31
  • 2
  • 1
    no question is stupid, but for the vision impaired, when text output is screenshot instead of pasted :) – Mercedes Jul 11 '22 at 10:44
  • @Mercedes Sorry for that, I have changed it ^^ – Harry Jul 11 '22 at 10:59
  • I second this, I also noticed the same issue and not found a satisfactory explanation. I played a little with the `miner` python script and I suspect the calibration is broken in some way, but have not been able to determine exactly in what way yet. – Sosthène Aug 03 '22 at 16:13

1 Answers1

2

I spent some time figuring out what's going on in the miner script, and here's what I think I have understood so far:

  • on a signet network difficulty adjustement is similar to what it is on mainnet, ie. there's a difficulty adjustment every 2016 blocks and it can only go at most 4 times each way (either divide difficulty by 4 or multiply by 4
  • when you use the signet calibration script, you try to figure out what the target (expressed in nbits) should be on your node if you were to generate a block every n seconds instead of the standard mainnet 600s.
  • When you start your node for the first time, the mining script make sure that you mine at most 4 times faster than the expected 10m (which is 2m30s). Even if you target a much faster interval (say, 1m), it wouldn't help to mine faster than that since the bitcoin client wouldn't divide difficulty by more than 4 at the end of the 2016 blocks of the difficulty adjustment period.
  • After enough difficulty adjustment, you should start to mine at the expected rate

I find it really confusing and convoluted so far, and the available documentation probably needs an update to explain that in more details. Maybe I'm missing something but if the goal is to tweak the block interval away from the canonical 10min it feels a bit off and unnecessary. Obviously I would be happy to be proven wrong by someone that really understands signet and why it was made this way.

I still need more time to figure it out completely and will update this answer if necessary.

Sosthène
  • 613
  • 3
  • 13
  • Thank you for your detailed answer, and sorry for noticing your answer so late. I already give up using this signet mode for my experiment. Thank you again! – Harry Sep 10 '22 at 05:59
  • My turn to make an update: it turned out that we are very likely mistaken about this feature, and that as far as I can tell it is not possible to tweak the block interval on a custom signet. After a while difficulty will go up and eventually you'll be back at 10 min interval, or if you were too aggressive while calibrating difficulty will eventually become too high and you will mine a lot more slowly (at least that's what happened in my experiment). tl;dr: you can't alter the rate at which blocks are produced. The calibration feature serves another (unclear) purpose. – Sosthène Sep 13 '22 at 14:35