Skip to content

Instantly share code, notes, and snippets.

@makertronic
Created April 6, 2025 19:07
Show Gist options
  • Select an option

  • Save makertronic/20de439c56bfedc550bc1ea1d320e745 to your computer and use it in GitHub Desktop.

Select an option

Save makertronic/20de439c56bfedc550bc1ea1d320e745 to your computer and use it in GitHub Desktop.
Bitcoin core node headless mode
###############################################################################
# #
# BITCOIN NODE - Tutoriel en ligne de commande Bash #
# Auteur : Makertronic #
# Web : https://www.makertronic-yt.com/ #
# Date : 04/04/2025 #
# Description : Minage sur son propre node #
# #
###############################################################################
# #
# NE PAS DIFFUSER #
# Copyright 2025 Makertronic. tous droits réservés #
# #
###############################################################################
###############################################################################
# #
# Liens #
# #
###############################################################################
- Site officiel : https://github.com/bitcoin/
###############################################################################
# #
# Pre-requis #
# #
###############################################################################
- Minimum 2GB RAM,
- SSD 1To,
- connexion stable.
###############################################################################
# #
# compiler le node #
# #
###############################################################################
# update du systeme
sudo apt update
sudo apt upgrade -y
# telechargement des sources
git clone https://github.com/bitcoin/bitcoin.git
# Configurer les sources
cd bitcoin/
git checkout v28.1
./autogen.sh
./configure --without-gui
# compiler les sources de bitcoind
make -j31 # 31 = nombre de threads de ton processeur (cela peux duer un moment si la machine est pas tres puissante)
sudo make install
# configurer le daemon bitcoind
mkdir -p ~/.bitcoin
nano ~/.bitcoin/bitcoin.conf
bitcoind -daemon
nano ~/.bitcoin/bitcoin.conf
=> Ajouter :
# Core settings
server=1 # Enable JSON-RPC server
listen=1 # Accept incoming connections
# RPC settings (secure with strong credentials)
rpcuser=your_username
rpcpassword=your_strong_password
rpcallowip=127.0.0.1
server=1
txindex=1 # Obligatoire pour le minage solo
listenonion=0 # Désactive Tor si non utilisé
# Network
upnp=1 # Allow UPnP port forwarding
# Notification des blocks en temps reel
zmqpubhashblock=tcp://127.0.0.1:28332
CTRL+S, CTRL+X
# Lancer bitcoind
bitcoind -daemon
###############################################################################
# #
# Verifier l'état du node (synchro) #
# #
###############################################################################
# Verifier l'état du node (synchro)
tail -f ~/.bitcoin/debug.log
watch bitcoin-cli getblockchaininfo
Assurez-vous que "blocks" est égal à "headers", ce qui signifie que votre nœud est à jour.
###############################################################################
# #
# arreter/redemarrer #
# #
###############################################################################
# Démarrer
bitcoind -daemon
# Arreter
bitcoin-cli stop
###############################################################################
# #
# Lancement automatique dans l'espace utilisateur #
# #
###############################################################################
=> arreter le service avant de commancer : bitcoin-cli stop
=> remplace nicola par ton nom d'utilisateur
mkdir /home/nicola/.config/systemd/nicola
nano /home/nicola/.config/systemd/user/bitcoind.service
=> Ajouter :
[Unit]
Description=bitcoind
After=network.target
[Service]
ExecStart=/usr/local/bin/bitcoind -datadir=/home/nicola/.bitcoin
ExecStop=/usr/local/bin/bitcoin-cli -datadir=/home/nicola/.bitcoin stop
Restart=on-failure
TimeoutStopSec=300
Environment=HOME=/home/nicola
WorkingDirectory=/home/nicola
[Install]
WantedBy=default.target
Puis :
systemctl --user daemon-reexec
systemctl --user daemon-reload
=> Activer le service
systemctl --user enable bitcoind
=> Lancer le service
systemctl --user start bitcoind
=> l'ajouter au boot
sudo loginctl enable-linger nicola
###############################################################################
# #
# Verifier l'état du node #
# #
###############################################################################
systemctl --user status bitcoind
=> relancer le node :
systemctl --user restart bitcoind
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment