Why miner.start Returns Null in Geth Dev Mode and How to Fix It
This article explains that the null return from miner.start in Geth’s dev mode is caused by a new --dev.period parameter introduced in recent versions, and shows how adding --dev.period 1 resolves the issue, allowing continuous block mining.
Earlier versions of Geth in --dev mode started mining automatically when miner.start() was called. After a Geth update the call returns null and mining only occurs after a transaction is submitted.
Background
In developer mode Geth creates an ephemeral proof‑of‑authority network with a pre‑funded account. The original workflow was:
geth --dev
miner.start()and blocks were produced continuously.
Cause
Starting with recent Geth releases a new flag --dev.period was added. Its definition is:
--dev.period <seconds> Block period in developer mode (0 = mine only when a transaction is pending) (default: 0)The default value 0 disables automatic mining, so miner.start() appears to do nothing and returns null.
Solution
Launch the node with the original --dev flag.
Add a non‑zero period, e.g. --dev.period 1 (any positive integer works).
Restart the node and invoke miner.start() again.
Example command: geth --dev --dev.period 1 After the restart the node mines continuously; the block number increases in the logs and via eth.blockNumber regardless of the return value of miner.start().
Notes
The --dev.period value must be greater than zero; setting it to 0 reproduces the issue.
This flag is documented in the Geth command‑line reference but is often overlooked in community solutions.
Conclusion
Adjusting --dev.period to a non‑zero value restores the expected mining behavior in Geth’s developer mode.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Senior Brother's Insights
A public account focused on workplace, career growth, team management, and self-improvement. The author is the writer of books including 'SpringBoot Technology Insider' and 'Drools 8 Rule Engine: Core Technology and Practice'.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
