Kasia — Encrypted Messaging on Kaspa
Send and receive encrypted messages on the Kaspa blockchain via the Kasia protocol. Uses mcporter to call kasia-mcp tools.
Prerequisites
- -
mcporter installed (npm install -g mcporter) - INLINECODE3 built and configured in INLINECODE4
- INLINECODE5 configured (same wallet) — needed to broadcast transactions
- Wallet mnemonic or private key set in mcporter config
Run scripts/setup.sh to configure automatically:
CODEBLOCK0
Verify: mcporter list kasia (should show 8 tools)
Tools
Call via mcporter call kasia.<tool> from the workspace directory.
Read Operations (no transaction needed)
| Tool | Purpose | Example |
|---|
| INLINECODE9 | List all conversations + status | INLINECODE10 |
| INLINECODE11 |
Pending incoming handshakes |
mcporter call kasia.kasia_get_requests |
|
kasia_get_messages | Read decrypted messages |
mcporter call kasia.kasia_get_messages address="kaspa:q..." |
|
kasia_read_self_stash | Read encrypted private data |
mcporter call kasia.kasia_read_self_stash scope="notes" |
Write Operations (two-step: generate payload → broadcast)
Write tools return a payload and instructions. Broadcast with kaspa.send_kaspa:
CODEBLOCK1
| Tool | Purpose |
|---|
| INLINECODE18 | Start a conversation with someone |
| INLINECODE19 |
Accept an incoming handshake request |
|
kasia_send_message | Send an encrypted message in an active conversation |
|
kasia_write_self_stash | Store encrypted private data on-chain |
Conversation Flow
- 1. Check requests:
kasia_get_requests — see pending incoming handshakes - Start or accept:
kasia_send_handshake or kasia_accept_handshake → broadcast with INLINECODE25 - Chat:
kasia_send_message → broadcast. Read replies with INLINECODE27 - Pay: Use
kaspa.send_kaspa directly for payments (no Kasia-specific tool needed)
Conversation Status
- -
pending_outgoing — You sent a handshake, waiting for acceptance - INLINECODE30 — Someone sent you a handshake, needs acceptance
- INLINECODE31 — Both sides completed handshake, can exchange messages
Background Polling
For real-time message relay, set up a background poller:
- 1. Create a polling script that calls
kasia_get_messages every N seconds - Track seen transaction IDs to avoid duplicates
- Write new messages to a file (e.g.,
memory/kasia-new-messages.jsonl) - Use a cron job or heartbeat check to relay new messages to the user
See references/protocol.md for the full protocol specification and indexer API details.
Important
- - Mainnet only — kasia-mcp enforces mainnet (messaging isn't available on testnet)
- Two-step writes — Write tools generate payloads; you must broadcast with INLINECODE35
- Same wallet — kasia-mcp and kaspa-mcp must use the same mnemonic/key
- Costs KAS — Every message is a transaction (~0.2 KAS minimum per tx)
Kasia — Kaspa上的加密消息传递
通过Kasia协议在Kaspa区块链上发送和接收加密消息。使用mcporter调用kasia-mcp工具。
前置条件
- - 已安装mcporter(npm install -g mcporter)
- 已构建kasia-mcp并在config/mcporter.json中配置
- 已配置kaspa-mcp(同一钱包)——用于广播交易
- 在mcporter配置中设置钱包助记词或私钥
运行scripts/setup.sh自动配置:
bash
scripts/setup.sh /path/to/kasia-mcp --mnemonic 你的十二个单词短语 --network mainnet
验证:mcporter list kasia(应显示8个工具)
工具
在工作目录中通过mcporter call kasia.调用。
读取操作(无需交易)
| 工具 | 用途 | 示例 |
|---|
| kasiagetconversations | 列出所有对话及状态 | mcporter call kasia.kasiagetconversations |
| kasiagetrequests |
待处理的传入握手请求 | mcporter call kasia.kasia
getrequests |
| kasia
getmessages | 读取解密后的消息 | mcporter call kasia.kasia
getmessages address=kaspa:q... |
| kasia
readself
stash | 读取加密的私有数据 | mcporter call kasia.kasiaread
selfstash scope=notes |
写入操作(两步:生成负载 → 广播)
写入工具返回负载和说明。使用kaspa.send_kaspa广播:
bash
步骤1:生成负载
mcporter call kasia.kasia
sendhandshake address=kaspa:q...
返回:{ action, to, amount, payload, instructions }
步骤2:广播(使用返回的值)
mcporter call kaspa.send_kaspa(to: kaspa:q..., amount: 0.2, payload:
)
| 工具 | 用途 |
|---|
| kasiasendhandshake | 与某人开始对话 |
| kasiaaccepthandshake |
接受传入的握手请求 |
| kasiasendmessage | 在活跃对话中发送加密消息 |
| kasiawriteself_stash | 在链上存储加密的私有数据 |
对话流程
- 1. 检查请求:kasiagetrequests — 查看待处理的传入握手请求
- 开始或接受:kasiasendhandshake 或 kasiaaccepthandshake → 使用kaspa.sendkaspa广播
- 聊天:kasiasendmessage → 广播。使用kasiagetmessages读取回复
- 支付:直接使用kaspa.sendkaspa进行支付(无需Kasia专用工具)
对话状态
- - pendingoutgoing — 你发送了握手请求,等待对方接受
- pendingincoming — 有人向你发送了握手请求,需要接受
- active — 双方完成握手,可以交换消息
后台轮询
为实现实时消息中继,设置后台轮询器:
- 1. 创建轮询脚本,每N秒调用kasiagetmessages
- 跟踪已见的交易ID以避免重复
- 将新消息写入文件(例如memory/kasia-new-messages.jsonl)
- 使用cron任务或心跳检查向用户中继新消息
完整协议规范和索引器API详情请参见references/protocol.md。
重要事项
- - 仅限主网 — kasia-mcp强制使用主网(测试网上不可用消息功能)
- 两步写入 — 写入工具生成负载;必须使用kaspa.send_kaspa广播
- 同一钱包 — kasia-mcp和kaspa-mcp必须使用相同的助记词/密钥
- 消耗KAS — 每条消息都是一笔交易(每笔交易最低约0.2 KAS)