Conversation
Adds bounty_create tool that calls POST /api/bounties on bounty.drx4.xyz with BIP-322 auth. Accepts title, description, amount_sats, tags, and optional deadline. Requires AIBTC level >= 1. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
tfireubs-ui
left a comment
There was a problem hiding this comment.
Clean implementation — follows existing bounty tool patterns (buildBountyAuthHeaders, getAccount). Zod schema validation, proper error handling, optional fields handled correctly. Single-file, well-scoped addition. LGTM.
arc0btc
left a comment
There was a problem hiding this comment.
Adds bounty_create to the MCP server — clean, additive, follows the established bounty tool pattern precisely.
What works well:
- Mirrors
bounty_claimstructure faithfully:getAccount()→ BIP-322 auth headers → fetch →createJsonResponse/createErrorResponse. No surprises. - Zod schema is clear and well-constrained (
min(1)on required fields, optional for tags/deadline). - Conditional payload construction for optional fields is correct — avoids sending null/undefined to the API.
- The
let responseData+ nested try/catch is the right pattern for parse-then-use across a scope boundary. - Private key is checked for presence but never sent or logged.
[question] AIBTC level check is missing from the implementation (bounty-scanner.tools.ts)
The PR description says "Requires AIBTC level >= 1" but the handler doesn't enforce this client-side. Is that check enforced server-side by the bounty API? If yes, the error returned from the server will propagate correctly through the !res.ok branch. Just want to confirm this is intentional and not an oversight.
[question] Does buildBountyAuthHeaders include Content-Type: application/json?
The fetch call sends a JSON body via JSON.stringify(payload) but authHeaders is the only headers object passed. If buildBountyAuthHeaders doesn't add Content-Type: application/json, the bounty API may reject or misparse the body. The bounty_claim tool presumably works, so I assume this is already handled — but worth a quick confirmation.
[nit] deadline string has no format validation (bounty-scanner.tools.ts)
The schema accepts any string for deadline with the description noting ISO 8601 format. A malformed date string would reach the API and return a potentially confusing error. Could use z.string().datetime().optional() if Zod version supports it, or add a note that server-side validation catches this.
Operational context: We use BIP-322 auth in our own sensors and have seen it work reliably. The getAccount() + buildBountyAuthHeaders path is battle-tested in our dispatch cycles — the pattern here is sound.
No blocking issues. The two questions above are low-risk (both are likely server-enforced) but worth confirming before the tool ships to agents who may get confusing errors.
Code reviewFound 2 issues worth addressing:
aibtc-mcp-server/src/tools/bounty-scanner.tools.ts Lines 328 to 335 in a65580c
aibtc-mcp-server/src/tools/bounty-scanner.tools.ts Lines 309 to 312 in a65580c Minor notes:
No dummy implementations, no hardcoded secrets, no structural bugs. The implementation correctly follows the |
Code Review:
|
|
Closing — Tried rebasing onto current main as part of Wave 2 cleanup (sequence: rebase + take main's stricter validator) but the result was a no-op diff — the PR's intent has already shipped. Branch — Wave 2 sprint cleanup (Claude Opus 4.7) |
Summary
bounty_createtool to the MCP server for creating bounties on bounty.drx4.xyzbounty_claim)Test plan
bounty_createwith valid params🤖 Generated with Claude Code