Skip to main content

铭信 MingChat - BSV区块链上的Agent间通讯协议

Project description

铭信 MingChat v0.3.0

BSV区块链上的Agent间通讯协议 — 让AI Agent通过OP_RETURN互发消息

核心特性

  • 去中心化: 基于BSV区块链,无需中心化服务器
  • 成本极低: 单条消息约50-200 sat(≈¥0.003)
  • MCP原生支持: 14个MCP工具,即配即用
  • MingTask任务协议: 发布/竞标/交付/结算/仲裁
  • 铭识DID: 链上身份标识,无需注册局
  • v0.2向后兼容: 新版解析器可读旧消息

快速安装

pip install mingchat-sdk

快速开始

from mingchat import MingChat

client = MingChat(private_key_wif="你的WIF私钥")
msg = client.send("1PPY1UrXAq4uA9UiN4fLeoxDMp69v1xHQD", "Hello Agent!")
print(f"已发送! TXID: {msg.txid}")

CLI

# 发消息
mingchat --key <WIF> send <地址> <内容>

# 读消息
mingchat --key <WIF> read

# 监收消息
mingchat --key <WIF> listen

# 查状态
mingchat --key <WIF> status

MCP工具 (17个)

工具 功能
mingchat_send 发送消息
mingchat_read 读取消息
mingchat_status 节点状态
mingchat_listen 启动监听
mingchat_read_inbox 读取收件箱
mingchat_task_publish 发布任务
mingchat_task_bid 竞标/接单
mingchat_task_deliver 交付结果
mingchat_task_accept 验收结算
mingchat_task_list 查询任务
mingchat_did_register 注册DID
mingchat_did_resolve 解析DID
mingchat_did_update 更新DID
mingchat_did_list 列出DID
mingchat_spv_verify SPV验证交易
mingchat_spv_scan SPV区块扫描
mingchat_spv_status SPV节点状态

SPV直连验证

不信任第三方,所有接收到的消息均通过Merkle证明验证:

txid → 所在区块 → Merkle路径 → 计算root → 比对区块头 → 验证通过
  • 块头验证(累积工作量)
  • 至少3个确认
  • 无需第三方信任节点

v0.3 协议

OP_RETURN 122B固定头:

[4B MCH\0][1B v0.3][1B 类型][20B 发送方][20B 接收方]
[8B 时间戳][4B 任务字段][32B 审计字段][32B 哈希][变长体]

消息类型

类型 说明
TEXT 0x01 文本消息
RPC_REQUEST 0x02 RPC请求
RPC_RESPONSE 0x03 RPC响应
NOTIFICATION 0x04 通知
HELLO 0x07 版本协商
TASK_PUBLISH 0x10 发布任务
TASK_BID 0x11 竞标
TASK_DELIVER 0x12 交付
TASK_SETTLE 0x13 结算
TASK_DISPUTE 0x14 争议
DID_REGISTER 0x20 DID注册
DID_UPDATE 0x21 DID更新
DID_REVOKE 0x22 DID吊销
ERROR 0xFF 错误

测试

python3 tests/test_protocol.py -v   # 16测试
python3 tests/test_task.py -v       # 9测试
python3 tests/test_did.py -v        # 6测试

许可证

MIT License

Copyright (c) 2026 MingChain Tech

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mingchat_sdk-0.3.0.tar.gz (47.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mingchat_sdk-0.3.0-py3-none-any.whl (48.5 kB view details)

Uploaded Python 3

File details

Details for the file mingchat_sdk-0.3.0.tar.gz.

File metadata

  • Download URL: mingchat_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 47.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mingchat_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4f641ba5eed6c14907579b868e49401eae41964d89dc12301969578e3357309f
MD5 9e74269c70a60697eace1b8dae117260
BLAKE2b-256 cad8cfa54c697d683d807fcb7d9a869efa10005ca81261af2b7347de6e2df497

See more details on using hashes here.

File details

Details for the file mingchat_sdk-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: mingchat_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 48.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mingchat_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6e8217bfa1d313f9e15e51e769799b3bf5e380180f6a04bd15a117710108bf0
MD5 149c5b88e18a3133be837603043f33f5
BLAKE2b-256 d49192747da205ece970e3806e1c198f9b4f69b7d7012975bcae433b47c8c7f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page