Ethereum Geth无法连接到专用网络

Ethereum Geth无法连接到专用网络,ethereum,go-ethereum,private-network,geth,ether,Ethereum,Go Ethereum,Private Network,Geth,Ether,我正在创建一个专用网络(以太坊)。我编写了genesis.json文件(下面的代码),然后对其进行了初始化,没有错误,但是当我尝试连接到它时,会创建一个新行(意味着应该指定一个额外的命令)。当我按enter键时,geth只是连接到主网络。如何让geth连接到专用网络 注意:您可以立即告诉geth连接到主网络,因为我的链的ID是15,它显示到1的连接 genesis.json: { "difficulty" : "0x20000", "extraData" : "", "gasLim

我正在创建一个专用网络(以太坊)。我编写了genesis.json文件(下面的代码),然后对其进行了初始化,没有错误,但是当我尝试连接到它时,会创建一个新行(意味着应该指定一个额外的命令)。当我按enter键时,geth只是连接到主网络。如何让geth连接到专用网络

注意:您可以立即告诉geth连接到主网络,因为我的链的ID是15,它显示到1的连接

genesis.json:

{
  "difficulty" : "0x20000",
  "extraData"  : "",
  "gasLimit"   : "0x8000000",
  "alloc": {},
  "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    }
}
命令行:

Ryan-Cocuzzos-Laptop:BlockDev Ryan$ geth init ./genesis.json --datadir mychaindata
WARN [01-05|12:12:00] No etherbase set and no accounts found as default 
INFO [01-05|12:12:00] Allocated cache and file handles         database=/Users/Ryan/Desktop/BlockDev/mychaindata/geth/chaindata cache=16 handles=16
INFO [01-05|12:12:00] Writing custom genesis block 
INFO [01-05|12:12:00] Successfully wrote genesis state         database=chaindata                                               hash=0613eb…9a64e7
INFO [01-05|12:12:00] Allocated cache and file handles         database=/Users/Ryan/Desktop/BlockDev/mychaindata/geth/lightchaindata cache=16 handles=16
INFO [01-05|12:12:00] Writing custom genesis block 
INFO [01-05|12:12:00] Successfully wrote genesis state         database=lightchaindata                                               hash=0613eb…9a64e7
Ryan-Cocuzzos-Laptop:BlockDev Ryan$ geth --datadir .\mychaindata\
> 
WARN [01-05|12:13:37] No etherbase set and no accounts found as default 
INFO [01-05|12:13:37] Starting peer-to-peer node               instance=Geth/v1.7.3-stable/darwin-amd64/go1.9.2
INFO [01-05|12:13:37] Allocated cache and file handles         database=/Users/Ryan/Desktop/BlockDev/.mychaindata/geth/chaindata cache=128 handles=1024
INFO [01-05|12:13:37] Writing default main-net genesis block 
INFO [01-05|12:13:37] Initialised chain configuration          config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Engine: ethash}"
INFO [01-05|12:13:37] Disk storage enabled for ethash caches   dir=/Users/Ryan/Desktop/BlockDev/.mychaindata/geth/ethash count=3
INFO [01-05|12:13:37] Disk storage enabled for ethash DAGs     dir=/Users/Ryan/.ethash                                   count=2
INFO [01-05|12:13:37] Initialising Ethereum protocol           versions="[63 62]" network=1
INFO [01-05|12:13:37] Loaded most recent local header          number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [01-05|12:13:37] Loaded most recent local full block      number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [01-05|12:13:37] Loaded most recent local fast block      number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [01-05|12:13:37] Regenerated local transaction journal    transactions=0 accounts=0
INFO [01-05|12:13:37] Starting P2P networking 
其他信息: 我在管理MacOS Sierra(10.12.3) 我正在使用终端(2.7.1)

启动
geth
时您缺少
--networkid

geth--网络ID 15--datadir mychaindata

缺少
--networkid
和其他导入参数,如端口等。 使用下面的命令连接到您的网络

geth --networkid 15 --datadir .\mychaindata
geth
的其他参数如下

geth --networkid <chainId> 
     --mine 
     --datadir <datadir> 
     --nodiscover 
     --rpc --rpcport "8545" 
     --port "30303" 
     --rpccorsdomain "*" 
     --nat "any" 
     --rpcapi eth,web3,personal,net 
     --unlock 0 
     --password <password file> 
     --ipcpath <path to .ipc file>
geth--networkid
--地雷
--数据目录
--点头
--rpc--rpcport“8545”
--端口“30303”
--rpccorsdomain“*”
--“任何”
--rpcapi eth、web3、个人、网络
--解锁0
--密码
--ipcpath