Dorokhov.codes

Bitcoin Core: bitcoind

Bitcoin Core is a full Bitcoin client and builds the backbone of the network. It offers high levels of security, privacy, and stability. It is a direct descendant of the original Bitcoin software client released by Satoshi Nakamoto after he published the famous Bitcoin whitepaper.

Official website: https://bitcoincore.org

Tarball with the client for Linux (bitcoin-22.0-x86_64-linux-gnu.tar.gz) takes 35.8 Mb.

If we take a look inside the archive (in bitcoin-22.0/bin), we will see the next picture:

total 81472
-rwxr-xr-x 1 andrew andrew  2157888 Sep  8 21:15 bitcoin-cli
-rwxr-xr-x 1 andrew andrew 12920800 Sep  8 21:15 bitcoind
-rwxr-xr-x 1 andrew andrew 35541656 Sep  8 21:15 bitcoin-qt
-rwxr-xr-x 1 andrew andrew  2780256 Sep  8 21:15 bitcoin-tx
-rwxr-xr-x 1 andrew andrew  1960736 Sep  8 21:15 bitcoin-util
-rwxr-xr-x 1 andrew andrew  7537440 Sep  8 21:15 bitcoin-wallet
-rwxr-xr-x 1 andrew andrew 20516256 Sep  8 21:15 test_bitcoin

Now in more details about each file:

  • bitcoind - the main Bitcoin Core app which works as a deamon.
  • bitcoin-cli - client to communicate with the deamon.
  • bitcoin-qt - it’s a graphic client Bitcoin Core.

There are two variations of the original bitcoin program available; one with a graphical user interface, and a ‘headless’ version (called bitcoind). They are completely compatible with each other, and take the same command-line arguments, read the same configuration file, and read and write the same data files. You can run one copy of either bitcoin-qt or bitcoind on your system at a time (if you accidentally try to launch another, the copy will let you know that bitcoin-qt or bitcoind is already running and will exit).

После запуска bitcoin-qt можно увидеть следующую картину:

Это идёт начальная загрузка блокчейна. Приостановить начальную загрузку блокчейна мы можем, если отключим сетевую активность (соответствующая кнопка есть в нижнем правом углу окошка). Чтобы скачать весь блокчейн нам понадобиться примерно 340 Гб свободного места.

Биткоин-клиент общается с сетью через порт 8333.

Зайдя в главном меня в Window -> Information, мы сможем увидеть такую информацию, как высота блокчейна, загруженного на данный момент, место расположения блокчейна в нашей файловой системе и другое.

It is possible to configure our node to to run in pruned mode in order to reduce storage requirements. This can reduce the disk usage from over 350 Gb to around 1 Gb.

Just open “Settings -> Options” and specify “Prune block storage to” field.

Configuration

Нужно понимать, что файлы конфигурации bitcoind и bitcoin-qt хранятся в разных местах, поэтому настройки, указанные в графической версии не будут применены при запуске bitcoind.

Bitcoin Core хранит настройки в файле ~./bitcoin/bitcoin.conf. Эти настройки перезаписывают те, что указаны в графической оболочке bitcoin-qt.

Sample bitcoin.conf.

Commands for deamon

bitcoind -deamon - run in the background as a daemon.

Commands for a client

Клиент Bitcoin Core реализует интерфейс JSON-RPC, к которому можно получить доступ с помощью утилиты командной строки bitcoin-cli.

bitcoin-cli help: список доступных команд.

bitcoin-cli -getinfo: показывает информацию о состоянии данного узла и базы данных блокчейн.

{
  "version": 220000,
  "blocks": 707160,
  "headers": 707161,
  "verificationprogress": 0.9999969037907491,
  "timeoffset": 0,
  "connections": {
    "in": 0,
    "out": 10,
    "total": 10
  },
  "proxy": "",
  "difficulty": 20082460130830.84,
  "chain": "main",
  "relayfee": 0.00001000,
  "warnings": ""
}