bsocial
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBSocial
BSocial
Complete on-chain social protocol for BSV blockchain. Posts, likes, follows, messages, reposts, and friend requests using BitcoinSchema.org standards.
这是适用于BSV区块链的完整链上社交协议。基于BitcoinSchema.org标准实现发帖、点赞、关注、消息、转发和好友请求功能。
When to Use
适用场景
- Create social content (posts, replies, reposts)
- Social actions (likes, follows, friend requests)
- Real-time messaging (channels, direct messages)
- Query social data by address or transaction
- 创建社交内容(帖子、回复、转发)
- 社交操作(点赞、关注、好友请求)
- 实时消息(频道、私信)
- 通过地址或交易查询社交数据
Create Operations
创建类操作
All create scripts require a funded WIF (Wallet Import Format) private key.
所有创建脚本都需要一个已充值的WIF(钱包导入格式)私钥。
Post
发帖
bash
bun run skills/bsocial/scripts/create-post.ts <wif> "Post content" [options]bash
bun run skills/bsocial/scripts/create-post.ts <wif> "Post content" [options]Options:
Options:
--channel <name> Post to a channel
--channel <name> Post to a channel
--url <url> Associate with URL
--url <url> Associate with URL
--tags <t1,t2> Comma-separated tags
--tags <t1,t2> Comma-separated tags
--dry-run Build tx without broadcasting
--dry-run Build tx without broadcasting
undefinedundefinedReply
回复
bash
bun run skills/bsocial/scripts/create-reply.ts <wif> <txid> "Reply content" [--tags <t1,t2>]bash
bun run skills/bsocial/scripts/create-reply.ts <wif> <txid> "Reply content" [--tags <t1,t2>]Like
点赞
bash
bun run skills/bsocial/scripts/create-like.ts <wif> <txid>bash
bun run skills/bsocial/scripts/create-like.ts <wif> <txid>Follow
关注
bash
bun run skills/bsocial/scripts/create-follow.ts <wif> <bapId>bash
bun run skills/bsocial/scripts/create-follow.ts <wif> <bapId>Repost
转发
bash
bun run skills/bsocial/scripts/create-repost.ts <wif> <txid> [--context <type> --value <val>]bash
bun run skills/bsocial/scripts/create-repost.ts <wif> <txid> [--context <type> --value <val>]Message
发送消息
bash
bun run skills/bsocial/scripts/create-message.ts <wif> "Message" [options]bash
bun run skills/bsocial/scripts/create-message.ts <wif> "Message" [options]Options:
Options:
--channel <name> Send to channel
--channel <name> Send to channel
--to <bapId> Direct message to user
--to <bapId> Direct message to user
undefinedundefinedFriend
添加好友
bash
bun run skills/bsocial/scripts/create-friend.ts <wif> <bapId>bash
bun run skills/bsocial/scripts/create-friend.ts <wif> <bapId>Read Operations
读取类操作
Query social data from the BMAP API.
从BMAP API查询社交数据。
Posts
帖子
bash
bun run skills/bsocial/scripts/read-posts.ts <address> [--limit 20] [--json]bash
bun run skills/bsocial/scripts/read-posts.ts <address> [--limit 20] [--json]Likes
点赞记录
bash
bun run skills/bsocial/scripts/read-likes.ts --address <addr>
bun run skills/bsocial/scripts/read-likes.ts --txid <txid>bash
bun run skills/bsocial/scripts/read-likes.ts --address <addr>
bun run skills/bsocial/scripts/read-likes.ts --txid <txid>Follows
关注列表
bash
bun run skills/bsocial/scripts/read-follows.ts <address> [--limit 100] [--json]bash
bun run skills/bsocial/scripts/read-follows.ts <address> [--limit 100] [--json]Messages
消息
bash
bun run skills/bsocial/scripts/read-messages.ts --channel <name>
bun run skills/bsocial/scripts/read-messages.ts --address <addr>bash
bun run skills/bsocial/scripts/read-messages.ts --channel <name>
bun run skills/bsocial/scripts/read-messages.ts --address <addr>Friends
好友列表
bash
bun run skills/bsocial/scripts/read-friends.ts <address> [--json]bash
bun run skills/bsocial/scripts/read-friends.ts <address> [--json]Protocol Stack
协议栈
[B Protocol] | [MAP Protocol] | [AIP Protocol]
content metadata signature- B Protocol: Binary content storage (text, media)
- MAP Protocol: Metadata key-value pairs (app, type, context)
- AIP Protocol: Author signature for verification
[B Protocol] | [MAP Protocol] | [AIP Protocol]
content metadata signature- B Protocol:二进制内容存储(文本、媒体)
- MAP Protocol:元数据键值对(应用、类型、上下文)
- AIP Protocol:用于验证的作者签名
Context Types
上下文类型
| Context | Use Case |
|---|---|
| Reply/like a transaction |
| Post/message to named channel |
| Target specific identity |
| Associate with external URL |
| 上下文 | 使用场景 |
|---|---|
| 回复/点赞交易 |
| 向指定频道发帖/发送消息 |
| 定位特定身份 |
| 关联外部URL |
Dependencies
依赖项
- - Transaction building
@bsv/sdk - - BSocial protocol templates
@bopen-io/templates
- - 交易构建工具
@bsv/sdk - - BSocial协议模板
@bopen-io/templates
API
API
Base URL:
https://bmap-api-production.up.railway.app基础URL:
https://bmap-api-production.up.railway.appREST Endpoints
REST端点
| Endpoint | Description |
|---|---|
| Posts by BAP ID |
| Feed for BAP ID |
| Likes for a post |
| Likes by user |
| Friends for BAP ID |
| Messages for user |
| Channel messages |
| 端点 | 描述 |
|---|---|
| 按BAP ID查询帖子 |
| 按BAP ID查询动态流 |
| 查询某帖子的点赞 |
| 查询某用户的点赞记录 |
| 查询某BAP ID的好友列表 |
| 查询某用户的消息 |
| 查询频道消息 |
Query API (fallback)
查询API(备选)
- Query:
/q/{collection}/{base64Query} - SSE:
/s/{collection}/{base64Query}
- 查询:
/q/{collection}/{base64Query} - SSE:
/s/{collection}/{base64Query}
Ingest
数据导入
- POST with
/ingest{ rawTx: tx.toHex() }
- 发送POST请求到,参数为
/ingest{ rawTx: tx.toHex() }
Friend Encryption
好友加密
Friend requests use Type42 key derivation with BRC-43 invoice numbers ().
2-friend-{sha256(friendBapId)}typescript
import { BAP } from "bsv-bap";
const bap = new BAP({ rootPk: wif });
const identity = bap.getId(bap.listIds()[0]);
// Get encryption pubkey for friend request
const friendPubKey = identity.getEncryptionPublicKeyWithSeed(friendBapId);
// Encrypt private message for friend
const ciphertext = identity.encryptWithSeed("secret message", friendBapId);
// Decrypt message from friend
const plaintext = identity.decryptWithSeed(ciphertext, friendBapId);A CLI is also available: (see skill).
npm install -g bsv-bapcreate-bap-identity好友请求使用Type42密钥派生算法,并结合BRC-43发票编号()。
2-friend-{sha256(friendBapId)}typescript
import { BAP } from "bsv-bap";
const bap = new BAP({ rootPk: wif });
const identity = bap.getId(bap.listIds()[0]);
// Get encryption pubkey for friend request
const friendPubKey = identity.getEncryptionPublicKeyWithSeed(friendBapId);
// Encrypt private message for friend
const ciphertext = identity.encryptWithSeed("secret message", friendBapId);
// Decrypt message from friend
const plaintext = identity.decryptWithSeed(ciphertext, friendBapId);同时提供CLI工具:(详见**** Skill)。
npm install -g bsv-bapcreate-bap-identitySee Also
另请参阅
- - Full schema reference
references/schemas.md - BitcoinSchema.org - Protocol specs
- - 完整的Schema参考文档
references/schemas.md - BitcoinSchema.org - 协议规范