“geth attach” command shows error: Fatal: Unable to attach to remote geth

0 votes

I am trying to run get attach to attach to another node running on my system. But when I run it, I am getting the following error:

Fatal: Unable to attach to remote geth: dial unix /home/user/.ethereum/geth.ipc: connect: no such file or directory

Jan 16, 2019 in Blockchain by slayer
• 29,300 points
925 views

1 answer to this question.

0 votes

Seems like the geth.ipc file is not present in the path mentioned in your command. 

If you have initialized the genesis block correctly then you should have the file in ./data directory. Anyways you can find it like this:

locate geth.ipc

It will show the location and then use that location

geth attach ipc:/<path to file>/geth.ipc console
answered Jan 16, 2019 by Omkar
• 69,030 points
I am not getting the location by using the above command.
I am not getting any output for locate Geth

Hello @ I am Kunal Kishore,

The geth.ipc file is located in your datadir. Your datadir is where you specified in starting your private net using geth command. For example,

geth --datadir ./privatechain

The geth.ipc will be located in ./privatechain/geth.ipc.

Hope it is helpfull!!

Thank You!!

Hello,

//I am not getting any output for locate Geth

While running in geth console, you can use the web3 library to get block information:

> var blockNumber;

undefined
> var blockInfo;

undefined

> web3.eth.getBlockNumber(function(e, r) { blockNumber = r; });

undefined
> blockNumber;

2515149
> web3.eth.getBlock(blockNumber, function(e, r) { blockInfo = r; });

undefined
> blockInfo

{   difficulty: 1319089762,    extraData: "0xd58301070d8650617269747986312e32332e30826c69",    gasLimit: 4700036,  gasUsed: 0,    hash: "0xf9c495b5e5bcd3935aa4a6fd5a43009de29ca7d7be77d4b7cc4c68b8704bc422",  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", miner: "0x94cd009bbba97f30a36845e2025edf7544d62439",    mixHash: "0xb8794a6d1b777f8c6fdf509f04896642f67dab82dc872ae9cbe9bcbf85172972",  nonce: "0x264c013815697c2f",    number: 2515149,    parentHash: "0x0d2b4185aec34d8963b4c0b8fa7abb8604e1452bcb7f7f7d7a75a3d1cfd85f92",  receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",  size: 537,    stateRoot: "0xc3810c2e763669a6e0219c78990c92b91c634d23810f4bd67144c4d76b9cfe6e",  timestamp: 1516811780,    totalDifficulty: 7642933628775356,    transactions: [],    transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",  uncles: []  }

Here is the example transaction info retreival:

> web3.eth.getTransaction('0xaebaf7e8207c417f6bb7920f3820e5220738d6825b6f577e3c3d0736d3c95b49', function(e, r) { if (e) console.log(e); else res = r; });

undefined
> res

{   blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",  blockNumber: null,   from: "0x0a78c28257b40d5076ea180bc6a9e4c597c5ea98",   gas: 90000,   gasPrice: 40000000000,   hash: "0xaebaf7e8207c417f6bb7920f3820e5220738d6825b6f577e3c3d0736d3c95b49",  input: "0x",   nonce: 32,   r: "0x902f7a7b7c3e4ebcab47014f9c3b81858cdc4b90ef36d9630adaf30b47ec370f",  s: "0x6f09e7d66dc2146afa108322f433c12b629eadd149e1e113669b6bd2e0cd467e",  to: "0xb8ac544e818d01a9533c9556d572d8366b91d6c1",   transactionIndex: 0,   v: "0x2a",   value: 200000 }

Hope it helps!!

Thank you!!

Related Questions In Blockchain

0 votes
1 answer

geth attach command showing error: bind: address already in use

Seems like there is already a geth instance ...READ MORE

answered Jan 16, 2019 in Blockchain by Omkar
• 69,030 points
944 views
+1 vote
5 answers

How to solve "truffle: command not found" error in blockchain?

First try restarting the system and then ...READ MORE

answered Jul 16, 2018 in Blockchain by slayer
• 29,300 points
2,919 views
0 votes
1 answer

'Invalid sender' error after upgrading to geth 1.4.0

Guessing that the JSON RPC stuff changed ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,810 points
163 views
0 votes
1 answer

Unboxing truffle: Shows error: Stopping to prevent overwriting data.

As mentioned in the error: unboxing or ...READ MORE

answered Nov 30, 2018 in Blockchain by Omkar
• 69,030 points
359 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,810 points
379 views
0 votes
1 answer
0 votes
0 answers

Error: Unexpected token o in JSON at position 1

I have been working with Interacting a ...READ MORE

Mar 6, 2019 in Blockchain by saeedi
• 120 points

edited Mar 6, 2019 by Omkar 1,087 views
0 votes
1 answer

Not able to attach geth.ipc: Fatal: Unable to attach to remote geth: connect: connection refused

You should not mention double quotes for ...READ MORE

answered Dec 6, 2018 in Blockchain by Omkar
• 69,030 points
966 views
–1 vote
1 answer

geth attach Fatal: Unable to attach to remote geth: no known transport for URL scheme "c"

Seems like geth.ipc path is not set. When ...READ MORE

answered Jan 16, 2019 in Blockchain by Omkar
• 69,030 points
369 views