Skip to content

KiraCore/sekin

Repository files navigation

Sekin

Overview

Sekin is a complete infrastructure stack for running KIRA blockchain nodes with integrated indexing, cross-chain interaction services, and comprehensive monitoring. It provides a production-ready deployment environment using Docker Compose with automated CI/CD pipelines for seamless updates.

Architecture

Sekin orchestrates multiple microservices in a containerized environment:

┌─────────────────────────────────────────────────────────────┐
│                     Sekin Infrastructure                     │
├─────────────────────────────────────────────────────────────┤
│                                                               │
│  ┌────────────────────┐  ┌───────────────────────┐          │
│  │  Sekai + Scaller   │  │   Interx Manager      │          │
│  │  (Cosmos + CLI)    │  │   (P2P/HTTP Server)   │          │
│  └─────────┬──────────┘  └───────────┬───────────┘          │
│            │                          │                      │
│  ┌─────────┴──────────────────────────┴───────────┐         │
│  │              Centralized Logging (Syslog-ng)   │         │
│  └────────────────────────────────────────────────┘         │
│                                                               │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐      │
│  │   Storage    │  │    Proxy     │  │   MongoDB    │      │
│  │  (MongoDB)   │  │  (HTTP/REST) │  │  (Database)  │      │
│  └──────────────┘  └──────────────┘  └──────────────┘      │
│                                                               │
│  ┌──────────────────┐  ┌──────────────────────────┐         │
│  │ Cosmos Services  │  │  Ethereum Services       │         │
│  │ - Indexer        │  │  - Indexer               │         │
│  │ - Interaction    │  │  - Interaction           │         │
│  └──────────────────┘  └──────────────────────────┘         │
│                                                               │
└─────────────────────────────────────────────────────────────┘

Components

Core Services

Sekai with Scaller

  • KIRA blockchain node built on Cosmos SDK
  • Includes scaller CLI for node bootstrapping, management, and monitoring
  • Ports: 26657 (RPC), 26656 (P2P), 9090 (gRPC), 1317 (REST API)
  • Built from sekai.Dockerfile (contains sekaid + scaller)

Syslog-ng

  • Centralized logging server for all services
  • Collects logs via UDP/TCP on port 514
  • Configured with log rotation and retention policies

Interx Microservices (v0.7.0)

Manager

  • P2P load balancer and HTTP server
  • Handles peer discovery and request routing
  • Ports: 8080 (HTTP), 9000 (UDP P2P)

Proxy

  • Legacy HTTP request converter
  • Translates between different API formats
  • Port: 11000

Storage

  • MongoDB-backed storage service
  • Provides data persistence layer
  • Port: 8880

Cosmos Indexer

  • Indexes KIRA/Cosmos blockchain data
  • Real-time block and transaction indexing
  • Port: 8883

Cosmos Interaction

  • Creates and publishes Cosmos transactions
  • Handles transaction signing and broadcasting
  • Port: 8884

Ethereum Indexer

  • Indexes Ethereum blockchain data
  • Monitors smart contract events
  • Port: 8881

Ethereum Interaction

  • Creates and publishes Ethereum transactions
  • Smart contract interaction layer
  • Port: 8882

MongoDB

  • Database backend for storage service
  • Version: 7.0

Network Topology

All services run on a custom bridge network kiranet (10.1.0.0/16):

Service IP Address Hostname
Gateway 10.1.0.1 -
Syslog-ng 10.1.0.2 syslog-ng.local
Sekai 10.1.0.3 sekai.local
Manager 10.1.0.4 manager.local
Proxy 10.1.0.10 proxy.local
Storage 10.1.0.11 storage.local
Cosmos Indexer 10.1.0.12 cosmos-indexer.local
Cosmos Interaction 10.1.0.13 cosmos-interaction.local
Ethereum Indexer 10.1.0.14 ethereum-indexer.local
Ethereum Interaction 10.1.0.15 ethereum-interaction.local
MongoDB 10.1.0.16 mongo.local

Prerequisites

  • Ubuntu 20.04 or later
  • Minimum 8GB RAM, 16GB recommended
  • 100GB+ available disk space
  • Root or sudo access
  • Docker Engine 20.10+
  • Docker Compose v2.0+

Installation

1. Prepare the Host

Clone the repository and make scripts executable:

git clone https://github.com/KiraCore/sekin.git
cd sekin
chmod +x ./scripts/*

2. Bootstrap the Environment

Run the bootstrap script to install all dependencies (Docker, Docker Compose, etc.):

sudo ./scripts/bootstrap.sh

This script will:

  • Update system packages
  • Install Docker and Docker Compose
  • Configure Docker daemon
  • Set up required users and permissions

3. Deploy the Stack

Production Deployment:

docker compose -f compose.yml up -d

Development Deployment:

docker compose -f dev-compose.yml up -d

The main differences:

  • compose.yml: Uses pre-built images from GHCR
  • dev-compose.yml: Builds images locally from Dockerfiles

4. Verify Services

Check that all services are running:

docker compose ps

View logs from all services:

docker compose logs -f

View logs from a specific service:

docker compose logs -f sekai
# or check the centralized logs
tail -f ./syslog-data/sekai.log

Building Images

Build the sekai image (includes sekaid + scaller):

docker build -f sekai.Dockerfile -t sekai:latest .

Build the syslog-ng image:

docker build -f syslog-ng.Dockerfile -t syslog-ng:latest .

Port Mappings

External Access (0.0.0.0)

Port Service Description
26657 Sekai RPC (Tendermint)
26656 Sekai P2P (Tendermint)
9000 Manager P2P UDP
11000 Proxy HTTP Proxy
8880 Storage Storage API
8881 ETH Idx Ethereum Indexer API
8882 ETH Int Ethereum Interaction API
8883 Cos Idx Cosmos Indexer API
8884 Cos Int Cosmos Interaction API

Localhost Only (127.0.0.1)

Port Service Description
26658 Sekai ABCI
26660 Sekai Prometheus Metrics
1317 Sekai REST API
9090 Sekai gRPC
8080 Manager HTTP Server
514 Syslog-ng Syslog Server (UDP/TCP)

Configuration

Configuration files for each service are located in their respective directories:

  • Manager: ./manager/config.yml
  • Proxy: ./proxy/config.yml
  • Storage: ./worker/sai-storage-mongo/config.yml
  • Cosmos Indexer: ./worker/cosmos/sai-cosmos-indexer/config.yml
  • Cosmos Interaction: ./worker/cosmos/sai-cosmos-interaction/config.yml
  • Ethereum Indexer: ./worker/ethereum/sai-ethereum-indexer/config.json
  • Ethereum Interaction: ./worker/ethereum/sai-ethereum-contract-interaction/config.yml
  • Syslog: ./config/syslog-ng.conf, ./config/logrotate.conf

Sekai and Interx configurations are stored in ./sekai/ and ./interx/ directories (gitignored).

CI/CD Automation

Sekin uses GitHub Actions for automated image building, signing, and deployment:

Workflows

ci.yml - Build and Release

  • Triggers on PR merge to main branch
  • Creates semantic version tags
  • Builds and pushes Sekai and Syslog-ng images to GHCR
  • Signs images with Cosign (Sigstore)
  • Updates compose.yml with new versions

hook.yml - Repository Dispatch

  • Triggered by external repositories (Sekai/Interx releases)
  • Builds and publishes Docker images
  • Signs images with Cosign
  • Updates compose file automatically

interx-update.yml - Interx Services Update

  • Triggered by Interx repository releases
  • Updates all Interx microservice versions in compose.yml
  • Maintains version consistency across services

Image Signing

All images are signed using Cosign for supply chain security. Verify signatures:

cosign verify --key cosign.pub ghcr.io/kiracore/sekin/sekai:latest

Scaller CLI

Scaller is a Go CLI tool bundled in the sekai container for node bootstrapping, management, and monitoring.

Commands

Command Description
wait Wait indefinitely (container entrypoint)
init Initialize new sekaid node
keys-add Add key to keyring
add-genesis-account Add account to genesis
gentx-claim Claim validator role in genesis
join Initialize node and join existing network
start Start sekaid (with optional restart)
status Show node and network status
version Show scaller version

Usage Examples

# Initialize a new node
docker exec sekin-sekai-1 /scaller init --chain-id testnet-1 --moniker MyNode

# Join an existing network
docker exec sekin-sekai-1 /scaller join \
  --chain-id kira-1 \
  --rpc "https://rpc.kira.network:26657" \
  --moniker MyNode

# Start sekaid (replaces process)
docker exec sekin-sekai-1 /scaller start

# Start with auto-restart (up to 5 retries)
docker exec sekin-sekai-1 /scaller start --restart 5

# Start with auto-restart (max 10 retries)
docker exec sekin-sekai-1 /scaller start --restart always

# Check node status (defaults: rpc=localhost:26657, interx=proxy.local:8080)
docker exec sekin-sekai-1 /scaller status

Status Output

The status command displays a table showing:

Field Description
Sekai Node health (OK/SYNCING/DOWN) and block height
Interx Interx service health
Peers Number of connected peers
Node ID Unique node identifier (for peer connections)
Chain Network chain ID
Moniker Node's moniker name
Validator Validator status and voting power

Example output:

SERVICE     STATUS   DETAIL
----------  -------  ------------------------------
Sekai       [+] OK     height 12345
Interx      [+] OK     responding
Peers       [+] OK     5 connected
Node ID     [ ] INFO   a1b2c3d4e5f6...
Chain       [ ] INFO   kira-1
Moniker     [ ] INFO   MyNode
Validator   [+] OK     power 100

Monitoring and Maintenance

View Service Status

# Check blockchain status via RPC
curl http://localhost:26657/status

# Check node status with scaller
docker exec sekin-sekai-1 /scaller status

# Check scaller version
docker exec sekin-sekai-1 /scaller version

Access Logs

Logs are centralized in ./syslog-data/:

# View all logs
ls -lh ./syslog-data/

# Tail specific service logs
tail -f ./syslog-data/sekai.log
tail -f ./syslog-data/manager.log

Backup Data

# Backup blockchain data
tar -czf sekai-backup.tar.gz ./sekai/

# Backup MongoDB data
docker compose exec mongo mongodump --out /backup

Update Services

To update to newer versions, modify image tags in compose.yml and restart:

docker compose pull
docker compose up -d

Development

Source Code Structure

sekin/
├── src/
│   └── sCaller/         # Scaller CLI (node bootstrap & management)
├── manager/             # Interx Manager (P2P/HTTP)
├── proxy/               # Interx Proxy
├── worker/              # Interx Worker services
│   ├── cosmos/          # Cosmos indexer & interaction
│   ├── ethereum/        # Ethereum indexer & interaction
│   └── sai-storage-mongo/ # Storage service
├── scripts/             # Utility scripts
├── config/              # Configuration files
├── sekai.Dockerfile     # Sekai + Scaller image
├── syslog-ng.Dockerfile # Syslog-ng image
└── compose.yml          # Production compose file

Building from Source

Each component can be built independently using its respective Dockerfile:

# Build Sekai (includes scaller CLI)
docker build -f sekai.Dockerfile -t sekin/sekai:custom .

# Build Syslog-ng
docker build -f syslog-ng.Dockerfile -t sekin/syslog-ng:custom .

Troubleshooting

Services Not Starting

Check logs for errors:

docker compose logs <service-name>

Network Issues

Ensure the kiranet network exists:

docker network ls | grep kiranet
docker network inspect kiranet

Port Conflicts

Check for existing processes using required ports:

sudo netstat -tulpn | grep -E '26657|26656|8080'

Disk Space

Monitor disk usage:

df -h
docker system df

Clean up unused Docker resources:

docker system prune -a --volumes

Security Considerations

  • RPC endpoint (26657) is exposed to 0.0.0.0 by default. Change to 127.0.0.1 in production
  • Configure firewall rules to restrict access to sensitive ports
  • Regularly update all services to latest versions
  • Monitor logs for suspicious activity
  • Use strong passwords for MongoDB
  • Rotate signing keys periodically
  • Enable prometheus API to connect monitoring

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request to main

License

CC BY-NC-SA 4.0

Resources

About

images - deployment to docker registry

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors 5