

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 支援搭配 Amazon Managed Blockchain (AMB) Access Bitcoin 的 Bitcoin JSON-RPCs
<a name="bitcoin-api"></a>

本主題提供受管 Blockchain 支援的 Bitcoin JSON-RPCs 的清單和參考。每個支援的 JSON-RPC 都有其使用的簡短描述。

**注意**  
 您可以使用 Signature 第 [4 版 (SigV4) 簽署程序](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html)來驗證受管 Blockchain 上的 Bitcoin JSON-RPCs。這表示只有 AWS 帳戶中的授權 IAM 主體可以使用比特幣 JSON-RPCs 與其互動。隨 呼叫提供 AWS 登入資料 （存取金鑰 ID 和私密存取金鑰）。
如果您的 HTTP 回應大於 10 MB，您會收到錯誤。若要修正此問題，您必須將壓縮標頭設定為 `Accept-Encoding:gzip`。然後，用戶端收到的壓縮回應包含下列標頭： `Content-Type: application/json`和 `Content-Encoding: gzip`。
Amazon Managed Blockchain (AMB) Access Bitcoin 會針對格式不正確的 JSON-RPC 請求產生 400 錯誤。
使用 `sendrawtransaction` JSON-RPC 提交更新比特幣區塊鏈狀態的交易。
AMB Access Bitcoin 預設請求限制為每秒 100 個請求 (RPS)`NETWORK_TYPE`，每個 AWS 區域每個 。  
若要提高配額，您必須聯絡 *AWS 支援*。若要聯絡 AWS 支援，請登入[AWS 支援中心主控台](https://console.aws.amazon.com/support)。選擇**建立案例**。選擇**技術**。選擇*受管區塊鏈*做為您的**服務**。選擇 *Access：Bitcoin* 作為您的**類別**，選擇*一般指引*作為您的**嚴重性**。在**描述**文字方塊中輸入 *RPC Quota* 做為**主旨**，並列出*每個區域每個比特幣網路 RPS* 中適用您需求的配額限制。**提交**您的案例。

## 支援的 JSON-RPCs
<a name="supported-json-rpc"></a>

AMB Access Bitcoin 支援下列 Bitcoin JSON-RPCs。每個支援的呼叫都有其使用的簡短描述。



- **[ 區塊鏈 RPCs](https://developer.bitcoin.org/reference/rpc/#blockchain-rpcs)**
  - **JSON-RPC:** [getbestblockhash](https://developer.bitcoin.org/reference/rpc/getbestblockhash.html) / **描述:** 傳回最有效、經過完整驗證鏈中最佳 （提示） 區塊的雜湊。
  - **JSON-RPC:** [getblock](https://developer.bitcoin.org/reference/rpc/getblock.html) / **描述:** 如果詳細度為 0，則 會針對區塊「雜湊」傳回序列化的十六進位編碼資料字串。如果詳細資訊為 1，則 會傳回物件，其中包含區塊「雜湊」的相關資訊。如果詳細資訊為 2，則 會傳回物件，其中包含區塊「雜湊」的相關資訊，以及每筆交易的相關資訊。如果詳細資訊為 3，則 會傳回物件，其中包含區塊「雜湊」的相關資訊，以及每個交易的相關資訊，包括輸入prevout的資訊。
  - **JSON-RPC:** [getblockchaininfo](https://developer.bitcoin.org/reference/rpc/getblockchaininfo.html) / **描述:** 傳回物件，其中包含區塊鏈處理的各種狀態資訊。
  - **JSON-RPC:** [getblockcount](https://developer.bitcoin.org/reference/rpc/getblockcount.html) / **描述:** 傳回最有效、經過完整驗證的鏈結高度。geneis 區塊的高度為 0。
  - **JSON-RPC:** [getblockfilter](https://developer.bitcoin.org/reference/rpc/getblockfilter.html) / **描述:** 使用區塊雜湊擷取特定區塊的 BIP 157 內容篩選條件。
  - **JSON-RPC:** [getblockhash](https://developer.bitcoin.org/reference/rpc/getblockhash.html) / **描述:** 在提供的高度傳回 best-block-chain 中的區塊雜湊。
  - **JSON-RPC:** [ getblockheader](https://developer.bitcoin.org/reference/rpc/getblockheader.html) / **描述:** 如果詳細資訊為 false， 會傳回區塊標頭「hash」的序列化十六進位編碼資料字串。如果詳細內容為 true， 會傳回 物件，其中包含 blockheader ‘hash’ 的相關資訊。
  - **JSON-RPC:** [getblockstats](https://developer.bitcoin.org/reference/rpc/getblockstats.html) / **描述:** 指定時段的每個區塊統計資料的運算。所有數量都是 satoshis。它不適用於某些具有剔除的高度。
  - **JSON-RPC:** [getchaintips](https://developer.bitcoin.org/reference/rpc/getchaintips.html) / **描述:** 傳回區塊樹狀結構中所有已知提示的相關資訊，包括主鏈和孤立分支。
  - **JSON-RPC:** [getchaintxstats](https://developer.bitcoin.org/reference/rpc/getchaintxstats.html) / **描述:** 運算鏈結中交易總數和速率的統計資料。
  - **JSON-RPC:** [getdifficulty](https://developer.bitcoin.org/reference/rpc/getdifficulty.html) / **描述:** 傳回proof-of-work困難度，做為最低困難度的倍數。
  - **JSON-RPC:** [getmempoolancestors](https://developer.bitcoin.org/reference/rpc/getmempoolancestors.html) / **描述:** 如果 txid 位於集區中，則 會傳回所有集區內上階。
  - **JSON-RPC:** [getmempooldescendants](https://developer.bitcoin.org/reference/rpc/getmempooldescendants.html) / **描述:** 如果 txid 位於集區中，則 會傳回所有集區內子系。
  - **JSON-RPC:** [getmempoolentry](https://developer.bitcoin.org/reference/rpc/getmempoolentry.html) / **描述:** 傳回指定交易的集區資料。
  - **JSON-RPC:** [getmempoolinfo](https://developer.bitcoin.org/reference/rpc/getmempoolinfo.html) / **描述:** 傳回 TX 記憶體集區作用中狀態的詳細資訊。
  - **JSON-RPC:** [getrawmempool](https://developer.bitcoin.org/reference/rpc/getrawmempool.html) / **描述:** 以字串交易 IDs的 JSON 陣列傳回記憶體集區中的所有交易 IDs。 不支援 `verbose = true`。 
  - **JSON-RPC:** [gettxout](https://developer.bitcoin.org/reference/rpc/gettxout.html) / **描述:** 傳回有關未花費交易輸出的詳細資訊。
  - **JSON-RPC:** [gettxoutproof](https://developer.bitcoin.org/reference/rpc/gettxoutproof.html) / **描述:** 傳回以十六進位編碼的證明，指出「txid」包含在區塊中。

- **[原始交易 RPCs](https://developer.bitcoin.org/reference/rpc/#rawtransactions-rpcs)**
  - **JSON-RPC:** [createrawtransaction](https://developer.bitcoin.org/reference/rpc/createrawtransaction.html) / **描述:** 建立花費指定輸入的交易，並建立新的輸出。
  - **JSON-RPC:** [解碼交易](https://developer.bitcoin.org/reference/rpc/decoderawtransaction.html) / **描述:** 傳回代表序列化、十六進位編碼交易的 JSON 物件。
  - **JSON-RPC:** [描述符](https://developer.bitcoin.org/reference/rpc/decodescript.html) / **描述:** 解碼十六進位編碼指令碼。
  - **JSON-RPC:** [getrawtransaction](https://developer.bitcoin.org/reference/rpc/getrawtransaction.html) / **描述:** 傳回原始交易資料。
  - **JSON-RPC:** [sendrawtransaction](https://developer.bitcoin.org/reference/rpc/sendrawtransaction.html) / **描述:** 將原始交易 （序列化、十六進位編碼） 提交至本機節點和網路。
  - **JSON-RPC:** [testmempoolaccept](https://developer.bitcoin.org/reference/rpc/testmempoolaccept.html) / **描述:** 傳回 mempool 接受測試的結果，指出 mempool 是否接受原始交易 （序列化、十六進位編碼）。這會檢查交易是否違反共識或政策規則。

- **[Util RPCs](https://developer.bitcoin.org/reference/rpc/#util-rpcs)**
  - **JSON-RPC:** [createmultisig](https://developer.bitcoin.org/reference/rpc/createmultisig.html) / **描述:** 建立具有 n 個必要 m 金鑰簽章的多簽章地址。
  - **JSON-RPC:** [estimatesmartfee](https://developer.bitcoin.org/reference/rpc/estimatesmartfee.html) / **描述:** 盡可能估計交易開始確認 conf\_target 區塊所需的每 KB 約略費用，並傳回預估有效區塊的數量。使用虛擬交易大小，如 BIP 141 所定義 （寬度資料折扣）。
  - **JSON-RPC:** [validateaddress](https://developer.bitcoin.org/reference/rpc/validateaddress.html) / **描述:** 傳回指定比特幣地址的相關資訊。
  - **JSON-RPC:** [驗證訊息](https://developer.bitcoin.org/reference/rpc/verifymessage.html) / **描述:** 驗證已簽章的訊息。

