0

I am trying to create a new bitcoin address and store it in a shell variable $NEW_ADDRESS.

When I run this command:

$NEW_ADDRESS=$(./bitcoin-cli getnewaddress)

I get the following errors:

error: Could not connect to the server 127.0.0.1:8332
Make sure the bitcoind server is running and that you are connecting to the correct RPC port.
-bash: =: command not found

I have tried everything to fix the connection error, including typing the command:

./bitcoind -rpcport=8332

Or even, changing the bitcoin config:

nano ~/.bitcoin/bitcoin.conf

And typing these lines on the configuration:

rpcconnect=127.0.0.1
rpcport=8332;

But nothing works. Does anyone have an idea on how to troubleshoot and fix this?

Thanks in advance.

  • try ps aux | grep bitcoind is the process running? – JBaczuk Feb 26 at 17:43
0

-bash: =: command not found

Leave out the initial dollar symbol when you assign the variable:

NEW_ADDRESS=$(./bitcoin-cli getnewaddress)

Use the dollar symbol when you use the variable:

echo $NEW_ADDRESS

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.