A modern, high-performance block explorer for the S256 (SHA256 Coin) blockchain with MongoDB backend.
Block Explorer for SHA256coin (S256)
Built with Node.js and Express
- Real-time blockchain statistics
- Fast MongoDB-backed database
- Browse recent blocks with pagination
- View detailed block information
- View transaction details
- Search by block height, block hash, transaction ID, or address
- Address balance tracking
- Network statistics history
- Auto-syncing with blockchain
- Responsive design matching S256 website theme
- Frontend: Modern HTML/CSS/JS interface
- API: Express.js REST API
- Database: MongoDB for fast queries
- Sync Service: Background process that syncs blocks from S256 daemon
- Node.js (v16 or higher)
- MongoDB (v6 or higher)
- npm or yarn
- Running S256 daemon with RPC enabled
Before running the explorer, make sure your S256 daemon is configured for RPC access.
- Create or edit
~/.sha256coin/sha256coin.conf(or your custom data directory):
# RPC Configuration
server=1
txindex=1
rpcuser=your_rpc_username
rpcpassword=your_secure_rpc_password
rpcport=25332
rpcallowip=127.0.0.1
# Optional: Enable transaction indexing for full explorer functionality
txindex=1
- If you add
txindex=1to an existing node, you'll need to reindex:
./bitcoind -reindexUbuntu/Debian:
# Import MongoDB public key
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor
# Add repository (Ubuntu 22.04 - for other versions see MongoDB docs)
echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
# Install MongoDB
sudo apt-get update
sudo apt-get install -y mongodb-org
# Start and enable service
sudo systemctl start mongod
sudo systemctl enable mongodmacOS:
brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-communityOr use MongoDB Atlas (free cloud MongoDB): https://www.mongodb.com/cloud/atlas
cd explorer
npm installCreate .env file:
cp .env.example .envEdit .env with your configuration:
# S256 RPC
RPC_USER=your_rpc_username
RPC_PASSWORD=your_secure_rpc_password
RPC_HOST=127.0.0.1
RPC_PORT=25332
# MongoDB
MONGODB_URI=mongodb://localhost:27017/s256explorer
# Server
PORT=3000The explorer consists of two services that need to run simultaneously:
Terminal 1 - Start the sync service:
npm run syncTerminal 2 - Start the API server:
npm startThe explorer will be available at: http://localhost:3000
Using PM2 process manager (recommended for production):
# Install PM2 globally
npm install -g pm2
# Start both services
npm run pm2:start
# View logs
pm2 logs
# Stop services
npm run pm2:stop
# Restart services
npm run pm2:restartIf you don't want to use MongoDB, you can run the simple version:
npm run start:simpleThis version queries RPC directly (slower, not recommended for production).
- View Blockchain Stats: The top section shows real-time blockchain information
- Recent Blocks: Scroll down to see the latest 20 blocks
- Search: Use the search bar to find blocks (by height or hash) or transactions (by txid)
- Block Details: Click any block to view detailed information
- Transaction Details: Click any transaction to view inputs and outputs
The explorer provides a REST API:
GET /api/blockchain-info- Get blockchain statisticsGET /api/blocks/recent/:count- Get recent blocks (default: 10)GET /api/block/:hashOrHeight- Get block by hash or heightGET /api/tx/:txid- Get transaction by IDGET /api/search/:query- Search for block or transactionGET /api/mempool- Get mempool information
If you get "Connection refused" errors:
-
Make sure the S256 daemon is running:
./bitcoin/build/bin/bitcoin-cli getblockchaininfo
-
Check RPC credentials match between
s256.confand.env -
Verify RPC port (default: 25332)
If transactions don't show up:
- Enable
txindex=1insha256coin.conf - Restart daemon with
-reindexflag
If port 3000 is already in use, change the PORT in .env:
PORT=3001For production deployment:
-
Use a process manager like PM2:
npm install -g pm2 pm2 start server.js --name s256-explorer pm2 save pm2 startup
-
Set up nginx reverse proxy for HTTPS
-
Configure firewall to allow traffic on the explorer port
MIT License - See LICENSE file for details
For issues and questions, please open an issue on the project GitHub repository.
