git / moonbite-network / docs/NODE_SETUP.md · raw
# Running a BigCoin Full Node / Seed NodeA full node validates and relays the BigCoin blockchain. Running one strengthensthe network, gives you a trustless view of the chain, and is required to operatea seed node, block explorer, pool, or exchange integration.## Network ports| Purpose | Mainnet | Testnet ||---------------------|---------|---------|| P2P (peer traffic) | 9444 | 19555 || RPC (control/API) | 9445 | (typically 19445) |- **P2P port 9444** must be reachable from the internet for a node to accept incoming peers and to act as a seed.- **RPC port 9445** should be kept **private** (localhost or trusted hosts only). Never expose RPC to the public internet.---## Sample `bigcoin.conf`Place this in the data directory:- Linux: `~/.bigcoin/bigcoin.conf`- macOS: `~/Library/Application Support/BigCoin/bigcoin.conf`- Windows: `%APPDATA%\BigCoin\bigcoin.conf````ini# ---- RPC / server ----server=1rpcuser=bigrpcrpcpassword=CHANGE_ME_to_a_long_random_string# Only allow RPC from localhost (adjust CIDR carefully if remote access needed):rpcbind=127.0.0.1rpcallowip=127.0.0.1rpcport=9445# ---- P2P / networking ----listen=1port=9444maxconnections=125# ---- node behavior ----txindex=1 # required for explorers / full tx lookupsdbcache=512 # MB of DB cache; raise for faster sync if you have RAM# ---- peers to connect to at startup ----addnode=67.205.154.64:9444```> **Security:** Use a long, random `rpcpassword`. Prefer `rpcauth` (hashed> credentials generated by the `rpcauth.py` helper) over a plaintext> `rpcpassword` in shared environments. Do **not** set `rpcallowip=0.0.0.0/0`.Test it:```bashbigcoind -daemonbigcoin-cli getblockchaininfobigcoin-cli getpeerinfobigcoin-cli getnetworkinfo```---## Firewall and port forwarding (P2P 9444)To accept inbound peers you must allow **TCP 9444** in.### Linux (ufw)```bashsudo ufw allow 9444/tcp comment "BigCoin P2P"# DO NOT open 9445 (RPC) to the internet```### Linux (firewalld)```bashsudo firewall-cmd --permanent --add-port=9444/tcpsudo firewall-cmd --reload```### Home router / NATForward external TCP **9444 -> internal-node-IP:9444**. Give the node a staticLAN IP or a DHCP reservation so the forward stays valid.Verify reachability from outside your network (e.g. an online port checker, orfrom another host):```bashnc -vz your.public.ip 9444```For testnet, substitute **19555** everywhere you see 9444.---## Running as a systemd service (Linux)Create a dedicated user and directories, then a unit file.```bashsudo useradd -r -m -d /var/lib/bigcoind bigcoinsudo mkdir -p /etc/bigcoinsudo cp bigcoin.conf /etc/bigcoin/bigcoin.confsudo chown -R bigcoin:bigcoin /var/lib/bigcoind /etc/bigcoin````/etc/systemd/system/bigcoind.service`:```ini[Unit]Description=BigCoin daemonAfter=network-online.targetWants=network-online.target[Service]User=bigcoinGroup=bigcoinType=simpleExecStart=/usr/local/bin/bigcoind \ -conf=/etc/bigcoin/bigcoin.conf \ -datadir=/var/lib/bigcoind \ -pid=/run/bigcoind/bigcoind.pidExecStop=/usr/local/bin/bigcoin-cli -conf=/etc/bigcoin/bigcoin.conf stopRestart=on-failureTimeoutStopSec=120RuntimeDirectory=bigcoind# hardeningNoNewPrivileges=truePrivateTmp=trueProtectSystem=fullProtectHome=true[Install]WantedBy=multi-user.target```Enable and start:```bashsudo systemctl daemon-reloadsudo systemctl enable --now bigcoindsudo systemctl status bigcoindjournalctl -u bigcoind -f```> Note: run `bigcoind` **without** `-daemon` under systemd (`Type=simple`), so> systemd manages the process directly.---## Adding DNS seeds and addnode peersNodes discover each other through:1. **DNS seeds** — hostnames that resolve to lists of active node IPs. These are compiled into the client's chain parameters. For a new coin you (the maintainers) run a `dnsseed`-style server or use a static host and publish its name. Once compiled in, clients query it automatically.2. **`addnode` entries** — explicit peers, added in `bigcoin.conf` or at runtime:```bash# add a peer at runtimebigcoin-cli addnode "203.0.113.10:9444" add# force a one-time connection attemptbigcoin-cli addnode "198.51.100.20:9444" onetry# inspect current peersbigcoin-cli getpeerinfo | grep addr```- Use `addnode` for peers you always want to try.- Use `connect=` (instead of `addnode=`) only if you want to connect **exclusively** to specific peers (disables automatic peer discovery — usually not what you want for a public node).---## Bootstrapping a small network for launchFor a brand-new coin there are no peers yet. Bring up an initial mesh:1. **Stand up 2-5 stable seed nodes** on hosts with static public IPs (VPS is ideal). Give each `listen=1`, `port=9444`, and open the firewall.2. **Cross-connect them** so they form a mesh. In each node's config: ```ini addnode=<ip-of-seed-A>:9444 addnode=<ip-of-seed-B>:9444 addnode=<ip-of-seed-C>:9444 ```3. **Publish DNS seed hostnames** (e.g. `seed1.bigcoin.example.com`) pointing at those IPs, and ship them in the client's chain params / default `addnode` list so new users auto-connect.4. **Mine the early blocks** on at least one node (see [MINING.md](MINING.md)) so the chain grows and new nodes have something to sync.5. **Monitor connectivity** with `getpeerinfo`, `getnetworkinfo`, and `getconnectioncount`. Aim for each seed to have multiple inbound + outbound peers.6. **Document the seed list publicly** (GitHub, website) so operators and exchanges can add reliable `addnode` entries.Keep at least a couple of seed nodes running 24/7 during launch — if they all godown before the network has organic peers, new nodes cannot bootstrap.