Following this answer, I'm running

$ geth --dev

to start a testnet, which works as expected, returning INFO [08-01|14:32:29] IPC endpoint opened: /Users/mcansado/Users/Desktop/private/datadir/geth.ipc . When I run

$ geth --dev attach

from another console though, I get back

Fatal: Unable to attach to remote geth: dial unix /Users/mcansado/Library/Ethereum/geth.ipc: connect: no such file or directory

After googling, I found this issue here but the solution doesn't work either. I tried starting geth with

$ geth --datadir ~/Users/Desktop/private/datadir --dev

to go to a file I have in my desktop and then attaching with

$ geth attach --datadir ~/Users/Desktop/private/datadir or

$ geth attach --datadir ~/Users/Desktop/private/datadir/geth.ipc or

$ geth attach --datadir ~/Users/Desktop/private/datadir/geth.ipc or

$ geth attach ipc: ~/Users/Desktop/private/datadir/geth.ipc (as mentioned here)

For the last one, I just get Fatal: Unable to attach to remote geth: dial unix: missing address back.

Nothing works and I'm really running out of ideas. Could anyone please explain what I'm doing wrong?

EDIT: Just including the structure of the directory I'm passing in geth

├── geth
│   ├── LOCK
│   ├── chaindata
│   │   ├── 000027.ldb
│   │   ├── 000028.ldb
│   │   ├── 000031.ldb
│   │   ├── 000032.log
│   │   ├── CURRENT
│   │   ├── LOCK
│   │   ├── LOG
│   │   └── MANIFEST-000033
│   ├── lightchaindata
│   │   ├── 000002.ldb
│   │   ├── 000003.log
│   │   ├── CURRENT
│   │   ├── LOCK
│   │   ├── LOG
│   │   └── MANIFEST-000004
│   ├── nodekey
│   └── nodes
│       ├── 000006.log
│       ├── 000008.ldb
│       ├── CURRENT
│       ├── LOCK
│       ├── LOG
│       └── MANIFEST-000007
├── geth.ipc
├── history
└── keystore
    ├── UTC--2017-07-31T16-52-20.478037541Z--7ca3a0da3345506f15c603eba011c8f354155ee9
    ├── UTC--2017-07-31T18-17-31.814205896Z--f0a63da28af8a8aece135d8c5a268ffc261e2d36
    └── UTC--2017-07-31T21-46-55.452893142Z--1918ced27804f6b83acf0587a81e9f56020620d1

where there is clearly a geth.ipc file.


The answer you are linking to is pretty old, and a lot of things will have changed since then in the ecosystem.

DevMode seems to be very strict. See source code here: https://github.com/ethereum/go-ethereum/blob/master/cmd/utils/flags.go, in particular the following lines:

Starting at line 798:

if ctx.GlobalBool(DevModeFlag.Name) {
    // --dev mode can't use p2p networking.
    cfg.MaxPeers = 0
    cfg.ListenAddr = ":0"
    cfg.DiscoveryV5Addr = ":0"
    cfg.NoDiscovery = true
    cfg.DiscoveryV5 = false

At line 816:

switch {
    case ctx.GlobalIsSet(DataDirFlag.Name):
        cfg.DataDir = ctx.GlobalString(DataDirFlag.Name)
    case ctx.GlobalBool(DevModeFlag.Name):
        cfg.DataDir = filepath.Join(os.TempDir(), "ethereum_dev_mode")
    case ctx.GlobalBool(TestnetFlag.Name):
        cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet")
    case ctx.GlobalBool(RinkebyFlag.Name):
        cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby")

At line 991:

case ctx.GlobalBool(DevModeFlag.Name):
    cfg.Genesis = core.DevGenesisBlock()

Based on my reading of that source code, your attempts to set a datadir would all have been overridden. Also I don't fully understand the purpose of not allowing any peers, etc, but it seems that DevMode is pretty restrictive in its networking and is geared towards geth developers, not towards developers who want to build Dapps using geth.

For your purposes, you might find something like this to be more straightforward (apologies for pimping a post of mine): https://alanbuxton.wordpress.com/2017/07/19/first-steps-with-ethereum-private-networks-and-smart-contracts-on-ubuntu-16-04/

  • Thanks very much for the explanation, worked perfectly! They're so many articles still online which refer to old stuff that is sometimes hard to filter out what's still relevant and what's not. Your article works perfectly.
    – mcansado
    Aug 2 '17 at 8:01
  • 1
    Glad you found it useful. Seems like keeping the docs up to date is a pretty low priority at the moment. Aug 2 '17 at 8:49

Try to use the following command to enter the console

$ geth attach ipc://Users/Desktop/private/datadir/geth.ipc

  • it is better to make a search for the ipc instead using a predefined path then attach it
    – Badr Bellaj
    Aug 7 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.