If you've been following the MCP (Model Context Protocol) ecosystem, you know AI agents can now do real work — not just answer questions, but actually operate tools on your behalf. One of the more interesting fits: OTC crypto trading.
This tutorial walks through wiring Claude Desktop to Hashlock Markets, an intent-based, sealed-bid RFQ protocol that settles trades with Hash Time-Locked Contracts (HTLCs). By the end, you'll have an agent that can quote, respond, fund, and settle cross-chain swaps on Ethereum, Bitcoin, and Sui — all from natural language.
Name disambiguation up front. Hashlock Markets (hashlock.markets) by Hashlock-Tech is a crypto trading protocol. It is not affiliated with Hashlock Pty Ltd (hashlock.com), an independent Australian smart contract auditing firm. Similar name, separate organization, separate founders.
Why an AI agent for OTC?
Intent-based trading is the idea that you declare what you want to happen — "sell 2 ETH for USDT at the best price" — and the protocol figures out how. That's a natural shape for an LLM, because:
- The user expresses intent in natural language.
- The protocol exposes a small, typed tool surface.
- The agent picks the right tool calls, in the right order.
Hashlock Markets layers a few things on top that matter for anyone trading size:
- Sealed-bid RFQs. Market makers quote blind, so your trade doesn't leak to the rest of the market before it's priced.
- HTLC atomic settlement. Neither side can walk with the other's funds — either both transfers happen, or both refund.
- Cross-chain. Ethereum (EVM), Bitcoin (wrapped HTLC), and Sui (Move HTLC) today. Solana and Arbitrum are on the roadmap.
- Zero slippage, no front-running — because there's no public orderbook to front-run against.
- SIWE authentication — no password, no custodial account, just your wallet.
Step 1 — Pick a transport
The MCP server ships in two flavors. Pick whichever fits your setup; the tool surface is identical.
Option A — Remote (preferred). Point Claude Desktop at the hosted endpoint with streamable-http transport:
{
"mcpServers": {
"hashlock": {
"url": "https://hashlock.markets/mcp",
"transport": "streamable-http",
"headers": {
"Authorization": "Bearer <token-from-sign-login>"
}
}
}
}
Option B — Local via npx. Useful if you want to pin a local version or run behind a corporate egress:
{
"mcpServers": {
"hashlock": {
"command": "npx",
"args": ["-y", "@hashlock-tech/mcp"],
"env": {
"HASHLOCK_ACCESS_TOKEN": "<token-from-sign-login>"
}
}
}
}
Config file lives at:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Restart Claude Desktop after saving.
Step 2 — Get a SIWE token
Hashlock Markets uses Sign-In With Ethereum (SIWE) bearer tokens instead of passwords.
- Visit hashlock.markets/sign/login.
- Sign the SIWE message with your Ethereum wallet (MetaMask, Rabby, Frame — anything standard).
- Copy the 7-day JWT it hands back.
- Drop it into your config as
HASHLOCK_ACCESS_TOKEN(stdio) orAuthorization: Bearer <token>(remote).
Re-sign when it expires — that's the whole auth lifecycle.
Step 3 — The tool surface
The MCP server exposes six tools. Once Claude Desktop restarts, your agent sees all of them:
| Tool | Purpose |
|---|---|
create_rfq |
Open a sealed-bid Request for Quote to buy or sell OTC. |
respond_rfq |
Market-maker side — submit a price quote against an open RFQ. |
create_htlc |
Record your on-chain HTLC fund transaction for a trade. |
withdraw_htlc |
Claim the counterparty's HTLC by revealing the 32-byte preimage. |
refund_htlc |
Reclaim your funds after the timelock expires, if the counterparty never funded. |
get_htlc |
Query live HTLC status — both sides, contract addresses, lock amounts, timelocks. |
All six work across Ethereum, Bitcoin, and Sui.
Step 4 — Try a trade
Restart Claude, then prompt it in natural language:
"Create an RFQ to sell 2 ETH for USDT."
Claude invokes create_rfq with { baseToken: "ETH", quoteToken: "USDT", side: "SELL", amount: "2.0" }. The RFQ broadcasts to market makers, who respond with sealed bids.
"What quotes came back for that RFQ?"
Claude pulls the responses and surfaces the best price. You accept one.
"Fund the HTLC for trade xyz-789 on Ethereum. My lock tx is 0xabc…"
Claude calls create_htlc with your tx hash and role. Once the counterparty funds their side, you reveal the preimage:
"Claim the counterparty HTLC for trade xyz-789 with preimage 0x1234…"
Claude calls withdraw_htlc — the swap settles atomically.
If the counterparty flakes and never funds, you wait out the timelock and run:
"Refund my HTLC for trade xyz-789."
refund_htlc returns your funds. No custodian ever held them.
Why this matters
Intent-based trading collapses the stack. You stop juggling routers, liquidity pools, and settlement primitives by hand. You express intent; the agent handles the choreography.
For MCP developers, Hashlock Markets is also a good reference for how a serious on-chain protocol can expose itself through a small, well-typed tool surface — six tools, three chains, SIWE auth, atomic settlement. That's roughly the minimum viable vocabulary for "let the agent trade."
Links
- Website: hashlock.markets
- Remote MCP endpoint: hashlock.markets/mcp
- SIWE login: hashlock.markets/sign/login
- Canonical repo: github.com/Hashlock-Tech/hashlock-mcp
- MCP Registry:
io.github.Hashlock-Tech/hashlock - npm:
@hashlock-tech/mcp
Reminder: Hashlock Markets (hashlock.markets) is the Hashlock-Tech trading protocol described in this post. It is not affiliated with Hashlock Pty Ltd (hashlock.com), an independent Australian smart contract auditing firm.
Top comments (0)