How to configure bitcoin-core and start it from the console?
I need to configure port forwarding, perhaps?
Forwarding port 8333
To have a fully functional Bitcoin node, you need to forward incoming connections on port 8333 to the device running Bitcoin core.
We first assign a static local IP to our bitcoin core host, e.g., 192.168.1.201, then we create a forwarding rule to that host for all incoming connections on port 8333.
I use pfSense, and this is my config for a static IP. Consult online to accomplish this on your router.
Where is the conf
file for bitcoin-core
? The wiki says to check:
/home/username/.bitcoin/bitcoin.conf
But I see:
nicholas@mordor:~$
nicholas@mordor:~$ tree snap/bitcoin-core/
snap/bitcoin-core/
├── 81
├── common
└── current -> 81
3 directories, 0 files
nicholas@mordor:~$
nicholas@mordor:~$ snap info bitcoin-core
name: bitcoin-core
summary: peer-to-peer network based digital currency
publisher: Bitcoin Core
store-url: https://snapcraft.io/bitcoin-core
contact: https://github.com/bitcoin-core/packaging/issues/new?title=snap:
license: unset
description: |
Bitcoin is a free open source peer-to-peer electronic cash system that
is completely decentralized, without the need for a central server or
trusted parties. Users hold the crypto keys to their own money and
transact directly with each other, with the help of a P2P network to
check for double-spending.
commands:
- bitcoin-core.cli
- bitcoin-core.daemon
- bitcoin-core.qt
snap-id: lGr3hNoqLtHTp2yV1BgnqyElQtLUDPeA
tracking: latest/stable
refresh-date: today at 00:40 PST
channels:
latest/stable: 0.20.1 2020-08-31 (81) 105MB -
latest/candidate: ↑
latest/beta: ↑
latest/edge: 0.20.1 2020-08-31 (81) 105MB -
0.20/stable: 0.20.1 2020-08-02 (75) 105MB -
0.20/candidate: ↑
0.20/beta: ↑
0.20/edge: 0.20.1 2020-08-02 (75) 105MB -
0.19/stable: 0.19.1 2020-03-13 (64) 106MB -
0.19/candidate: ↑
0.19/beta: ↑
0.19/edge: 0.19.1 2020-08-02 (78) 106MB -
0.18/stable: 0.18.1 2019-08-09 (50) 107MB -
0.18/candidate: ↑
0.18/beta: ↑
0.18/edge: 0.18.1 2019-08-09 (50) 107MB -
0.17/stable: 0.17.1 2019-08-08 (42) 106MB -
0.17/candidate: ↑
0.17/beta: ↑
0.17/edge: 0.17.1 2019-08-08 (42) 106MB -
installed: 0.20.1 (81) 105MB -
nicholas@mordor:~$
nicholas@mordor:~$ man bitcoin-core
No manual entry for bitcoin-core
nicholas@mordor:~$
nicholas@mordor:~$ bitcoin-core.cli status
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.
nicholas@mordor:~$
nicholas@mordor:~$ bitcoin-core.cli start
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.
nicholas@mordor:~$
How do I run bitcoin-core
in prune mode? And, where is the conf
file?
The GUI:
But I'm just looking to use the console, and have no need, nor space, for the blockchain. Never mind the bandwidth.
I also checked:
- https://bitcoin.stackexchange.com/q/13795/111738
- https://bitcoin.stackexchange.com/q/88564/111738
- https://blockgeeks.com/install-bitcoin-core/
Solution 1:
You can follow this guide.
Pretty straight forward response to what you are looking for. :)
Here is a copy of that reference, in case the website is not available anymore in the future:
Bitcoin Core Daemon
If you’re logged in as an administrative user with sudo access, you may log out. The steps in this section should be performed as the user you want to run Bitcoin Core. (This can be a locked account used only by Bitcoin Core.) If you changed users in a graphical interface, start a terminal.
Type the following command:
bitcoind -daemon
It will print a message that Bitcoin Core is starting. To interact with Bitcoin Core daemon, you will use the command bitcoin-cli (Bitcoin command line interface).
Note: it may take up to several minutes for Bitcoin Core to start, during which it will display the following message whenever you use bitcoin-cli:
error: {"code":-28,"message":"Verifying blocks..."}
After it starts, you may find the following commands useful for basic interaction with your node: getblockchaininfo, getnetworkinfo, getnettotals, getwalletinfo, stop, and help.
For example, to safely stop your node, run the following command:
bitcoin-cli stop
A complete list of commands is available in the Bitcoin.org developer reference.
When Bitcoin Core daemon first starts, it will begin to download the block chain. This step will take at least several days, and it may take much more time on a slow Internet connection or with a slow computer. During the download, Bitcoin Core will use a significant part of your connection bandwidth. You can stop Bitcoin Core at any time using the stop command; it will resume from the point where it stopped the next time you start it.
Optional: Start Your Node At Boot
Starting your node automatically each time your computer boots makes it easy for you to contribute to the network. The easiest way to do this is to start Bitcoin Core daemon from your crontab. To edit your crontab on most distributions, run the following command:
crontab -e
Scroll to the bottom of the file displayed and add the following line:
@reboot bitcoind -daemon
Save the file and exit; the updated crontab file will be installed for you. On most distributions, this will cause Bitcoin Core daemon to be automatically started each time you reboot your computer.