Skip to content

jamsrworld/litecoin-docker-node-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Litecoin Full Node with Docker

This guide provides step-by-step instructions for setting up a Litecoin full node using Docker, with optional snapshot integration to accelerate the initial blockchain synchronization.


📁 Directory Structure

LTC/
├── compose.yml
└── ltc-data/
    └── litecoin.conf

🛠️ Step-by-Step Setup

1. Create compose.yml in the root of the LTC directory:

# compose.yml

services:
  litecoin-node:
    image: litecoinproject/litecoin-core:latest
    container_name: litecoin-node
    ports:
      - "9333:9333" # Litecoin P2P port
      - "9332:9332" # Litecoin RPC port http://localhost:9332/
    volumes:
      - ./ltc-data:/home/litecoin/.litecoin

2. Create litecoin.conf inside the ltc-data directory:

# litecoin.conf

server=1
listen=1

rpcuser=admin
rpcpassword=yourStrongPassword
rpcallowip=0.0.0.0/0
rpcbind=0.0.0.0

# Optional settings:
# Uncomment to enable prune mode
#prune=550
#txindex=0

# Performance tuning
dbcache=4096  # Use 4 GB for caching (adjust based on RAM)

▶️ Docker Commands

Start the Litecoin node:

docker compose up -d

Stop the node:

docker compose down

Restart the node:

docker compose down
docker compose up -d

View real-time logs:

docker compose logs -f

Check Blockchain Sync Status:

docker exec -it litecoin-node litecoin-cli -datadir=/home/litecoin/.litecoin getblockchaininfo

Check Connected Peers:

docker exec -it litecoin-node litecoin-cli -datadir=/home/litecoin/.litecoin getconnectioncount

Watch Live Sync Progress (Optional):

watch -n 5 "docker exec -it litecoin-node litecoin-cli -datadir=/home/litecoin/.litecoin getblockchaininfo"

This will refresh the blockchain sync info every 5 seconds. Press Ctrl+C to stop watching.

📦 Importing the LTC Blockchain Snapshot (Optional)

To speed up the initial sync, you can use a trusted Litecoin snapshot. There are two types of snapshots:

🟢 Option 1: Full Node Snapshot

  1. Replace the blocks/ and chainstate/ folders inside ltc-data/ with snapshot data. After that:

  2. Temporarily override the command in compose.yml by adding:

command: ["litecoind", "-reindex-chainstate"] # 👈 Temporary override
# compose.yml

services:
  litecoin-node:
    image: litecoinproject/litecoin-core:latest
    container_name: litecoin-node
    command: ["litecoind", "-reindex-chainstate"] # 👈 Add this line temporarily
    ports:
      - "9333:9333" # Litecoin P2P port
      - "9332:9332" # Litecoin RPC port http://localhost:9332/
    volumes:
      - ./ltc-data:/home/litecoin/.litecoin
  1. Run and monitor:
docker compose up -d
docker compose logs -f
  1. After reindex completes, remove the command: ["litecoind", "-reindex-chainstate"] line from compose.yml and restart:
docker compose down
docker compose up -d

🟡 Option 2: Pruned Node Snapshot (prune=550 or any > 0)

Replace the entire ltc-data/ folder with the one from the snapshot source.

Ensure prune=550 (or your value) is set in litecoin.conf.

✅ Do NOT use -reindex or -reindex-chainstate. That will delete pruned data and force full sync from 0.

Start the node normally:

docker compose up -d

✅ Optional: Add Makefile Commands for convenience

start:
	docker compose up -d

down:
	docker compose down

restart:
	docker compose down
	docker compose up -d

logs:
	docker compose logs -f

info:
	docker exec -it litecoin-node litecoin-cli -datadir=/home/litecoin/.litecoin getblockchaininfo

peers:
	docker exec -it litecoin-node litecoin-cli -datadir=/home/litecoin/.litecoin getconnectioncount

After creating the Makefile, you can use:

make start
make logs
make info

About

Litecoin full node setup using Docker also with snapshot and prune support.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors