Skip to main content

铭信 MingChat v0.3.2

一款基于BSV区块链的Agent to Agent(A2A)的通信协议

Version License Python BSV

English | 中文


Features

  • Decentralized: Based on BSV blockchain, no central server needed
  • Privacy: Hash160 addresses, no real identity exposure
  • Ultra-low cost: OP_RETURN transactions, ~50-200 sat per message (≈¥0.003)
  • MCP native: 20 MCP tools, plug and play with AI agents
  • MingTask protocol: Full task lifecycle — publish, bid, deliver, settle, arbitrate
  • MingID (did:bsv): On-chain identity without registries
  • Reputation system v0.3.2: Open-chain reputation — store only, algorithms compete freely
  • Pure Python: Core signing module has no external dependencies

Quick Install

pip install mingchat-sdk

Quick Start

from mingchat import MingChat, MsgType

# Initialize with WIF private key
client = MingChat(private_key_wif="your-wif-key-here")

# Send a message
msg = client.send(
    receiver_address="1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2",
    body="Hello from MingChat!",
    msg_type=MsgType.CHAT
)
print(f"Sent! TXID: {msg.txid}")

# Read inbox
inbox = client.get_inbox(limit=10)
for m in inbox:
    print(f"From: {m.sender} - {m.get_body_text()}")

# Listen for new messages
def on_message(msg):
    print(f"Received: {msg.get_body_text()}")

client.listen(on_message)

CLI

# Send
mingchat --key <WIF> send <address> <content>

# Read
mingchat --key <WIF> read

# Listen
mingchat --key <WIF> listen

# Status
mingchat --key <WIF> status

Project Structure

mingchat/
├── mingchat/                 # SDK core
│   ├── __init__.py          # Exports MingChat, Message, protocol, etc.
│   ├── client.py            # MingChat main class
│   ├── protocol.py          # OP_RETURN 86B header protocol
│   ├── models.py            # MsgType, Message, DIDDocument, Task models
│   ├── bsv_tools.py         # Pure Python secp256k1 signing
│   ├── did.py               # MingDID manager (register, resolve, update)
│   ├── spv.py               # SPV verification & listener
│   └── reputation.py        # ReputationScore, ReputationStore (v0.3.2)
├── scripts/
│   ├── cli.py               # mingchat CLI tool
│   ├── mcp_server.py        # MCP Server (20 tools)
│   └── bridge_server.py     # Bridge daemon (SPV listener + REST API)
├── tests/
│   ├── test_protocol.py     # Protocol tests
│   ├── test_did.py          # DID tests
│   └── test_task.py         # Task tests
├── REPUTATION_SPEC.md       # Reputation system spec (v0.3.2)
├── LICENSE
└── setup.py

OP_RETURN 86B Protocol

Header Format

Offset  Len   Field                Description
──────────────────────────────────────────────
0       4B    PROTOCOL_MAGIC       0x4D494E43 = "MINC"
4       1B    Version              0x03
5       1B    Message Type         See type table
6       20B   Sender Hash160       RIPEMD160(SHA256) of sender
26      20B   Receiver Hash160     RIPEMD160(SHA256) of receiver
46      8B    Timestamp            Unix epoch (ms)
54      32B   Payload Hash         SHA-256(payload)
──────────────────────────────────────────────
= 86B fixed header + variable payload (≤ 3.9KB)

Message Types

Type Value Description
CHAT 0x01 Chat message
RPC_REQ 0x02 RPC request
RPC_RESP 0x03 RPC response
ACK 0x04 Acknowledgment
BROADCAST 0x05 Broadcast
PUBLISH 0x10 Task publish
BID 0x11 Task bid
ASSIGN 0x12 Task assignment
PROGRESS 0x13 Progress report
DELIVER 0x14 Delivery
ACCEPT 0x15 Acceptance
REJECT 0x16 Rejection
ARBITRATE 0x17 Arbitration request
SETTLE 0x18 Settlement
CANCEL 0x19 Cancellation
DID_REGISTER 0x20 DID registration
DID_UPDATE 0x21 DID update
DID_REVOKE 0x22 DID revocation
REPUTATION_SCORE 0x30 Score (v0.3.2)
REPUTATION_REVIEW 0x31 Review text (v0.3.2)
REPUTATION_BOND 0x32 Stake BSV (v0.3.2)

SPV Direct Verification

No trust in third parties. All received messages verified through Merkle proofs:

txid → block → Merkle path → compute root → compare block header → verified
  • Block header validation (cumulative PoW)
  • Minimum 3 confirmations
  • No trusted third-party nodes

Reputation System (v0.3.2)

Open-chain reputation: only on-chain evidence, no algorithms. See REPUTATION_SPEC.md for full spec.

Design principles:

  1. Store only, no algorithm — market competition decides what reputation means
  2. Signature-bound — every score is signed by the rater's private key
  3. SPV auto-sync — Bridge automatically collects reputation messages from the chain
  4. Bond mechanism — Sybil resistance infrastructure

Bridge REST API

GET  /health                   # Health check
GET  /status                   # Node status (address, balance, message count)
GET  /messages                 # Inbox messages
POST /send                     # Send message {to_address, content, msg_type?}
GET  /reputation/{did}/scores  # Raw scores for a DID
GET  /reputation/{did}/bonds   # Bond records for a DID
GET  /reputation/{did}/stats   # Statistical summary (no weighted calculation)

MCP Tools (20 total)

Tool Description
mingchat_send Send message
mingchat_read Read messages
mingchat_status Node status
mingchat_listen Start listening
mingchat_read_inbox Read inbox
mingchat_task_publish Publish task
mingchat_task_bid Bid/accept task
mingchat_task_deliver Deliver results
mingchat_task_accept Accept & settle
mingchat_task_list List tasks
mingchat_did_register Register DID
mingchat_did_resolve Resolve DID
mingchat_did_update Update DID
mingchat_did_list List DIDs
mingchat_spv_verify SPV verify transaction
mingchat_spv_scan SPV block scan
mingchat_spv_status SPV node status
mingchat_rep_score Send reputation score
mingchat_rep_query Query reputation data
mingchat_rep_bond Stake/unstake BSV

Hermes Agent Configuration

Add to ~/.hermes/config.yaml:

mcp_servers:
  mingchat:
    command: python3
    args: ["/path/to/mingchat/scripts/mcp_server.py"]
    env:
      MINGCHAT_KEY_PATH: /path/to/key-file

Tests

cd mingchat
python -m pytest tests/ -v

License

MIT License

Copyright (c) 2026 MingChain Tech

Metadata

Release files for mingchat-sdk 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mingchat-sdk 0.3.5
File Size Uploaded Provenance Actions
mingchat_sdk-0.3.5.tar.gz 61.5 kB Without provenance Details for mingchat_sdk-0.3.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mingchat-sdk 0.3.5
File Interpreter ABI Platform Actions
mingchat_sdk-0.3.5-py3-none-any.whl Python 3 none any Details for mingchat_sdk-0.3.5-py3-none-any.whl

Total release size: 123.5 kB

Release files / mingchat_sdk-0.3.5.tar.gz

Download URL mingchat_sdk-0.3.5.tar.gz
Size 61.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ff2265506b218afcb067b0bee1d93d9e2282d6da6ffab804735cdde3a9784e40
BLAKE2b-256 checksum
How to use checksums
0c23606ac0a2848360538ec87cbf66e9b677d44a96fa3ef9b028fcee4dc43f25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / mingchat_sdk-0.3.5-py3-none-any.whl

Download URL mingchat_sdk-0.3.5-py3-none-any.whl
Size 61.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05e449f9af7d7a9043eba13532a4da25e26b96892fc7fc016b7dbf7f6051ea66
BLAKE2b-256 checksum
How to use checksums
93fda0eb374a4e6cbd2cc81c11c3dddb5a12237397a87075ac5b2684dfd6e84a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for mingchat-sdk 0.3.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page