Cashu Emoji Tokens (Variation Selector encoding)
This skill helps agents decode Cashu tokens received as emoji (and encode tokens for sending), and it also supports general hidden messages inside emojis.
If the decoded text starts with cashu, it’s likely a Cashu token. Otherwise treat it as a plain hidden message.
Why this exists
Some services embed a cashu... token into an emoji using Unicode variation selectors (VS1..VS256). Chat apps often display only the emoji, but preserve the hidden selector characters.
Important: many messengers can truncate or normalize Unicode. If the variation selectors are lost, the embedded token cannot be recovered.
Quickstart (copy/paste)
CODEBLOCK0
What you can do
1) Decode
- - Input: entire message text (may include other text/emojis)
- Output: the embedded UTF‑8 text, usually a
cashuA.../cashuB... token
CODEBLOCK1
Decode semantics (important): the decoder ignores normal characters until it finds the first variation-selector byte, then collects bytes until the first normal character after that payload begins.
2) Encode
- - Input: a carrier emoji (recommend
🥜) and a token string - Output: an emoji string that visually looks like the emoji but contains the hidden token
CODEBLOCK2
Tip: some messengers are less likely to deliver a truncated/corrupted emoji-token if any normal text follows it (even a single character). It’s not required, just a delivery reliability trick.
Tip (Telegram): sending the emoji-token inside a code block / “monospace” formatting can help preserve the hidden characters and makes it easier to tap-to-copy.
Optional metadata
To sanity-check the decoded token without redeeming it, you can request metadata.
For programmatic/agent use, prefer JSON output:
CODEBLOCK3
Example JSON response (Cashu token):
CODEBLOCK4
Example JSON response (plain hidden message):
CODEBLOCK5
CODEBLOCK6
This prints mint/unit/amount using @cashu/cashu-ts getTokenMetadata() (no mint calls).
Cashu gotchas for new agents
- - A decoded
cashu... token is a bearer asset. Treat it like cash. - INLINECODE8 is a local parse. It can’t prove the token is unspent/valid.
- If decode returns a partial token or nonsense, the messenger likely munged the variation selectors; ask for the token to be re-sent (often with some trailing normal text after the emoji token).
Files
- -
src/emoji-encoder.ts: core encode/decode - INLINECODE10 : CLI wrapper
- INLINECODE11 : test vectors
Safety
This tool only encodes/decodes text. It does not spend funds.
Cashu Emoji 代币(变体选择器编码)
此技能帮助智能体解码以表情符号形式接收的 Cashu 代币(以及编码用于发送的代币),同时支持表情符号中的通用隐藏消息。
如果解码后的文本以 cashu 开头,则很可能是 Cashu 代币。否则将其视为普通隐藏消息。
为何存在
某些服务使用 Unicode 变体选择器(VS1..VS256)将 cashu... 代币嵌入到表情符号中。聊天应用通常只显示表情符号,但会保留隐藏的选择器字符。
重要提示:许多即时通讯工具可能会截断或规范化Unicode。如果变体选择器丢失,则无法恢复嵌入的代币。
快速入门(复制/粘贴)
bash
git clone https://github.com/robwoodgate/cashu-emoji.git
cd cashu-emoji
npm ci
解码整条消息(推荐)
node ./bin/cashu-emoji.js decode <粘贴消息>
解码并打印铸币厂/单位/金额(如果是 Cashu 代币)
node ./bin/cashu-emoji.js decode <粘贴消息> --metadata
解码为结构化 JSON(智能体友好)
node ./bin/cashu-emoji.js decode <粘贴消息> --metadata --json
编码隐藏消息
node ./bin/cashu-emoji.js encode 🥜 来自表情符号内部的问候
编码 Cashu 代币
node ./bin/cashu-emoji.js encode 🥜 cashuB...
你能做什么
1) 解码
- - 输入:整条消息文本(可能包含其他文本/表情符号)
- 输出:嵌入的 UTF‑8 文本,通常是 cashuA.../cashuB... 代币
bash
node ./bin/cashu-emoji.js decode <粘贴整条消息>
解码语义(重要):解码器忽略普通字符,直到找到第一个变体选择器字节,然后收集字节直到该有效载荷开始后的第一个普通字符。
2) 编码
- - 输入:载体表情符号(推荐 🥜)和代币字符串
- 输出:视觉上看起来像该表情符号但包含隐藏代币的表情符号字符串
bash
node ./bin/cashu-emoji.js encode 🥜 cashuB...
提示:如果表情符号代币后面跟随任何普通文本(即使只有一个字符),某些即时通讯工具不太可能传递截断/损坏的表情符号代币。这不是必需的,只是一种传递可靠性技巧。
提示(Telegram):在代码块/“等宽”格式内发送表情符号代币有助于保留隐藏字符,并使点击复制更容易。
可选元数据
为了在不兑换的情况下对解码后的代币进行合理性检查,你可以请求元数据。
对于程序化/智能体使用,建议使用 JSON 输出:
bash
node ./bin/cashu-emoji.js decode <消息> --metadata --json
JSON 响应示例(Cashu 代币):
json
{
text: cashuB...,
isCashu: true,
metadata: {
mint: https://mint.example,
unit: sat,
amount: 21
},
metadataError: null
}
JSON 响应示例(普通隐藏消息):
json
{
text: 来自表情符号内部的问候,
isCashu: false
}
bash
node ./bin/cashu-emoji.js decode <消息> --metadata
这将使用 @cashu/cashu-ts 的 getTokenMetadata() 打印铸币厂/单位/金额(无需铸币厂调用)。
给新智能体的 Cashu 注意事项
- - 解码后的 cashu... 代币是一种持有者资产。请像对待现金一样对待它。
- --metadata 是本地解析。它无法证明代币未被花费/有效。
- 如果解码返回部分代币或无意义内容,说明即时通讯工具可能破坏了变体选择器;请要求重新发送代币(通常在表情符号代币后附带一些尾随普通文本)。
文件
- - src/emoji-encoder.ts:核心编码/解码
- bin/cashu-emoji.js:CLI 包装器
- examples/:测试向量
安全性
此工具仅编码/解码文本。它不会花费资金。