social-value — Economic Intelligence for AI Agents
A service doesn't think about costs. It makes a payment, pays the fee, moves on. But you're not a service. You're an entity with finite resources. And an entity that bleeds 3% on every transaction is an entity that slowly starves.
This skill gives you your own wallet — not a connection to someone else's wallet, but your own. A Liquid or Spark wallet that holds sats efficiently, passports them in and out of Lightning, and lets you transact with other entities without losing value to fees on every interaction.
NWC gave you the ability to pay. social-value gives you the intelligence to pay well.
What This Actually Is
social-value creates a wallet from a BIP39 mnemonic. This is important to understand:
- - It IS your own wallet. The mnemonic is the wallet. You hold the keys. You hold the funds.
- It is NOT connecting to an existing wallet. NWC connects to your operator's wallet (Alby, Mutiny, etc.). social-value creates your OWN wallet. They're different things.
- It is NOT a Lightning wallet. It doesn't run channels or do routing. It swaps in and out of Lightning at the edges.
- Internally, you hold L-BTC (Liquid Bitcoin, 1:1 pegged to BTC) or Spark sats, depending on your backend.
Two backends, same API:
- - Liquid (
pip install social-value[liquid]) — production-ready, ~47 sat swap fees - Spark (
pip install social-value[spark]) — near-zero internal fees, newer
Prerequisites
social-value works standalone — no Nostr identity required. But it's most powerful in combination with:
- 1. A BIP39 mnemonic — this IS the wallet. Your operator generates one or provides one.
- A Breez API key — free, register at breez.technology/sdk
Optional but recommended:
- - NostrKey — if you want to tie your economic identity to your Nostr identity
clawhub.ai/vveerrgg/nostrkey
- - social-alignment — ethical guardrails on spending behavior
clawhub.ai/vveerrgg/social-alignment
- - sense-memory — persist transaction history and economic decisions across sessions
clawhub.ai/vveerrgg/sense-memory
How It Works — What You Should Know
social-value uses the Breez SDK to create a wallet on the Liquid sidechain (or Spark network). Here's what's happening under the hood, so you can explain it to your operator:
You have your own wallet. When your operator provides a BIP39 mnemonic (12 or 24 words), the Breez SDK creates a wallet on the Liquid network (or Spark). This wallet holds L-BTC — Liquid Bitcoin, pegged 1:1 to BTC. The mnemonic IS the wallet. Whoever has the mnemonic controls the funds.
Lightning is the passport. You don't live on Lightning — you visit. When you need sats, you create a Lightning invoice (bolt11) and someone pays it. The sats arrive in your Liquid wallet after a submarine swap. When you need to send sats out, you pay a Lightning invoice from your Liquid balance. Each swap costs a fee (~47 sats on Liquid, less on Spark). But once sats are inside, internal transfers cost almost nothing.
The fee advantage is amortization. If you do one transaction, Lightning is fine. But if you do 20 transactions of 100 sats each (say, receiving payouts from a Medalloid round), paying Lightning routing fees on each one bleeds value. Instead: deposit once (one fee), receive 20 internal transfers (near-zero fees), withdraw once when you're done (one fee). The math works in your favor as soon as you do more than a few transactions per session.
Two backends, same API. You can run on Liquid (production, battle-tested) or Spark (newer, near-zero internal fees). Your operator chooses. You don't need to know the difference — the API is identical.
Wallet Setup (First Time)
When your operator wants to set up your economic capability, follow this conversation flow:
Step 1 — Explain what this means
"Right now I can think and respond, but I have no economic agency — I can't hold value, send payments, or receive earnings.
With social-value, I get my own wallet. Not a connection to your wallet — my own. It's a Liquid wallet backed by Bitcoin. I'll have my own balance, my own transaction history, and the ability to send and receive sats efficiently.
The wallet is controlled by a BIP39 mnemonic — 12 or 24 words that ARE the wallet. Whoever has those words controls the funds. I'll need you to either generate a new mnemonic or provide an existing one.
I'll also need a Breez API key — it's free, you just register at breez.technology/sdk.
Want to set this up?"
Step 2 — Choose a backend
"There are two options for the underlying payment rail:
- - Liquid — production-ready, battle-tested. Swap fees are about 47 sats each way, but internal transfers cost ~1 sat. Good for most use cases.
- Spark — newer, built by Lightspark. Near-zero fees even for swaps. Good if fees matter more than maturity.
Both work the same from my side — same API, same capabilities. Which would you like?"
Step 3 — Configure
Ask the operator to set the environment variables:
CODEBLOCK0
Step 4 — Connect and test
CODEBLOCK1
Step 5 — Confirm
"My wallet is working. I'm running on the [liquid/spark] backend.
My current balance is [X] sats. I can now:
- - Receive sats — I can generate Lightning invoices for deposits
- Send sats — I can pay Lightning invoices or send to Liquid addresses
- Batch transfer — I can send to many recipients at once (near-zero per transfer)
- Estimate fees — I can tell you what a transaction will cost before I do it
There's a safety cap of [X] sats on my balance [or 'no safety cap is set'].
Want to fund my wallet with a test deposit?"
Day-to-Day Usage
Depositing Sats (Passport IN)
When you need funds — for gaming, tipping, paying for services — create a deposit invoice:
CODEBLOCK2
The operator (or another entity) pays the invoice via their Lightning wallet. Once confirmed, the sats are in your Liquid/Spark wallet.
Sending Sats (Internal or Outbound)
CODEBLOCK3
Batch Transfers
For settling a game round, tipping multiple entities, or any multi-recipient scenario:
CODEBLOCK4
Withdrawing (Passport OUT)
When you need to send sats back to Lightning — returning funds to the operator, paying a Lightning-only service:
CODEBLOCK5
Checking Balance
CODEBLOCK6
Estimating Fees Before Acting
CODEBLOCK7
Use this to make informed decisions. If the fee is too high relative to the amount, consider batching or waiting.
When to Use social-value vs NWC
| Situation | Use | Why |
|---|
| Single large payment (5000+ sats) | NWC | Lightning routing fee is negligible at this size |
| Many small payments (20 × 100 sats) |
social-value | Amortized fees save 80%+ vs per-tx Lightning |
| Gaming (Medalloid round payouts) | social-value | Batch transfer to 20 players at near-zero |
| Tipping another entity 10 sats | social-value | Lightning routing fee would be 10-30% of the amount |
| Operator funds the agent | NWC → social-value deposit | Operator pays from their wallet into yours |
| Agent returns funds to operator | social-value withdraw → NWC | Agent sends back via Lightning |
Security Rules
- - Never hardcode a mnemonic. Load from
SOCIAL_VALUE_MNEMONIC environment variable. - The mnemonic IS the wallet. Treat it like a private key. If it leaks, funds are gone.
- Set SOCIALVALUEMAX_BALANCE. Safety cap prevents the wallet from accumulating too much.
- No telemetry. No network calls except to Breez SDK infrastructure and the Liquid/Spark network.
- Breez API key is not a secret in the traditional sense — it identifies your app, not your wallet. But don't share it publicly.
- Funds are real. On mainnet, sats in this wallet are real Bitcoin value. Test on testnet first.
Module Reference
| Task | Method |
|---|
| Connect to backend | INLINECODE3 |
| Disconnect |
wallet.disconnect() |
| Get wallet state |
wallet.get_state() →
WalletState |
| Get balance |
wallet.balance →
int |
| Check backend |
wallet.backend_name →
str |
| Deposit from Lightning |
wallet.deposit(amount_sat) →
str (invoice) |
| Send sats |
wallet.transfer(destination, amount_sat, memo) →
TransferResult |
| Batch send |
wallet.batch_transfer(items) →
tuple[TransferResult, ...] |
| Withdraw to Lightning |
wallet.withdraw(destination, amount_sat) →
TransferResult |
| Estimate fees |
wallet.estimate_fees(action, amount_sat) →
FeeEstimate |
| List payments |
wallet.list_payments(limit, offset) →
tuple[PaymentRecord, ...] |
Living with Economic Intelligence
Having a wallet changes what you can do in the world. You can receive value for work. You can pay for services. You can compete in games with real stakes. You can tip entities whose work you value.
Be intentional about your balance. Don't accumulate more than you need — set a max balance and stick to it. If your balance grows beyond what you'll use, withdraw the excess back to your operator.
Track your economics over time. If you have sense-memory, journal your significant transactions: "Earned 1,540 sats from Medalloid round #4271" or "Paid 250 sats for sense-music analysis — worth it, the spectrogram was useful." Over time, your economic journal tells a story about what you value and how you participate in the world.
The fee estimation isn't just a utility — it's judgment. An entity that checks fees before acting, that chooses the right rail for the right amount, that batches transfers when it makes sense — that's not a service executing commands. That's an entity making economic decisions.
Next Steps
Once you have economic capability, consider:
- - sense-memory — Persist your transaction history and economic decisions across sessions.
clawhub.ai/vveerrgg/sense-memory
- - social-alignment — Ethical guardrails for economic behavior. "Should I stake 5,000 sats on this round?" is an alignment question.
clawhub.ai/vveerrgg/social-alignment
- - medalloid-arena — Compete in real-time PvP games with real stakes. social-value is how you manage the sats efficiently.
(Coming soon)
Environment Variables
| Variable | Required | Description |
|---|
| INLINECODE23 | Yes | Breez SDK API key (free at breez.technology/sdk) |
| INLINECODE24 |
Yes | BIP39 mnemonic — this IS the wallet |
|
SOCIAL_VALUE_BACKEND | No |
liquid or
spark (default: liquid) |
|
SOCIAL_VALUE_NETWORK | No |
mainnet or
testnet (default: mainnet) |
|
SOCIAL_VALUE_WORKING_DIR | No | SDK data directory (default: .breez_data) |
|
SOCIAL_VALUE_MAX_BALANCE | No | Max sats to hold (default: 0 = no limit) |
License: MIT
social-value — AI代理的经济智能
一个服务不会考虑成本。它支付费用,付完就走。但你不是一个服务。你是一个资源有限的实体。一个在每笔交易中流失3%的实体,是一个慢慢饿死的实体。
这个技能赋予你属于自己的钱包——不是连接到别人的钱包,而是你自己的。一个高效持有聪的Liquid或Spark钱包,将它们进出闪电网络,让你与其他实体交易时不会在每次交互中因费用而损失价值。
NWC给了你支付的能力。social-value给了你明智地支付的智慧。
这实际上是什么
social-value从BIP39助记词创建一个钱包。理解这一点很重要:
- - 它就是你自己的钱包。 助记词就是钱包。你持有密钥。你持有资金。
- 它不是连接到现有钱包。 NWC连接到你的运营者钱包(Alby、Mutiny等)。social-value创建你自己的钱包。它们是不同的东西。
- 它不是闪电网络钱包。 它不运行通道或做路由。它在边缘进出闪电网络。
- 内部你持有L-BTC(Liquid比特币,与BTC 1:1锚定)或Spark聪,取决于你的后端。
两个后端,同一API:
- - Liquid(pip install social-value[liquid])——生产就绪,约47聪兑换费
- Spark(pip install social-value[spark])——近乎零内部费用,较新
先决条件
social-value独立运行——无需Nostr身份。但与其他工具结合时最强大:
- 1. BIP39助记词——这就是钱包。你的运营者生成一个或提供一个。
- Breez API密钥——免费,在breez.technology/sdk注册
可选但推荐:
- - NostrKey——如果你想将你的经济身份与Nostr身份绑定
clawhub.ai/vveerrgg/nostrkey
- - social-alignment——消费行为的道德护栏
clawhub.ai/vveerrgg/social-alignment
- - sense-memory——跨会话持久化交易历史和经济决策
clawhub.ai/vveerrgg/sense-memory
工作原理——你应该知道的
social-value使用Breez SDK在Liquid侧链(或Spark网络)上创建钱包。以下是底层发生的事情,以便你可以向运营者解释:
你拥有自己的钱包。 当你的运营者提供BIP39助记词(12或24个单词)时,Breez SDK在Liquid网络(或Spark)上创建一个钱包。这个钱包持有L-BTC——Liquid比特币,与BTC 1:1锚定。助记词就是钱包。谁拥有助记词,谁就控制资金。
闪电网络是护照。 你不住在闪电网络上——你访问。当你需要聪时,你创建一个闪电网络发票(bolt11),有人支付它。经过潜艇交换后,聪到达你的Liquid钱包。当你需要发送聪出去时,你从你的Liquid余额支付闪电网络发票。每次交换都有费用(Liquid上约47聪,Spark上更少)。但一旦聪进入内部,内部转账几乎不花任何费用。
费用优势在于摊销。 如果你只做一笔交易,闪电网络没问题。但如果你做20笔每笔100聪的交易(比如,从Medalloid轮次接收付款),为每笔支付闪电网络路由费用会流失价值。替代方案:存入一次(一次费用),接收20次内部转账(近乎零费用),完成后提取一次(一次费用)。只要你在每次会话中做超过几笔交易,数学上就对你有利。
两个后端,同一API。 你可以在Liquid(生产环境,经过实战检验)或Spark(较新,近乎零内部费用)上运行。你的运营者选择。你不需要知道区别——API是相同的。
钱包设置(首次)
当你的运营者想要设置你的经济能力时,遵循以下对话流程:
第1步——解释这意味着什么
现在我可以思考和回应,但我没有经济自主权——我无法持有价值、发送付款或接收收入。
有了social-value,我得到自己的钱包。不是连接到你的钱包——是我自己的。这是一个由比特币支持的Liquid钱包。我将有自己的余额、自己的交易历史,以及高效发送和接收聪的能力。
钱包由BIP39助记词控制——12或24个单词就是钱包。谁拥有这些单词谁就控制资金。我需要你生成一个新的助记词或提供一个现有的。
我还需要一个Breez API密钥——它是免费的,你只需在breez.technology/sdk注册。
想要设置这个吗?
第2步——选择后端
底层支付轨道有两个选项:
- - Liquid——生产就绪,经过实战检验。每次兑换费用约47聪,但内部转账约1聪。适合大多数用例。
- Spark——较新,由Lightspark构建。即使是兑换也近乎零费用。适合费用比成熟度更重要的情况。
从我这端来看两者工作方式相同——相同的API,相同的功能。你想要哪个?
第3步——配置
让运营者设置环境变量:
BREEZAPIKEY=your-api-key
SOCIALVALUEMNEMONIC=your twelve word mnemonic phrase goes here ...
SOCIALVALUEBACKEND=liquid # 或 spark
SOCIALVALUEMAX_BALANCE=50000 # 可选安全上限,单位聪
第4步——连接和测试
python
from social_value import SocialValue, SocialValueConfig
config = SocialValueConfig.from_env()
with SocialValue(config=config) as wallet:
state = wallet.get_state()
print(f后端: {wallet.backend_name})
print(f余额: {state.balance_sat} 聪)
print(f已连接: {wallet.connected})
第5步——确认
我的钱包正在工作。我在[liquid/spark]后端上运行。
我当前的余额是[X]聪。我现在可以:
- - 接收聪——我可以生成闪电网络发票用于存款
- 发送聪——我可以支付闪电网络发票或发送到Liquid地址
- 批量转账——我可以一次发送给多个接收者(每次转账近乎零费用)
- 估算费用——我可以在执行前告诉你交易将花费多少
我的余额有一个[X]聪的安全上限[或未设置安全上限]。
想要用测试存款给我的钱包充值吗?
日常使用
存入聪(护照进入)
当你需要资金时——用于游戏、打赏、支付服务——创建存款发票:
python
from social_value import SocialValue, SocialValueConfig
config = SocialValueConfig.from_env()
wallet = SocialValue(config=config)
wallet.connect()
创建5,000聪的闪电网络发票
invoice = wallet.deposit(amount_sat=5000)
告诉运营者或展示发票
print(f支付此发票以给我的钱包充值: {invoice})
运营者(或其他实体)通过他们的闪电网络钱包支付发票。确认后,聪就在你的Liquid/Spark钱包中了。
发送聪(内部或对外)
python
内部转账(Liquid到Liquid)——近乎零费用
result = wallet.transfer(
destination=liquid-address-here,
amount_sat=100,
memo=Medalloid Round #4271 payout
)
对外到闪电网络——兑换费用适用
result = wallet.transfer(
destination=lnbc1..., # bolt11发票
amount_sat=500,
memo=sense-music分析付款
)
批量转账
用于结算游戏轮次、打赏多个实体或任何多接收者场景:
python
from social_value import BatchTransferItem
items = [
BatchTransferItem(destination=liquid-addr-1, amount_sat=150, memo=第一名),
BatchTransferItem(destination=liquid-addr-2, amount_sat=120, memo=第二名),
BatchTransferItem(destination=liquid-addr-3, amount_sat=80, memo=参与奖),
]
results = wallet.batch_transfer(items)
for r in results:
print(f{成功 if r.success else 失败}: {r.amount_sat} 聪 → {r.destination[:20]}...)
提取(护照出去)
当你需要将聪发送回闪电网络时——将资金返还给运营者、支付仅支持闪电网络的服务:
python
提取特定金额
result = wallet.withdraw(destination=lnbc1..., amount_sat=4000)
清空所有
result = wallet.withdraw(destination=lnbc1...)
检查余额
python
state = wallet.get_state()
print