开发者文档 SDK

3行代码接入子舟链区块链存证 · Python & JavaScript

🐍 Python SDK v0.1.0

pip install zizhou-chain

下载Gitee

🟨 JavaScript SDK v0.1.0

npm install zizhou-chain

下载Gitee

快速开始

Python

from zizhou_chain import ZizhouClient

client = ZizhouClient(base_url="https://art.z-zbc.com")
result = client.create_proof(
    file_path="artwork.jpg",
    title="洛神赋图",
    author="顾恺之"
)
# result.proof_id → "c7967ea3"
# result.tx_hash → "0x21b83c..."
# result.certificate_id → "ZZ-C7967EA3"

JavaScript

import { ZizhouClient } from 'zizhou-chain';

const client = new ZizhouClient({ baseUrl: 'https://art.z-zbc.com' });
const result = await client.createProof({
    file: fileBlob,
    title: '洛神赋图',
    author: '顾恺之'
});
// result.proofId, result.txHash, result.certificateId

API 概览

📝 create_proof()

创建区块链存证,返回证书编号和交易哈希

✅ verify_proof()

验证存证真伪,确认链上状态

🖼️ get_gallery()

获取公开作品列表

📊 get_chain_stats()

获取链上统计数据

核心特性

架构概览

┌──────────────┐     ┌──────────────┐     ┌──────────────┐
│  Python SDK   │     │   JS SDK     │     │  REST API    │
└──────┬───────┘     └──────┬───────┘     └──────┬───────┘
       │                    │                    │
       └────────────────────┼────────────────────┘
                            │
                   ┌────────▼────────┐
                   │  Nginx (HTTPS)  │
                   └────────┬────────┘
                            │
              ┌─────────────┼─────────────┐
              │             │             │
        ┌─────▼─────┐ ┌────▼────┐ ┌─────▼─────┐
        │ Flask API  │ │ Flask   │ │ Flask     │
        │ :8001 存证 │ │ :8002   │ │ :8003 积分│
        └─────┬─────┘ └────┬────┘ └─────┬─────┘
              │             │             │
              └──────┬──────┘─────────────┘
                     │
              ┌──────▼──────┐
              │ PostgreSQL  │
              └──────┬──────┘
                     │
              ┌──────▼──────┐
              │ Besu QBFT   │
              │ 8 Nodes     │
              └─────────────┘

链接