首页 > 解决方案 > Geth --dev --datadir 不创建数据库

问题描述

在阅读https://geth.ethereum.org/docs/getting-started/dev-mode上的文档时, 它指出正在运行

geth --http --dev --datadir MyChain

意志等

- 使用测试创世块初始化数据目录

但是在运行命令时,我得到以下输出

C:\bcbootcamp>geth --http --dev --datadir MyChain
INFO [04-14|00:28:40.461] Starting Geth in ephemeral dev mode...
INFO [04-14|00:28:40.537] Maximum peer count                       ETH=50 LES=0 total=50
INFO [04-14|00:28:40.545] Set global gas cap                       cap=25000000
INFO [04-14|00:28:43.722] Using developer account                  address=0x953d79A4681068A8ab07De93b8EaE5dAedd81a7C
INFO [04-14|00:28:43.728] Allocated cache and file handles         database=C:\bcbootcamp\MyChain\geth\chaindata cache=512.00MiB handles=8192 readonly=true
Fatal: Could not open database: CreateFile C:\bcbootcamp\MyChain\geth\chaindata: The system cannot find the file specified.

测试表明,当

geth init MyChain\genesis.json --datadir MyChain

预先运行 geth --dev 运行没有问题

有没有办法像文档中描述的那样一起使用--dev和--datadir,当geth在datadir中找不到一个新数据库时,它会创建一个新数据库

Geth
Version: 1.10.2-stable
Git Commit: 97d11b0187b4695ccf44e3b71b54155fe405a36f
Git Commit Date: 20210408
Architecture: amd64
Go Version: go1.16
Operating System: windows
GOPATH=
GOROOT=go

标签: ethereumgo-ethereum

解决方案


推荐阅读