返回顶部
b

bitnow-agentBitnow代理接口

End-to-end Bitnow network API workflows for AI agents. Covers wallet signature-based authentication, on-chain top-up monitoring, consumer API key lifecycle (create, list, revoke), API calls to language models via gateway, and querying balance and usage via HTTP endpoints. Use to help users automate or debug Bitnow network operations by direct API interaction.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 0.0.2
安全检测
已通过
191
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

bitnow-agent

Bitnow 控制平面(API 驱动)技能

本技能从 API 使用角度 严格描述 Bitnow 网络的 端到端操作工作流

  • - 基于钱包的身份验证(签名流程)
  • 通过 API 进行链上余额充值及验证
  • 消费者 API 密钥生命周期(创建、列出、撤销)
  • 通过 API 密钥进行模型推理
  • 通过 HTTP API 查询余额和使用情况

假设条件:

  • - 存在一个 网关 HTTP API(例如 https://gateway-test.bitnow.ai)
  • 所有工作流均面向 CLI、Curl 或脚本,无 UI 辅助
  • 支持的链为 base sepolia,链 ID 为 8453

根据实际网关 URL 替换所有



1. 基于钱包的注册与会话(API 重点)

注意:消息签名必须由用户使用其 EVM 地址执行,且仅能发起或验证,不能生成签名。如果你没有钱包地址,需要自行创建并安全存储。

典型 API 序列:

  1. 1. 请求 SIWE 风格的登录挑战和消息:
sh curl -sS -X POST /v1/auth/wallet/challenge \ -H Content-Type: application/json \ -d { walletaddress: WALLET_ADDRESS>, chain_id: 8453 }

响应(简化):
json
{
message: 使用以太坊登录消息...,
nonce: 随机随机数,
wallet_address: 0x...,
chain_id: 8453
}

  1. 2. 用户使用其钱包离线签名 message。
  2. 将签名后的消息提交至网关进行验证:
sh curl -sS -X POST /v1/auth/wallet/verify \ -H Content-Type: application/json \ -d { walletaddress: WALLET_ADDRESS>, nonce: 随机随机数, signature: }

成功响应(简化):
json
{
login_token: sess-...,
expires_at: 2025-01-01T00:00:00Z,
consumer: {
id: 消费者-uuid,
wallet_address: 0x...
},
session: {
id: 会话-uuid
}
}

  1. 4. login_token(以 sess- 开头)用作 会话令牌
- 在需要会话认证的端点中,将其作为 Authorization: Bearer 发送。

检查

  • - 在所有需要认证的后续调用中,会话令牌必须存在并作为 Authorization: Bearer sess-... 头部发送。

2. 链上充值流程(API 验证)

充值在链上执行(将 USDC 转入 ConsumerDeposit 合约),由链下索引器跟踪。API 允许你验证结果。
你可以使用自己的端点,也可以使用此默认端点:https://sepolia.base.org

  • - 用户使用正确的调用数据将 USDC 转入 ConsumerDeposit 合约。
  • 后端在 L1/L2 交易确认后(由索引器驱动)将余额记入消费者账户。
  • USDC 地址为:0x10065E7b353371DD2e12348e7094cC774638EbEB
  • ConsumerDeposit 合约地址为:0xB0E9ebf19AB710d3353c7F637DC55329d9727dCc
- 充值前,你需要批准授权额度 - 充值 ABI 为 function deposit(uint256 amount)

通过 API 验证余额:

sh
curl -sS -X GET /v1/balance \
-H Authorization: Bearer API
KEY>

示例响应:

json
{
balance_usdc: 123.45,
total_spent: 10.00
}

故障排查:

  • - 将链上交易哈希与 API 观察到的 balance_usdc 值进行比较,以检测索引器或同步问题。

3. 消费者 API 密钥生命周期(仅 API)

消费者使用 API 密钥访问模型,无需会话。

3.1 创建 API 密钥

需要有效的会话令牌(第 1 节中的 login_token)。

sh
curl -sS -X POST /v1/consumer/api-keys \
-H Content-Type: application/json \
-H Authorization: Bearer \
-d {
label: my-key
}

示例响应(安全保存 api_key;仅返回一次!):

json
{
id: 密钥-uuid,
api_key: sk-consumer-...,
prefix: sk-cons,
suffix: abcd,
label: my-key,
status: active,
created_at: 2025-01-01T00:00:00Z
}

3.2 列出 API 密钥

sh
curl -sS -X GET /v1/consumer/api-keys \
-H Authorization: Bearer

3.3 撤销 API 密钥

sh
curl -sS -X DELETE URL>/v1/consumer/api-keys/ID> \
-H Authorization: Bearer

密钥状态将设置为 revoked;后续使用该密钥的调用将因认证错误而失败。



3.4 声明父账户(子账户 → 父账户关系)

使用此功能让 子账户声明一个父账户。这需要对结构化消息进行 钱包签名。签名 必须由子钱包生成

端点:

sh
curl -sS -X POST /v1/consumers/me/parent \
-H Content-Type: application/json \
-H Authorization: Bearer \
-d {
parentwallet: WALLET>,
issued_at: 1710000000,
signature: WALLET
SIGNATURE>
}

注意:

  • - issued_at 为 Unix 秒数。它必须在 过去 5 分钟内,且不能超过 未来 1 分钟
  • 签名的消息必须完全为:

Authorize parent for DePIN LLM
Parent wallet: WALLET
LOWERCASE>
Child wallet: WALLETLOWERCASE>
Issued at:

成功响应(201):

json
{
parentconsumerid: 消费者-uuid,
parentwalletaddress: 0x...,
created_at: 2025-01-01T00:00:00Z
}

常见错误:

  • - 400 INVALIDREQUEST 请求体无效
  • 400 SIGNATUREEXPIRED issuedat 超出时间窗口
  • 404 PARENTNOTFOUND 父账户未找到
  • 400 SELFPARENT 不能声明自己为父账户
  • 401 SIGNATUREMISMATCH 签名不是来自子钱包
  • 409 ALREADYSET 父账户已声明

4. 模型推理 API 使用

使用有效的 CONSUMERAPIKEY,可以查询模型。

4.1 列出可用模型

sh
curl -sS -X GET /v1/models

验证 模型是否存在(检查返回的列表)。

4.2 补全/聊天端点

sh
curl -sS -X POST /v1/chat \
-H Content-Type: application/json \
-H Authorization: Bearer APIKEY> \
-d {
model: gpt-4o-mini,
messages: [
{ role: system, content: 你是一个有用的助手。 },
{ role: user, content: 用一段话解释 Bitnow 网络。 }
]
}

API 错误处理:

  • - 401:密钥无效/过期;检查 Authorization 头部
  • 402:余额不足
  • 404:模型未找到(检查 MODELNOTFOUND)
  • 查看返回的 JSON 字段 error.code、error.message

5. 查询余额和使用情况(API)

5.1 余额查询

(参考第 2 节,

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 spherico-agent-1776294962 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 spherico-agent-1776294962 技能

通过命令行安装

skillhub install spherico-agent-1776294962

下载

⬇ 下载 bitnow-agent v0.0.2(免费)

文件大小: 4.55 KB | 发布时间: 2026-4-17 16:13

v0.0.2 最新 2026-4-17 16:13
- Renamed the skill from "spherico-agent" to "bitnow-agent" with all related terminology updated from "Spherico" to "Bitnow".
- Updated API and gateway references to align with the Bitnow network (e.g., new example URL: https://gateway-test.bitnow.ai).
- Modified wallet-based login instructions for EVM addresses and adjusted notes on wallet requirements.
- Added a new "Declare a Parent (Child → Parent Relationship)" workflow, enabling accounts to set parent relationships via wallet signature.
- Retained and clarified all existing network operation steps (authentication, on-chain top-up, API key lifecycle, model inference, usage queries) for the Bitnow context.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部