What is a Seed Node?
A seed node is a peer that has the complete file and shares it with other peers in the network. When you start a seed node, it:- Opens a TCP server on the specified port to accept incoming connections
- Calculates the SHA-1 hash of the file for verification
- Divides the file into pieces (64 KiB by default)
- Waits for leechers to connect and request pieces
The seed node automatically calculates and verifies the file hash during startup. For files smaller than 64 KiB, the piece size is automatically adjusted to match the file size.
Starting a Seed Node
Prepare the file
Ensure the file you want to share exists on your system. The seed node requires read access to this file.
Start the seed using npm script
Use the Or use the
seed npm script to start sharing a file:start script directly:Command-Line Usage
The basic syntax for starting a seed node is:Example: Sharing a video file
Example: Using absolute paths
Console Output
When running as a seed, you’ll see the following output: Initial startup:File Verification and Hash Calculation
The seed node automatically calculates the SHA-1 hash of the complete file during initialization. This hash is shared with leechers during the handshake to ensure file integrity.
src/node.js:56-60:
- All peers are sharing the same file
- Leechers can verify the downloaded file integrity
- The network rejects peers trying to share different files
Technical Details
Piece Size
By default, files are divided into 64 KiB (65,536 bytes) pieces. This is defined insrc/node.js:13:
Number of Pieces
The total number of pieces is calculated as:- File size: 157,286,400 bytes
- Piece size: 65,536 bytes
- Number of pieces: 2,400 pieces