目录

SFChain - Software Factory Blockchain Attestation Platform

SFChain is a blockchain-based operation attestation system for software factories, implementing a parallel blockchain architecture with four node types (Management, Development, Testing, Operations). It is specifically designed for recording and managing various operation logs throughout the software development lifecycle.

Features

  • 🏢 Multi-Node Types: Four node types - Management, Development, Testing, and Operations
  • Secure Signing: ECDSA-based digital signature and verification
  • Parallel Processing: Four chain types generating blocks in parallel
  • 📊 Differential Storage: Store data with different completeness levels based on node type
  • 🌐 Network Communication: gRPC-based inter-node communication
  • 🗄️ MySQL Support: Persistent storage with MySQL database

System Architecture

Node Types

Node Type Responsibilities Stored Content
Management Node Network coordination, block generation, signature aggregation Complete data from all four chains
Development Node Processing development-related transactions Full development chain data + block headers from other chains
Testing Node Processing testing-related transactions Full testing chain data + block headers from other chains
Operations Node Processing operations-related transactions Full operations chain data + block headers from other chains

Transaction Types

  1. Management Transactions: User permissions, system configuration, and other administrative operations
  2. Development Transactions: Code commits, builds, deployments, and other development activities
  3. Testing Transactions: Test case execution, test reports, and other testing activities
  4. Operations Transactions: System monitoring, fault handling, and other operations activities

Quick Start

Prerequisites

  • Go 1.21+
  • MySQL 8.0+

Clone and Build

git clone <repository-url>
cd sfchain
go mod download
go build -o sfchain ./cmd/sfchain/

Database Setup

Create the database and import the schema:

mysql -u root -p < mysql_schema.sql
mysql -u root -p < mysql_init_data.sql

Configuration

Edit the configuration file in configs/ directory:

  • configs/management-node.yaml - Management node configuration
  • configs/development-node.yaml - Development node configuration
  • configs/test-node.yaml - Testing node configuration
  • configs/operations-node.yaml - Operations node configuration

Run Nodes

  1. Start Management Node

    ./sfchain -config configs/management-node.yaml
  2. Start Other Node Types ```bash

    Development Node

    ./sfchain -config configs/development-node.yaml

Testing Node

./sfchain -config configs/test-node.yaml

Operations Node

./sfchain -config configs/operations-node.yaml


## API Endpoints

### Node Registration
```bash
POST /api/nodes/register
Content-Type: application/json

{
  "node_id": "dev-node-1",
  "node_type": "development",
  "address": "127.0.0.1:8081",
  "public_key": "pem-public-key-string"
}

Create Transaction

POST /api/transactions/create
Content-Type: application/json

{
  "tx_type": 2,
  "log_data": {
    "action": "code_commit",
    "user_id": "developer1",
    "details": "Fixed authentication bug"
  }
}

Health Check

GET /health

Project Structure

sfchain/
├── cmd/sfchain/          # Main program entry point
├── configs/              # Configuration files
├── internal/             # Internal packages
│   ├── consensus/        # Consensus related
│   ├── core/            # Core logic
│   ├── database/        # Database layer
│   └── network/         # Network communication
├── pkg/
│   ├── config/          # Configuration loading
│   ├── crypto/          # Cryptographic operations
│   └── types/           # Type definitions
└── mysql_schema.sql      # Database schema

Contributing

  1. Fork this project
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the MIT License. See the LICENSE file for details.

关于
36.8 MB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802032778号