I'm using Bitcoin Core v25.0.0 on Windows 11. My setup:
- Processor: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
- RAM: 16.0 GB
- External storage: Toshiba 1 TB drive
Here's my issue:
I'm trying to use the CLI with Bitcoin Core to start and stop the software. I've been checking out the guide on the official site for Windows 10, but I'm struggling a bit with the Windows command prompt.
For instance, when I try to stop Bitcoin Core with this command:
C:\Program Files\Bitcoin\daemon\bitcoin-cli stop
I end up getting an error saying "'C:\Program' is not recognized as an internal or external command..."
I thought maybe I needed to change the directory, so I typed "cd C:\Program Files\Bitcoin\daemon\" and then tried again with "bitcoin-cli stop". But then I got this message: "error: Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set. See -rpcpassword and -stdinrpcpass. Configuration file: (C:\Users\john\AppData\Roaming\Bitcoin\bitcoin.conf)"
The problem is, I know my config file isn't in C:\Users\john\AppData\Roaming\Bitcoin\. That whole folder doesn't exist because I have all my data stored on an external drive.
I'm pretty lost on what to do next to get Bitcoin Core CLI working.
Need help with Bitcoin Core CLI commands
19 replies 222 views
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#2May 29, 2020, 03:20 AM
In your example, you've indicated the absolute path but it has a whitespace so command prompt took "C:\Program" (before the whitespace) as command.
In that case, enclose the absolute path with quotation marks;
For example, the correct command should be: "C:\Program Files\Bitcoin\daemon\bitcoin-cli" stop
But I recommend you to always use 'change directory' so that you can use bitcoin-cli without specifying the absolute path in every command.
If you've set the data directory in the Welcome Screen, then the 'bitcoin' folder in the default directory wont be created and wont be used.
You should instead create the bitcoin.conf file inside your custom data directory.
Create a "bitcoin.conf" file inside your custom data directory and write server=1 on it.
Restart Bitcoin Core, then try using bitcoin-cli commands again.
Take note that it should be "bitcoin.conf" not "bitcoin.conf.txt" so enable Window Explorer's "View->File name extensions" to see its actual extension.
humbleledgerLegendary
Posts: 1027 · Reputation: 6554
#3May 29, 2020, 05:30 AM
Allow me to quote from your other topic:
Somehow I get the feeling you're making it unnecessarily difficult on yourself. If you're using a Windows computer, and that's me assuming you use a desktop, why would you want to use the CLI? I get it if you'd use a server, but that doesn't sound very likely considering you're using an external hard drive.
Just start Bitcoin Core, and keep it on
I have already created a bitcoin.conf file using Bitcoin Core GUI on my external HD following the instructions from https://sparrowwallet.com/docs/connect-node.html
server=1
rpcuser=bitcoin
rpcpassword=yourpassword
[main]
rpcbind=127.0.0.1
rpcbind=192.168.0.10
rpcallowip=127.0.0.1
rpcallowip=192.168.0.0/16
I just don't know why it tries to find it in C:\Users\john\AppData\Roaming\Bitcoin\bitcoin.conf
From my other post, I was having trouble with shutting down Bitcoin Core all the way. In order to make sure that it was shut down, it was suggested to me to use CLI to make certain. So I am trying to learn how to do so I can start learning to fix my own problems.
Also, I use the same computer to run other labor intensive programs and I need to stop Bitcoin Core in order for things to run more smoothly. Once, I have an upgraded computer, then I might be able to keep it running all the time.
But you are right, I do try to make things more difficult than they should lol.
humbleledgerLegendary
Posts: 1027 · Reputation: 6554
#5May 29, 2020, 08:08 AM
The CLI isn't going to help you if it's caused by a power problem on the drive.
During the initial block download, I get that. But once it's synced, Bitcoin Core takes at most a few CPU seconds every 10 minutes (on average). The only real reason I see to stop it, is if you need the RAM for something else.
It is the most fun way that way
You're right, I misspoke. What happens is I lose internet connection because of my internet browser, usually from a website that is too much. I don't know if it is a wifi signal thing or if my network adapter needs to be replaced, but I guess that is the next problem I need to tackle. probably for another website forum though. idk
thanks for bringing that to my attention
humbleledgerLegendary
Posts: 1027 · Reputation: 6554
#7May 29, 2020, 12:10 PM
Easy fix: get a cable, it beats Wifi any time.
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#8May 29, 2020, 11:54 PM
During that time, are you using the GUI or bitcoind?
Because the latter wont use the GUI's setting and will use the default data directory's config file by default.
Anyways, since you've included those in your config, try adding --rpcuser=bitcoin and --rpcpassword=yourpassword in your command
since there seem to be a problem in the cookie file which should've been created automatically.
I have recently connected a ethernet cable, but I now have a ethernet wire though my hallways..... I should run cable through the entire house one of these weekends soon... should have done this over the winter when it wasn't so hot in the attic.
I used GUI to access and edit the config file and the command was me trying to control the GUI through Windows PowerShell.
Although I have deleted everything on my external. Everything started to mess up and I became frustrated and reformatted the external hd so i could return it. figured that the files were corrupted anyways... at least that was my thinking atm I was frustrated.
I will have a new ssd soon and after the setting everything back up and redownloading the blockchain, I will post brand new ways that I screw everything up
shard_degenFull Member
Posts: 68 · Reputation: 298
#10May 31, 2020, 11:34 AM
Just a small input. I'm not sure I understood it all correctly but you just said your attic is hot as f... My advice is in that case, don't put your nodes there (Bitcoin or LN), mainly if you're using SBCs like Raspberry or other similar devices. When they are verifying the blockchain, they can heat up a bit and cause some problems!
I don't plan to put any node in the attic. I was talking about running ethernet cables through my attic to the different rooms in the house and how hot it will be to do that now during the summer months. Really, I guess it would be best to do it now before it is the absolute hottest days or I will have months of ethernet cables laying in my hallways.
seed_vaultFull Member
Posts: 71 · Reputation: 451
#12May 31, 2020, 10:08 PM
Since you're issuing the CLI commands as a different user than the "user" (system) running the process, it'll look for the credentials of the user in the user's home directory. The same thing happens on Linux, it's not just a Windows thing. On my Linux servers I run the bitdoind process using a system user with no home directory, password, or the ability to log into the system. Safer that way.
Also, it could be that your bitcoin daemon isn't reading any configuration settings, it's just running on defaults. When starting bitcoind, did you include any command line options? Did you specify a configuration file?
When running a daemon it's more practical to have two configuration files, one for the daemon to start all the services you want the daemon to run, and another in your home path that specifies the user's preferred settings, like wallet location and whatnot. To me it sounds like the daemon isn't configured with rpcauth.
A practical way to set the authorization string it by using rpcauth.py, you can find it in the bitcoin master tree under share/rpcauth/.
So, if you were to use the example in the image above, you would add the following string to the daemon's bitcoin.conf file:
And in the user's bitcoin.conf file you would add:
OK, since its a Windows PC and you're not planning to expose your JSON-RPC interface across the network - which would open a new can of worms with the Firewall program - you actually don't need to pass any RPC user/password options at all to the daemon or CLI, because by default, bitcoind creates a cookie file with a temporary username and password, which is automatically found by bitcoin-cli before it talks to the daemon. Which means you can simply run bitcoin-cli stop without any additional arguments or configuration.
shard_degenFull Member
Posts: 68 · Reputation: 298
#14Jun 1, 2020, 01:09 AM
Oh ok. In that case only make sure there are no hungry mice or other rodents that may affect your cables and all of a suden you find you node offline without having a clue of what is going on!
Hello,
I have a weird issue with my configuration. I tried many things and nothing really works well.
For now if the following can works it could be good.
Context : I've got MacOS last version and my hard drive 1Tb connected. I'm running everything from the path '/Volumes/Crucial X8/bitcoin/Bitcoin'.
Objectives : Run my node is testnet and in mainnet with different configs properly with `bitcoind`. Everything related to the node should be into the hard drive (obviously, I don't have enough space on my computer haha).
Config file :
# Listen for connections on this port (default: 8333):
port=8332
# Network-related settings:
# Bind to given address and whitelist peers connecting to it:
bind=127.0.0.1
# JSON-RPC options:
# Server for JSON-RPC connections (default: 127.0.0.1)
#rpcbind=127.0.0.1
# Username for JSON-RPC connections
#rpcuser=rpc_bitcoin
# Password for JSON-RPC connections
#rpcpassword=rpc_bitcoin
# Miscellaneous options:
# Size of the "memory pool" for transactions awaiting confirmation (default: 300MB)
#maxmempool=300
# File containing masternodes IPs and rewards private key
#masternode=
# Reduce storage requirements by only storing most recent N blocks (default: 288)
#prune=550
[main]
datadir=/Volumes/Crucial\ X8/bitcoin/Bitcoin
blocksdir=/Volumes/Crucial\ X8/bitcoin/Bitcoin/blocks
walletdir=/Volumes/Crucial\ X8/bitcoin/Bitcoin/wallets/main
conf=bitcoin.conf
spendzeroconfchange=1
txindex=1
rpcworkqueue=128
settings=/Volumes/Crucial\ X8/bitcoin/Bitcoin/settings.json
[test]
testnet=1
datadir=/Volumes/Crucial\ X8/bitcoin/Bitcoin/testnet3
blocksdir=/Volumes/Crucial\ X8/bitcoin/Bitcoin/blocks
walletdir=/Volumes/Crucial\ X8/bitcoin/Bitcoin/wallets/test
addnode=testnet.blixtwallet.com
settings=/Volumes/Crucial\ X8/bitcoin/Bitcoin/testnet3/settings.json
Folder structure :
| - bitcoin.conf
|
| bin -- bitcoind
|
| blocks -- | blocks
-- | index
-- | tesnet3 -- blocks
|
| indexes -- | txindex
|
| wallets -- | main -- MyMainWallets
-- | test -- MyTestsWallets
|
| testnet3 -- bitcoin.conf (for some tests but bitcoind couldn't read it. I don't know why cause all rights are openned)
-- | bin -- bitcoind and others
-- | blocks -- *.dat
-- | index -- *.log
-- | wallets -- MyTestsWallets
-- | indexes -- | txindex
Command run :
- For mainnet : ./bin/bitcoind -conf=bitcoin.conf -txindex=1. With this command the problem now is : Using wallet directory /Volumes/Crucial X8/bitcoin/Bitcoin/wallets which should be with wallets/main for mainnet.
- For testnet : The same with the flag -testnet. And here I got the error : Error: Config setting for -walletdir only applied on test network when in [test] section. But as we can see in config file it's well setup for each network. And the fact that mainnet doesn't read properly the wallet dir path seems to show a problem.
I don't know how can I solve this misleading configuration. I tried to do everything in testnet3 folder, but I already built a part of the testnet in the main folder. So I'm wondering if it's possible to make work my configuration.
Maybe you can have some ideas. I don't know.
I can move it if it's not in the right place ^^
Also, when I'm trying to run bitcoind from the fodler testnet3 with :
./bin/bitcoind -conf=bitcoin.conf -walletdir=/Volumes/Crucial\ X8/bitcoin/Bitcoin/testnet3/wallets -txindex=1 -testnet
I have this in the launch :
2023-12-21T16:07:06Z Config file: /Volumes/Crucial X8/bitcoin/Bitcoin/bitcoin.conf
2023-12-21T16:07:06Z Config file arg: blocksdir="/Volumes/Crucial X8/bitcoin/Bitcoin/blocks"
2023-12-21T16:07:06Z Config file arg: conf="/Volumes/Crucial X8/bitcoin/Bitcoin/bitcoin.conf"
2023-12-21T16:07:06Z Config file arg: datadir="/Volumes/Crucial X8/bitcoin/Bitcoin"
2023-12-21T16:07:06Z Config file arg: settings="/Volumes/Crucial X8/bitcoin/Bitcoin/settings.json"
2023-12-21T16:07:06Z Config file arg: walletdir="/Volumes/Crucial X8/bitcoin/Bitcoin/wallets"
Which is not what is specified in the bitcoin.conf file into testnet3 :
[test]
conf=/Volumes/Crucial\ X8/bitcoin/Bitcoin/testnet3/bitcoin.conf
datadir=/Volumes/Crucial\ X8/bitcoin/Bitcoin/testnet3
blocksdir=/Volumes/Crucial\ X8/bitcoin/Bitcoin/testnet3/blocks
walletdir=/Volumes/Crucial\ X8/bitcoin/Bitcoin/testnet3/wallets
addnode=testnet.blixtwallet.com
settings=/Volumes/Crucial\ X8/bitcoin/Bitcoin/testnet3/settings.json
I don't understand why the node is not syncing on the right conf file...
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#17Jun 1, 2020, 10:01 AM
The "Config file arg" lines for testnet should be listed as "Config file arg: [test]" instead.
Those are most likely for your mainnet configurations set somewhere else which will show regardless of the chain you indicated in the command line.
Since your bitcoin.conf file isn't in the default data directory, specify its absolute path in --conf command line option.
The absolute path doesn't work with error :
./bin/bitcoind -conf=/Volumes/Crucial\ X8/bitcoin/Bitcoin/testnet3/bitcoin.conf -walletdir=/Volumes/Crucial\ X8/bitcoin/Bitcoin/testnet3/wallets -txindex=1 -testnet
Assertion failed: (base.is_absolute()), function AbsPathJoin, file fs.cpp, line 37.
[1] 28624 abort ./bin/bitcoind -txindex=1 -testnet
A problem is also that in my main config we can see that I set /Volumes/Crucial\ X8/bitcoin/Bitcoin/wallets/main as walletdir path but when I run bitcoind, it's still set with walletdir : /Volumes/Crucial\ X8/bitcoin/Bitcoin/wallets and so it doesn't find any wallet.
Ok ! With command line args it works.
But it could be cooler to just have the config file to setup and not re write a long cli args to put each time.
So, it's not necessary but cool for the next ^^
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#20Jun 3, 2020, 07:52 AM
In that case, you should put your bitcoin.conf file inside bitcoin's default data directory, put the datadir for mainnet and testnet in that file and remove the conf files from the separate custom datadirs.
In MacOS, it should be in: ~/Library/Application Support/Bitcoin/bitcoin.conf
That way, bitcoind will automatically load it without needing you to specify the paths. (the GUI will still use the one set in the Welcome Screen though)
Or set the --datadir in the command line arg for testnet and mainnet and remove the --conf and --walletdir args.
Then put a bitcoin.conf file for testnet (still with [test]) and mainnet in those separate datadirs.
In both cases, you do not need to set blocksdir, walletsdir, settings lines in your bitcoin.conf file or command line.
Because those aren't necessary if you intended to save the settings.json, blocks folder, wallets folder inside the custom datadir which is already done by default.
Also, you may consider fixing the paths in testnet (if it's not intentional) because-
in testnet, it'll automatically create "testnet3" directory in the specified 'blocksdir' and 'datadir'.
For example:
These configurations will result with this folder structure:
Folder where the datadir will be saved: "......./Bitcoin/testnet3/testnet3"
Folder where the blk and rev files will be stored: "......./Bitcoin/testnet3/blocks/testnet3/blocks"
If the intention is to save the block in the testnet3 directory and the datadir is set, you can remove it from the config/args.
Lastly, if the datadir is to be set in "......./Bitcoin/testnet3", the datadir for testnet should be: datadir=/Volumes/Crucial\ X8/bitcoin/Bitcoin
?Reply
Sign in to reply to this topic
Related topics
- Bitcoin Core displaying coins (UTXOs) in a new tab 13
- Ways to earn some sats by contributing to bitcoin core development 5
- Need Help! Funds Gone / Wrong Address 10
- What can I do to fix this Bitcoin Core error? 8
- How do you protect your Bitcoin Core wallet? 19
- issues with bitcoin core database read error 2