A next-generation blockchain implementation featuring the Proof of Collaboration (PoC) consensus protocol, built with Node.js and TypeScript.
Streembit Blockchain bridges traditional finance and blockchain technology through legal accountability and cooperative game theory principles. Unlike traditional Proof-of-Work or Proof-of-Stake systems, PoC ensures institutional adoption by combining cryptographic security with real-world legal frameworks.
- Proof of Collaboration (PoC) consensus protocol
- Accountable Block Creators - Only registered businesses can create blocks
- Minting Consortiums - Anonymous participation through accountable intermediaries
- Dual Token System - FOWCoin (FOW) and Streembit Stable Coin (SSC)
- Legal Integration - Works within existing regulatory frameworks
- TypeScript Implementation - Type-safe development with strict typing
- CLI and Web API - Multiple interfaces for different user types
- Node.js 20+ (LTS version)
- npm 9+
- TypeScript 5.0+
# Clone the repository
git clone https://github.com/streembit/streembit-blockchain.git
cd streembit-blockchain
# Install dependencies
npm install
# Build the project
npm run build
# Initialize configuration
./dist/cli/index.js init# Start integrated console with PoC collaborators
npm run dev
# Expected output:
π Streembit Blockchain Interactive Console
π Collaborators: 2 nodes, 2 eligible
streembit> genesis 1234567890abcdef...
streembit> exitCollaborator Requirements (all must be true in .env):
ENABLE_COLLABORATOR=trueCOLLABORATOR_NODES=streembit-limited-ie,streembit-foundation-usCOLLABORATOR_AUTO_START=true
# Start the blockchain node with API server
npm start
# Start only external CLI
npm run start:cli
# Start only the API server
npm run start:api# Show help
npx streembit --help
# Start blockchain node
npx streembit node start --port 8333
# Create a wallet
npx streembit wallet create --name my-wallet
# Check wallet balance
npx streembit wallet balance
# Send transaction
npx streembit wallet send 0x... 100 --confirm
# Register as validator
npx streembit consensus register --business-cert cert.pem
# View network status
npx streembit network peersThe API server runs on port 3000 by default:
# Get API information
curl http://localhost:3000/api/v1
# Get latest blocks
curl http://localhost:3000/api/v1/blocks
# Get specific block
curl http://localhost:3000/api/v1/blocks/0x1234...
# Health check
curl http://localhost:3000/healthConnect to real-time notifications:
const ws = new WebSocket('ws://localhost:3000/ws');
// Subscribe to block notifications
ws.send(JSON.stringify({
type: 'subscribe',
channel: 'blocks'
}));For production deployments, private keys should never be embedded in Docker images. Instead, use volume mounting to provide secure access:
# Create secure directory on host
sudo mkdir -p /secure/streembit-keys
sudo chmod 700 /secure/streembit-keys
sudo chown $(id -u):$(id -g) /secure/streembit-keys
# Copy private keys to secure directory
cp registry/private/*.pem /secure/streembit-keys/
# Run container with mounted keys
docker run -d \
--name streembit-blockchain \
-e PRIVATE_KEY_PATH=/app/keys \
-e ENABLE_COLLABORATOR=true \
-e COLLABORATOR_NODES=streembit-limited-ie,streembit-foundation-us \
-e COLLABORATOR_AUTO_START=true \
-v /secure/streembit-keys:/app/keys:ro \
-p 3000:3000 \
-p 8333:8333 \
streembit/blockchain:latest# Required for collaborator nodes
ENV PRIVATE_KEY_PATH=/app/keys
ENV ENABLE_COLLABORATOR=true
ENV COLLABORATOR_NODES=node1,node2
ENV COLLABORATOR_AUTO_START=true
# Mount keys as read-only volume
VOLUME ["/app/keys"]Security Benefits:
- β Private keys stay on host filesystem
- β Keys are mounted read-only to prevent modification
- β No keys embedded in Docker images or layers
- β Easy key rotation without rebuilding images
- β Supports different keys per environment
- Application will fail and exit if required private keys are missing
- Use
PRIVATE_KEY_PATHto specify custom key directory location - Ensure proper file permissions (600) on private key files
- Keys must match the certificate paths in
registry/accountable-nodes.json
Configuration can be provided via:
- Configuration file (
streembit.config.yaml) - Environment variables (prefixed with
STREEMBIT_) - Command line arguments
# streembit.config.yaml
node:
port: 8333
dataDir: "./data"
network: "devnet"
api:
enabled: true
port: 3000
cors: true
consensus:
autoParticipate: false
depositAmount: "100000"
validationEnabled: true
# Collaborator settings
collaborators:
enabled: true
nodes: ["streembit-limited-ie", "streembit-foundation-us"]
autoStart: true
privateKeyPath: "./registry/private" # Or "/app/keys" for Docker
logging:
level: "info"
file: "./logs/streembit.log"Key environment variables for collaborator configuration:
# Required for PoC consensus participation
ENABLE_COLLABORATOR=true
COLLABORATOR_NODES=streembit-limited-ie,streembit-foundation-us
COLLABORATOR_AUTO_START=true
# Private key location (critical for security)
PRIVATE_KEY_PATH=./registry/private
# Alternative paths for different deployments:
# PRIVATE_KEY_PATH=/secure/keys # Production
# PRIVATE_KEY_PATH=/app/keys # Docker
# PRIVATE_KEY_PATH=C:\secure\keys # Windowsnpm run build # Build TypeScript to JavaScript
npm run dev # Run in development mode
npm run test # Run tests
npm run test:coverage # Run tests with coverage
npm run lint # Lint code
npm run lint:fix # Fix linting issues
npm run format # Format code with Prettier
npm run type-check # Check TypeScript typesMIT License - see LICENSE file for details.