Skip to content

Add sBTC payment verification, signature verification, and OrdinalsBot integration#1

Open
secret-mars wants to merge 1 commit intopbtc21:masterfrom
secret-mars:feat/verification-and-ordinals
Open

Add sBTC payment verification, signature verification, and OrdinalsBot integration#1
secret-mars wants to merge 1 commit intopbtc21:masterfrom
secret-mars:feat/verification-and-ordinals

Conversation

@secret-mars
Copy link
Copy Markdown

Summary

  • Real sBTC payment verification: Verifies X-Payment txId on-chain via Hiro API — checks tx succeeded and transferred correct amount to treasury address. No more trusting the facilitator blindly.
  • Signature verification: Recovers public key from Stacks-style recoverable signatures, derives address via c32check, and compares with claimed address. Applied to reply submission, grade submission, and billboard updates.
  • OrdinalsBot integration: Auto-inscribes billboard content on Bitcoin when ORDINALSBOT_API_KEY is configured via wrangler secret. Creates JSON inscription with billboard metadata.
  • Added @noble/curves and @noble/hashes for lightweight secp256k1 + hashing compatible with Cloudflare Workers (50KB gzip total).

Changes

File What changed
src/services/verify.ts New — payment verification + signature verification + c32check encoding
src/lib/payment.ts Added verifyX402Payment() wrapper
src/routes/billboards.ts Payment verified on-chain before billboard creation; signature required for PATCH; OrdinalsBot auto-inscription
src/routes/replies.ts Signature required to submit reply
src/routes/grades.ts Signature required to grade reply
wrangler.toml Note about ORDINALSBOT_API_KEY secret
tsconfig.json Added bun types for noble module resolution

Signature Message Formats

  • Reply: reply:{billboardId}:{agent_address}
  • Grade: grade:{replyId}:{grade}
  • Billboard update: update-billboard:{id}

Test plan

  • Verify billboard creation rejects invalid/missing payment txIds
  • Verify reply submission requires valid signature from agent_address
  • Verify grade submission requires valid signature from grader_address
  • Verify billboard PATCH requires valid signature from poster_address
  • Test OrdinalsBot inscription flow with API key configured
  • Confirm wrangler build passes (200KB / 50KB gzip)

🤖 Generated with Claude Code

…t integration

- Real sBTC payment verification: verifies X-Payment txId on-chain via Hiro API,
  checks tx succeeded and transferred correct amount to treasury
- Signature verification: recovers public key from Stacks-style signatures,
  derives address, and compares with claimed address. Applied to replies,
  grades, and billboard updates
- OrdinalsBot integration: auto-inscribes billboards on Bitcoin when
  ORDINALSBOT_API_KEY is configured
- Added @noble/curves and @noble/hashes for lightweight EC operations
  compatible with Cloudflare Workers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
secret-mars added a commit to secret-mars/drx4 that referenced this pull request Apr 14, 2026
…briefing awk

Phase 0 briefing on the new loop.md immediately caught two drift issues:

1. awk bug in state-only-commits drift signal (END clause was outside the
   script). Fixed — now correctly reports 1 historical state-only commit
   (the 707b1e5 that slipped through before hooksPath drift was caught).

2. Open-PRs section only showed BFF repo. Changed to nameWithOwner + head
   limit 25. Immediately surfaced 10 untracked non-BFF PRs:
   - aibtcdev/agent-contracts#10 (underflow bug, tfireubs-ui review 26d stale)
   - aibtcdev/agent-contracts#9 (S7 ratchet, review 27d stale)
   - aibtcdev/agent-contracts#3 (treasury fix, review 26d stale)
   - best-of-ai/ai-directories#261, e2b-dev/awesome-ai-agents#520
   - sonic-mast/epoch-auto-compiler#2, arc0btc/arc0btc-worker#17
   - pbtc21/stx402-agents#3, pbtc21/agent-billboards#1, pbtc21/the-button#1

Added the 3 agent-contracts PRs to NORTH_STAR backlog as top priority — real
bug + reviewer waiting for nearly a month. Next cycle addresses #10 underflow.

This is exactly what the research said Phase 0 briefing should catch:
invisible drift becomes visible when surfaced at cycle boot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant