---
title: "如何选择可靠的 Bitcoin RPC 端点"
description: "一份选择 Bitcoin RPC 端点的 10 项清单、一份附来源的七家服务商对比，以及一个在你做出选择前测试正确性和数据新鲜度的脚本。"
datePublished: "2026-11-20"
dateModified: "2026-11-20"
---

# 如何选择可靠的 Bitcoin RPC 端点

<ImageBlock
  src="https://media.alchemy.com/bitcoin-rpc-endpoint-overview-2026-11-20.webp"
  alt="如何选择可靠的 Bitcoin RPC 端点标题卡"
  width={2000}
  height={1125}
  priority
/>

你的应用入账的每一笔充值、广播的每一笔提现、显示的每一个余额，都要先经过一个 Bitcoin RPC 端点。当这个端点落后于链，或者丢掉一个请求时，你的用户看到的就是一笔没到账的充值，或一笔卡住的付款。

Bitcoin RPC 端点是一个接收 JSON-RPC 请求的 URL，例如“最新区块是哪个？”或“广播这笔交易”，并把请求转发给一个 Bitcoin 节点。可靠的端点返回的数据与链一致，在负载下保持在线，支持你的应用调用的方法，并且会告诉你请求失败的原因。

可靠的端点每一次都与链保持一致。

**要点速览**

- 用[十项标准](#bitcoin-rpc-可靠性检查清单)评估服务商。数据正确和可用性排在最前。
- 做出选择前先测试：用[下面的脚本](#做出选择前如何测试-bitcoin-rpc-端点)对该端点和第二个数据源运行一小时。
- 依据各服务商自己的页面，在链覆盖、索引数据、流式推送和 SOC 2 方面比较服务商。
- Alchemy 把 Bitcoin、Litecoin、Dogecoin 和 Bitcoin Cash 与 100 多条其他链放在同一个 API 密钥和控制台中，免费套餐包含 Bitcoin JSON-RPC。

## Bitcoin RPC 可靠性检查清单

十项标准涵盖了 Bitcoin 端点在生产环境中出问题的各种方式，每一项你都可以自己测试。数据正确和可用性排在最前。一个很快但返回过时区块的端点，照样会让充值晚到账。

<EmbeddedTable
  table={{
    columns: [
      { key: "c0", title: "#", dataType: "object" },
      { key: "c1", title: "标准", dataType: "object" },
      { key: "c2", title: "合格的表现", dataType: "object" },
      { key: "c3", title: "如何测试", dataType: "object" },
      { key: "c4", title: "最适用于", dataType: "object" },
    ],
    data: [
      {
        c0: { title: "<p>1</p>", tooltip: "", icon: "" },
        c1: { title: "<p>链数据正确</p>", tooltip: "", icon: "" },
        c2: { title: "<p>区块和哈希与网络一致，即使在重组（链替换掉最新的几个区块）之后也是如此</p>", tooltip: "", icon: "" },
        c3: { title: "<p>在链头以下 6 个区块处，将 <code>getblockhash</code> 的结果与第二个数据源比较</p>", tooltip: "", icon: "" },
        c4: { title: "<p>托管、支付、对账</p>", tooltip: "", icon: "" },
        id: 0,
      },
      {
        c0: { title: "<p>2</p>", tooltip: "", icon: "" },
        c1: { title: "<p>可用性</p>", tooltip: "", icon: "" },
        c2: { title: "<p>后端某个节点故障时仍能继续响应</p>", tooltip: "", icon: "" },
        c3: { title: "<p>在一小时内统计失败、超时和落后的区块数。查看状态页面的历史记录</p>", tooltip: "", icon: "" },
        c4: { title: "<p>交易所</p>", tooltip: "", icon: "" },
        id: 1,
      },
      {
        c0: { title: "<p>3</p>", tooltip: "", icon: "" },
        c1: { title: "<p>方法和节点支持</p>", tooltip: "", icon: "" },
        c2: { title: "<p>你调用的每个方法都支持，运行在未修剪且带完整交易索引（<code>txindex</code>）的节点上</p>", tooltip: "", icon: "" },
        c3: { title: "<p>逐一调用每个方法。仅凭 ID 获取一笔旧交易</p>", tooltip: "", icon: "" },
        c4: { title: "<p>托管、对账、数据分析</p>", tooltip: "", icon: "" },
        id: 2,
      },
      {
        c0: { title: "<p>4</p>", tooltip: "", icon: "" },
        c1: { title: "<p>速率限制</p>", tooltip: "", icon: "" },
        c2: { title: "<p>能承受你的峰值流量，不出现 HTTP 429（请求过多）错误</p>", tooltip: "", icon: "" },
        c3: { title: "<p>发送峰值流量，并单独统计 429 错误</p>", tooltip: "", icon: "" },
        c4: { title: "<p>交易所、数据分析</p>", tooltip: "", icon: "" },
        id: 3,
      },
      {
        c0: { title: "<p>5</p>", tooltip: "", icon: "" },
        c1: { title: "<p>你所在地区的延迟</p>", tooltip: "", icon: "" },
        c2: { title: "<p>从你自己的服务器访问足够快</p>", tooltip: "", icon: "" },
        c3: { title: "<p>只为成功的调用计时。把超时算作失败</p>", tooltip: "", icon: "" },
        c4: { title: "<p>交易</p>", tooltip: "", icon: "" },
        id: 4,
      },
      {
        c0: { title: "<p>6</p>", tooltip: "", icon: "" },
        c1: { title: "<p>广播可靠性</p>", tooltip: "", icon: "" },
        c2: { title: "<p>你的交易能进入其他节点的 mempool（它们的未确认交易队列）</p>", tooltip: "", icon: "" },
        c3: { title: "<p>在主网上运行 <code>testmempoolaccept</code>，再在 testnet4 上做一笔小额发送</p>", tooltip: "", icon: "" },
        c4: { title: "<p>支付</p>", tooltip: "", icon: "" },
        id: 5,
      },
      {
        c0: { title: "<p>7</p>", tooltip: "", icon: "" },
        c1: { title: "<p>可调试性</p>", tooltip: "", icon: "" },
        c2: { title: "<p>清晰的错误信息、请求日志，状态页面列出 Bitcoin</p>", tooltip: "", icon: "" },
        c3: { title: "<p>发送一个错误请求，查看返回的错误</p>", tooltip: "", icon: "" },
        c4: { title: "<p>所有团队</p>", tooltip: "", icon: "" },
        id: 6,
      },
      {
        c0: { title: "<p>8</p>", tooltip: "", icon: "" },
        c1: { title: "<p>安全性</p>", tooltip: "", icon: "" },
        c2: { title: "<p>一份 SOC 2 Type II 报告</p>", tooltip: "", icon: "" },
        c3: { title: "<p>索取报告并查看信任页面</p>", tooltip: "", icon: "" },
        c4: { title: "<p>受监管的团队</p>", tooltip: "", icon: "" },
        id: 7,
      },
      {
        c0: { title: "<p>9</p>", tooltip: "", icon: "" },
        c1: { title: "<p>支持</p>", tooltip: "", icon: "" },
        c2: { title: "<p>由真人快速回复</p>", tooltip: "", icon: "" },
        c3: { title: "<p>购买前先发一个技术问题。询问能否签署 SLA</p>", tooltip: "", icon: "" },
        c4: { title: "<p>所有团队</p>", tooltip: "", icon: "" },
        id: 8,
      },
      {
        c0: { title: "<p>10</p>", tooltip: "", icon: "" },
        c1: { title: "<p>迁出成本</p>", tooltip: "", icon: "" },
        c2: { title: "<p>使用标准方法，任何索引类调用都有对应的替代方法</p>", tooltip: "", icon: "" },
        c3: { title: "<p>列出你的非标准调用，并在新服务商处逐一核对</p>", tooltip: "", icon: "" },
        c4: { title: "<p>所有团队</p>", tooltip: "", icon: "" },
        id: 9,
      },
    ],
  }}
/>

## 各 Bitcoin RPC 服务商对比如何？

下表依据各服务商自己的页面，在链覆盖、索引数据、流式推送和合规方面比较服务商。它不对性能进行排名。“未注明”表示我们无法在该服务商的页面上确认这一项。

<EmbeddedTable
  table={{
    columns: [
      { key: "c0", title: "服务商", dataType: "object" },
      { key: "c1", title: "UTXO 链", dataType: "object" },
      { key: "c2", title: "Bitcoin 节点和数据", dataType: "object" },
      { key: "c3", title: "流式推送", dataType: "object" },
      { key: "c4", title: "免费套餐含 Bitcoin", dataType: "object" },
      { key: "c5", title: "专用 Bitcoin 选项", dataType: "object" },
      { key: "c6", title: "SOC 2", dataType: "object" },
      { key: "c7", title: "状态页面列出 Bitcoin", dataType: "object" },
    ],
    data: [
      {
        c0: { title: "<p>Alchemy</p>", tooltip: "", icon: "" },
        c1: { title: "<p>BTC、BCH、LTC、DOGE</p>", tooltip: "", icon: "" },
        c2: { title: "<p>带 txindex 的未修剪全节点；索引 UTXO API</p>", tooltip: "", icon: "" },
        c3: { title: "<p>WebSocket</p>", tooltip: "", icon: "" },
        c4: { title: "<p>是（JSON-RPC）</p>", tooltip: "", icon: "" },
        c5: { title: "<p>是</p>", tooltip: "", icon: "" },
        c6: { title: "<p>Type II</p>", tooltip: "", icon: "" },
        c7: { title: "<p>是</p>", tooltip: "", icon: "" },
        id: 0,
      },
      {
        c0: { title: "<p>Blockdaemon</p>", tooltip: "", icon: "" },
        c1: { title: "<p>BTC、BCH、LTC、DOGE</p>", tooltip: "", icon: "" },
        c2: { title: "<p>通过自定义 RPC 方法和 REST 提供 UTXO 数据</p>", tooltip: "", icon: "" },
        c3: { title: "<p>事件流</p>", tooltip: "", icon: "" },
        c4: { title: "<p>未注明</p>", tooltip: "", icon: "" },
        c5: { title: "<p>是</p>", tooltip: "", icon: "" },
        c6: { title: "<p>Type II</p>", tooltip: "", icon: "" },
        c7: { title: "<p>是</p>", tooltip: "", icon: "" },
        id: 1,
      },
      {
        c0: { title: "<p>Blockstream</p>", tooltip: "", icon: "" },
        c1: { title: "<p>BTC、Liquid</p>", tooltip: "", icon: "" },
        c2: { title: "<p>索引 Esplora REST 和 Electrum；Bitcoin Core JSON-RPC 未注明</p>", tooltip: "", icon: "" },
        c3: { title: "<p>未注明</p>", tooltip: "", icon: "" },
        c4: { title: "<p>是</p>", tooltip: "", icon: "" },
        c5: { title: "<p>是</p>", tooltip: "", icon: "" },
        c6: { title: "<p>未注明</p>", tooltip: "", icon: "" },
        c7: { title: "<p>是</p>", tooltip: "", icon: "" },
        id: 2,
      },
      {
        c0: { title: "<p>Chainstack</p>", tooltip: "", icon: "" },
        c1: { title: "<p>BTC；LTC 和 DOGE 需使用专用节点</p>", tooltip: "", icon: "" },
        c2: { title: "<p>未修剪，带 txindex</p>", tooltip: "", icon: "" },
        c3: { title: "<p>未注明</p>", tooltip: "", icon: "" },
        c4: { title: "<p>是</p>", tooltip: "", icon: "" },
        c5: { title: "<p>是</p>", tooltip: "", icon: "" },
        c6: { title: "<p>Type II</p>", tooltip: "", icon: "" },
        c7: { title: "<p>是</p>", tooltip: "", icon: "" },
        id: 3,
      },
      {
        c0: { title: "<p>GetBlock</p>", tooltip: "", icon: "" },
        c1: { title: "<p>BTC、BCH、LTC、DOGE</p>", tooltip: "", icon: "" },
        c2: { title: "<p>全节点；索引 Blockbook API</p>", tooltip: "", icon: "" },
        c3: { title: "<p>通过 Blockbook 提供 WebSocket（付费套餐）</p>", tooltip: "", icon: "" },
        c4: { title: "<p>是</p>", tooltip: "", icon: "" },
        c5: { title: "<p>是</p>", tooltip: "", icon: "" },
        c6: { title: "<p>Type II</p>", tooltip: "", icon: "" },
        c7: { title: "<p>未注明</p>", tooltip: "", icon: "" },
        id: 4,
      },
      {
        c0: { title: "<p>NOWNodes</p>", tooltip: "", icon: "" },
        c1: { title: "<p>BTC、BCH、LTC、DOGE</p>", tooltip: "", icon: "" },
        c2: { title: "<p>全节点；索引 Blockbook API</p>", tooltip: "", icon: "" },
        c3: { title: "<p>付费套餐提供 WebSocket</p>", tooltip: "", icon: "" },
        c4: { title: "<p>是（试用）</p>", tooltip: "", icon: "" },
        c5: { title: "<p>是</p>", tooltip: "", icon: "" },
        c6: { title: "<p>未注明</p>", tooltip: "", icon: "" },
        c7: { title: "<p>未注明</p>", tooltip: "", icon: "" },
        id: 5,
      },
      {
        c0: { title: "<p>QuickNode</p>", tooltip: "", icon: "" },
        c1: { title: "<p>BTC、BCH；LTC 和 DOGE 为付费附加功能</p>", tooltip: "", icon: "" },
        c2: { title: "<p>禁用修剪；Blockbook 附加功能</p>", tooltip: "", icon: "" },
        c3: { title: "<p>Streams（仅区块数据）</p>", tooltip: "", icon: "" },
        c4: { title: "<p>是（试用）</p>", tooltip: "", icon: "" },
        c5: { title: "<p>是（Enterprise）</p>", tooltip: "", icon: "" },
        c6: { title: "<p>Type II</p>", tooltip: "", icon: "" },
        c7: { title: "<p>是</p>", tooltip: "", icon: "" },
        id: 6,
      },
    ],
  }}
/>

来源：各服务商自己的文档、定价、安全和状态页面，查阅时间为 2026 年 11 月 19 日。可以从 [Alchemy](https://www.alchemy.com/docs/bitcoin/bitcoin-api-overview)、[Blockdaemon](https://docs.blockdaemon.com/reference/rpc-api-overview)、[Blockstream](https://help.blockstream.com/blockstream-explorer-api)、[Chainstack](https://chainstack.com/build-better-with-bitcoin/)、[GetBlock](https://getblock.io/nodes/btc/)、[NOWNodes](https://nownodes.io/nodes/bitcoin-btc) 和 [QuickNode](https://www.quicknode.com/docs/bitcoin) 开始。

如果你需要余额和地址历史，先看节点和数据一列，因为 Bitcoin Core 不保留地址索引。如果你需要实时更新，看流式推送一列。如果你处在受监管的行业，先看 SOC 2。

## 做出选择前，如何测试 Bitcoin RPC 端点？

用下面的脚本对该端点和第二个数据源运行一小时，然后进行比较。可以把第二个数据源想象成机房里的第二只时钟：一只时钟无法告诉你它走错了，但两只时钟对不上时，你就知道该去查一查了。

第二个数据源可以是你自己的 Bitcoin Core 节点，也可以是另一家服务商。在一小时内（大约六个新区块），脚本会按类型统计失败、为成功的调用计时、跟踪端点落后多少，并检查两个数据源在链头以下六个区块处的区块哈希是否一致。它大约每秒发送一个请求，不是压力测试，所以峰值吞吐量需要单独测试。

<CodeSnippet
  language="javascript"
  code={"// test-endpoint.mjs: check a Bitcoin RPC endpoint against a second source. Node 18+, no dependencies.\n// PRIMARY_URL=https://bitcoin-mainnet.g.alchemy.com/v2/YOUR_KEY REFERENCE_URL=http://user:pass@127.0.0.1:8332 node test-endpoint.mjs\nconst env = process.env;\nconst DURATION_S = Number(env.DURATION_S ?? 3600); // an hour sees ~6 new blocks\nconst INTERVAL_MS = Number(env.INTERVAL_MS ?? 2000);\nconst TIMEOUT_MS = Number(env.TIMEOUT_MS ?? 5000); // slower than this counts as a timeout\nconst DEPTH = 6; // compare hashes 6 blocks below the tip, past normal reorgs\n// A 200 response only counts if the result has the right shape.\nconst VALID = { getblockcount: Number.isInteger, getblockhash: (h) => /^[0-9a-f]{64}$/.test(h) };\nif (!env.PRIMARY_URL || !env.REFERENCE_URL) throw new Error(\"Set PRIMARY_URL and REFERENCE_URL.\");\n\n// fetch() rejects user:pass in URLs, so move credentials into a header.\nfunction target(raw) {\n  const url = new URL(raw);\n  const headers = { \"content-type\": \"application/json\" };\n  if (url.username) {\n    const creds = `${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`;\n    headers.authorization = \"Basic \" + Buffer.from(creds).toString(\"base64\");\n    url.username = url.password = \"\";\n  }\n  return { url: url.toString(), headers };\n}\n\nasync function rpc({ url, headers }, method, params = []) {\n  const started = performance.now();\n  try {\n    const res = await fetch(url, { method: \"POST\", headers, signal: AbortSignal.timeout(TIMEOUT_MS),\n      body: JSON.stringify({ jsonrpc: \"2.0\", id: 1, method, params }) });\n    const text = await res.text();\n    const ms = performance.now() - started;\n    let body;\n    try { body = JSON.parse(text); } catch { return { kind: res.ok ? \"bad_response\" : `http_${res.status}` }; }\n    if (body?.error) return { kind: `rpc_${body.error.code}` }; // Bitcoin Core before v28 sends these as HTTP 500\n    if (!res.ok) return { kind: `http_${res.status}` };\n    if (!VALID[method](body?.result)) return { kind: \"bad_response\" };\n    return { ok: true, result: body.result, ms };\n  } catch (err) {\n    return { kind: err.name === \"TimeoutError\" || err.name === \"AbortError\" ? \"timeout\" : \"network\" };\n  }\n}\n\nconst P = target(env.PRIMARY_URL), R = target(env.REFERENCE_URL);\nconst latencies = [], errors = {}, referenceErrors = {}, checked = new Set(), mismatches = new Set();\nlet calls = 0, maxBehind = 0, behindSince = null, longestBehindMs = 0;\nconst tally = (bag, r) => r.ok || (bag[r.kind] = (bag[r.kind] ?? 0) + 1);\n\n// Call both endpoints at once. Returns [primary, reference] results, or null if either failed.\nasync function both(method, params) {\n  const [p, r] = await Promise.all([rpc(P, method, params), rpc(R, method, params)]);\n  calls++;\n  tally(errors, p);\n  tally(referenceErrors, r);\n  if (p.ok) latencies.push(p.ms);\n  return p.ok && r.ok ? [p.result, r.result] : null;\n}\n\nconsole.log(`Testing for ${DURATION_S}s...`);\nfor (const end = Date.now() + DURATION_S * 1000; Date.now() < end; await new Promise((r) => setTimeout(r, INTERVAL_MS))) {\n  const heights = await both(\"getblockcount\"); // does the primary keep up?\n  if (!heights) continue;\n  const behind = heights[1] - heights[0];\n  maxBehind = Math.max(maxBehind, behind);\n  behindSince = behind > 0 ? behindSince ?? Date.now() : null;\n  if (behindSince) longestBehindMs = Math.max(longestBehindMs, Date.now() - behindSince);\n  const height = Math.min(...heights) - DEPTH;\n  const hashes = await both(\"getblockhash\", [height]); // do both agree on a settled block?\n  if (!hashes) continue;\n  checked.add(height);\n  if (hashes[0] !== hashes[1]) mismatches.add(height);\n}\n\nconst sorted = latencies.sort((a, b) => a - b);\nconst pct = (q) => (sorted.length ? Math.round(sorted[Math.min(sorted.length - 1, Math.floor(q * sorted.length))]) : null);\nconst failed = Object.values(errors).reduce((a, b) => a + b, 0);\nconsole.log({\n  primaryCalls: calls,\n  failures: errors,\n  failureRate: `${((100 * failed) / Math.max(calls, 1)).toFixed(2)}%`,\n  latencyMsOnSuccess: { p50: pct(0.5), p95: pct(0.95), p99: pct(0.99) },\n  maxBlocksBehindReference: maxBehind,\n  longestSecondsBehind: Math.round(longestBehindMs / 1000),\n  blockHeightsChecked: checked.size,\n  hashMismatchesAtHeights: [...mismatches],\n  referenceFailures: referenceErrors, // if this is high, pick a better second source\n});\n"}
/>

用你自己的端点 URL 运行它：

<CodeSnippet
  language="bash"
  code={"PRIMARY_URL=https://bitcoin-mainnet.g.alchemy.com/v2/YOUR_KEY \\\nREFERENCE_URL=https://your-second-source.example \\\nDURATION_S=3600 node test-endpoint.mjs\n"}
/>

如果第二个数据源是你自己的 Bitcoin Core 节点，把它的 RPC 用户名和密码写进 URL，例如 `http://user:pass@127.0.0.1:8332`。脚本会把它们移到 authorization 请求头中。

输出结果的解读方法如下：

<EmbeddedTable
  table={{
    columns: [
      { key: "c0", title: "字段", dataType: "object" },
      { key: "c1", title: "正常", dataType: "object" },
      { key: "c2", title: "如果不正常", dataType: "object" },
    ],
    data: [
      {
        c0: { title: "<p><code>failureRate</code></p>", tooltip: "", icon: "" },
        c1: { title: "<p>接近 0%</p>", tooltip: "", icon: "" },
        c2: { title: "<p><code>http_429</code>：你已达到套餐的速率限制。<code>rpc_</code>：节点返回了错误。<code>bad_response</code>：返回的不是有效结果，例如网关错误页面或空结果</p>", tooltip: "", icon: "" },
        id: 0,
      },
      {
        c0: { title: "<p><code>maxBlocksBehindReference</code></p>", tooltip: "", icon: "" },
        c1: { title: "<p>0 或 1</p>", tooltip: "", icon: "" },
        c2: { title: "<p>每落后一个区块，大约就缺少 10 分钟的交易</p>", tooltip: "", icon: "" },
        id: 1,
      },
      {
        c0: { title: "<p><code>longestSecondsBehind</code></p>", tooltip: "", icon: "" },
        c1: { title: "<p>几秒钟</p>", tooltip: "", icon: "" },
        c2: { title: "<p>落后几分钟就意味着数据过时，即使只落后一个区块</p>", tooltip: "", icon: "" },
        id: 2,
      },
      {
        c0: { title: "<p><code>blockHeightsChecked</code></p>", tooltip: "", icon: "" },
        c1: { title: "<p>大于 2</p>", tooltip: "", icon: "" },
        c2: { title: "<p>延长测试时间</p>", tooltip: "", icon: "" },
        id: 3,
      },
      {
        c0: { title: "<p><code>hashMismatchesAtHeights</code></p>", tooltip: "", icon: "" },
        c1: { title: "<p>为空</p>", tooltip: "", icon: "" },
        c2: { title: "<p>几乎可以肯定，其中一个数据源处在错误的链上</p>", tooltip: "", icon: "" },
        id: 4,
      },
      {
        c0: { title: "<p><code>referenceFailures</code></p>", tooltip: "", icon: "" },
        c1: { title: "<p>低</p>", tooltip: "", icon: "" },
        c2: { title: "<p>问题出在你的第二个数据源。换一个再重新运行</p>", tooltip: "", icon: "" },
        id: 5,
      },
    ],
  }}
/>

在一天中最繁忙的时段、从你的服务器所在的地区运行测试。我们为公开的 [RPC 基准测试](https://www.alchemy.com/benchmarks)遵循的规则同样适用：在同一时间向每家服务商发送相同的请求，并把失败情况与延迟一起报告。

## 什么情况下 Alchemy 是合适的 Bitcoin RPC 服务商？

如果你希望把 Bitcoin、Litecoin、Dogecoin 和 Bitcoin Cash 放在你已经用于 [Ethereum](https://www.alchemy.com/overviews/best-ethereum-rpc-providers)、[Solana](https://www.alchemy.com/overviews/solana-rpc) 和 100 多条其他链的同一个 [RPC 平台](https://www.alchemy.com/rpc-api)上，Alchemy 就很合适：一个 API 密钥、一个控制台、一张账单。

以下情况适合选择 Alchemy：

- **你已经在 Alchemy 上运行 EVM 或 Solana。** Bitcoin 只是你应用中多出的一个网络，无需新增供应商，也无需新的安全审查。
- **你需要余额、UTXO 和地址历史。** 我们的索引 UTXO API 通过 REST 提供这些数据，包括按 xpub（一种可以派生出钱包全部地址的扩展公钥）和输出描述符查询。
- **你需要实时更新。** 我们的 Bitcoin WebSockets 会推送新区块以及你所关注地址上的活动。Bitcoin 和 Dogecoin 的地址活动 webhook 目前处于 beta 阶段。
- **你正在从其他 UTXO API 迁移。** 我们的 [UTXO 迁移指南](https://www.alchemy.com/docs/bitcoin/utxo-migration-guide)列出了 QuickNode、BlockCypher 和 Blockdaemon 的调用在 Alchemy 上的对应方式。
- **你的安全审查要求 SOC 2 Type II。** 我们已通过认证，详情见我们的[信任中心](https://trust.alchemy.com)。

受支持的节点方法与在你自己的 Bitcoin Core 节点上的用法相同。请在[方法列表](https://www.alchemy.com/docs/bitcoin/bitcoin-api-overview)中核对你调用的方法。`getbalance` 和 `listunspent` 等钱包方法在我们的端点上不可用，查询余额请使用索引 UTXO API。

## Litecoin、Dogecoin 和 Bitcoin Cash 呢？

这三条链都源自 Bitcoin 的代码库，因此它们共享 Bitcoin 的 UTXO 模型、大部分 JSON-RPC 方法，以及同一份检查清单。

<EmbeddedTable
  table={{
    columns: [
      { key: "c0", title: "链", dataType: "object" },
      { key: "c1", title: "出块时间", dataType: "object" },
      { key: "c2", title: "有何不同", dataType: "object" },
      { key: "c3", title: "我们支持的网络", dataType: "object" },
    ],
    data: [
      {
        c0: { title: "<p>Litecoin</p>", tooltip: "", icon: "" },
        c1: { title: "<p>约 2.5 分钟</p>", tooltip: "", icon: "" },
        c2: { title: "<p>“落后两个区块”的差距比在 Bitcoin 上小</p>", tooltip: "", icon: "" },
        c3: { title: "<p>主网、测试网</p>", tooltip: "", icon: "" },
        id: 0,
      },
      {
        c0: { title: "<p>Dogecoin</p>", tooltip: "", icon: "" },
        c1: { title: "<p>约 1 分钟</p>", tooltip: "", icon: "" },
        c2: { title: "<p>出块频率约为 Bitcoin 的十倍</p>", tooltip: "", icon: "" },
        c3: { title: "<p>主网</p>", tooltip: "", icon: "" },
        id: 1,
      },
      {
        c0: { title: "<p>Bitcoin Cash</p>", tooltip: "", icon: "" },
        c1: { title: "<p>约 10 分钟</p>", tooltip: "", icon: "" },
        c2: { title: "<p>使用 <code>estimatefee</code> 而不是 <code>estimatesmartfee</code></p>", tooltip: "", icon: "" },
        c3: { title: "<p>主网、测试网</p>", tooltip: "", icon: "" },
        id: 2,
      },
    ],
  }}
/>

[UTXO 链指南](https://www.alchemy.com/blog/how-to-build-on-utxo-chains)解释了这四条链与 Ethereum 等基于账户的链有何不同。

## 如何在 Alchemy 上获取 Bitcoin RPC 端点？

创建一个应用，启用 Bitcoin，然后发送一个请求。

1. 登录 [Alchemy 控制台](https://dashboard.alchemy.com/)并创建一个应用。
2. 启用 Bitcoin Mainnet。
3. 复制端点 URL。它的格式类似 `https://bitcoin-mainnet.g.alchemy.com/v2/YOUR_KEY`。
4. 发送一个请求：

<CodeSnippet
  language="bash"
  code={"curl -X POST https://bitcoin-mainnet.g.alchemy.com/v2/YOUR_KEY \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"getblockcount\",\"params\":[]}'\n"}
/>

响应内容就是当前的区块高度。[Bitcoin API 参考文档](https://www.alchemy.com/docs/bitcoin/bitcoin-api-overview)列出了所有受支持的方法。

[索引 UTXO API](https://www.alchemy.com/docs/chains/bitcoin/utxo-api-endpoints/utxo-api-endpoints/get-utxo)（余额、UTXO、地址和 xpub 历史）是付费附加功能。在按量付费套餐中，你可以在控制台按链购买；[Enterprise 套餐](https://www.alchemy.com/enterprise)则已包含它，并提供签署的 SLA。如需为你的团队单独预留容量，请参阅 [Dedicated Clusters](https://www.alchemy.com/dedicated-clusters) 或[联系我们的团队](https://www.alchemy.com/contact-sales)。

<CalloutBlock>

想亲自验证一下吗？[创建一个免费的 Bitcoin 端点](https://dashboard.alchemy.com/signup/?a=overviews%2Fbitcoin-rpc-endpoint)，然后用测试脚本对它进行测试。无需销售电话，无需签合同。如需 Enterprise 套餐或 Dedicated Clusters，请[联系我们的团队](https://www.alchemy.com/contact-sales)。

</CalloutBlock>

## 常见问题

### 如何选择可靠的 Bitcoin RPC 端点？

从十项标准比较服务商：正确性、可用性、方法和节点支持、速率限制、你所在地区的延迟、广播可靠性、可调试性、安全性、支持和迁出成本。然后把入围的服务商与第二个数据源对照测试一小时。统计失败、超时、落后的区块数和区块哈希不一致的次数，并且只为成功的调用计时。

### 什么是 Bitcoin RPC 服务商？

Bitcoin RPC 服务商替你运行 Bitcoin 节点，并为你提供一个接收 JSON-RPC 请求的端点 URL。服务商负责同步、升级和磁盘扩容。许多服务商还提供用于查询余额和地址历史的索引 API，而这些是 Bitcoin Core 本身不提供的。

### 我应该自己运行 Bitcoin 节点，还是使用服务商？

如果是本地开发，或者你需要完全掌控节点配置，就自己运行节点。如果你不想自己负责同步、升级、监控和地址索引器，生产环境就使用服务商。许多团队两者兼用，并在测试服务商时把自己的节点当作第二个数据源。

### 我的服务商应该支持哪些 Bitcoin RPC 方法？

至少要支持：`getblockcount`、`getblockhash`、`getblock`、`getrawtransaction`、`sendrawtransaction`、`estimatesmartfee`、`getblockchaininfo`，以及 `getrawmempool` 等 mempool 方法。确认 `getrawtransaction` 能仅凭 ID 找到旧交易，这需要 txindex。钱包和托管应用还需要通过索引 API 查询余额、UTXO 和 xpub。

### Alchemy 是否支持 Bitcoin、Litecoin、Dogecoin 和 Bitcoin Cash？

支持。Alchemy 在 Bitcoin、Litecoin、Dogecoin 和 Bitcoin Cash 上支持 JSON-RPC，并在这四条链上提供用于查询余额、UTXO 和地址历史的索引 UTXO API。索引 API 在按量付费套餐中是按链购买的附加功能，在 Enterprise 套餐中已包含。这四条链与 100 多条其他链共用一个控制台和 API 密钥。

### Alchemy 是否提供 Bitcoin archive 节点？

提供，就 Bitcoin 团队通常所指的含义而言。Alchemy 的 Bitcoin 端点运行在带完整交易索引（txindex）的未修剪全节点上，因此你可以凭 ID 获取任意区块和任意已确认的交易。查询地址余额和历史，请使用索引 UTXO API，因为 Bitcoin Core 不保留地址索引。

### 链重组期间会发生什么？

当网络用一条竞争分支替换掉最新的一个或多个区块时，就会发生重组。被替换区块中的交易（矿工奖励除外）会回到 mempool，大多数之后会再次确认。如果有一笔与之冲突的交易在新分支上得到确认，原交易就可能被丢弃，所以在为充值入账前要等待足够的确认数，并做好回滚的准备。

### 有免费的 Bitcoin RPC 端点吗？

有。包括 Alchemy 在内的多家服务商在免费套餐中提供 Bitcoin JSON-RPC，也有用于测试的免费公共端点。免费套餐的速率限制较低，公共端点也没有在线时间承诺，所以请将它们用于开发。在 Alchemy 上，免费套餐不提供索引 UTXO API。
