Testnet

Blockcypher 新交易請求返回的不僅僅是輸入和輸出

  • July 22, 2021

我是比特幣和區塊鏈以及 Blockcypher 的新手。

我正在嘗試使用 Blockcypher API 創建(和簽名)和發送交易(在測試網上)。我提供的請求有 1 個輸入和 1 個輸出,但我收到的響應有 50% 的時間有2 個輸入/輸出/tosign.. 為什麼會這樣?謝謝

樣品要求:

發佈到<https://api.blockcypher.com/v1/btc/test3/txs/new?token=XXXXXXXX>

{
   "double_spend": false,
   "inputs": [{
       "addresses": ["mqtDjKw8wCyPBvk61NfkgmNFZDwHvCJTUD"]
   }],
   "outputs": [{
       "value": 2,
       "addresses": ["tb1qfefhgu4npfqjk36v66eqk6ee0gska720j09nvr"]
   }]
}

回复:

{
   "tx": {
       "hash": "b520ccb4b9ab96075c3cf1a91b0c7710a22332f0bb4d25409bcf9693a35477dd",
       "block_height": -1,
       "addresses": ["mqtDjKw8wCyPBvk61NfkgmNFZDwHvCJTUD", "tb1qfefhgu4npfqjk36v66eqk6ee0gska720j09nvr"],
       "total": 55000,
       "fees": 30000,
       "relayed_by": "35.226.46.118",
       "received": "2021-07-22T10:19:47.853381661Z",
       "ver": 1,
       "vin_sz": 2,
       "vout_sz": 2,
       "confirmations": 0,
       "preference": "high",
       "double_spend": false,
       "inputs": [{
           "prev_hash": "34e749b34cc75b996e7b28638cc4648958942b046bf9961837af7ab0046e53d1",
           "output_index": 0,
           "output_value": 10000,
           "addresses": ["mqtDjKw8wCyPBvk61NfkgmNFZDwHvCJTUD"],
           "script_type": "pay-to-pubkey-hash"
       }, {
           "prev_hash": "106ad632e2474e683b2180181c1b911bc4d5727db5ab341ee8aded3b78fb2da7",
           "output_index": 1,
           "output_value": 75000,
           "addresses": ["mqtDjKw8wCyPBvk61NfkgmNFZDwHvCJTUD"],
           "script_type": "pay-to-pubkey-hash"
       }],
       "outputs": [{
           "value": 2,
           "script": "00144e537472b30a412b474cd6b20b6b397a216ef94f",
           "addresses": ["tb1qfefhgu4npfqjk36v66eqk6ee0gska720j09nvr"],
           "script_type": "pay-to-witness-pubkey-hash"
       }, {
           "value": 54998,
           "script": "76a91471b6e0ce39475cbe5cd43966f5c7eb80a886952088ac",
           "addresses": ["mqtDjKw8wCyPBvk61NfkgmNFZDwHvCJTUD"],
           "script_type": "pay-to-pubkey-hash"
       }]
   },
   "tosign": ["c0859bbf0f964af14c01d9ff2da9e5254279d02c5c75c902e3a8180db6bb67e5", "91a6c5b3003047c0af81348f12867918ebc4efd70f3ff1a5ee9e4566bf361de8"],
   "signatures": [],
   "pubkeys": []
}

謝謝

不確定其他金額與什麼有關。

   "total": 55000,

在此交易中轉移到輸出的金額

   "fees": 30000,

總投入量與總產出量之差。

請注意,上述兩個值之和為 85000。

       "output_value": 10000,

與具有指定支出地址的一個 UTXO 關聯的金額

       "output_value": 75000,

與具有指定支出地址的第二個 UTXO 關聯的金額

請注意,上述兩個值之和為 85000。

       "value": 2,

您指定的金額被發送到目的地地址

       "value": 54998,

55000 的剩餘部分(“總數”,見上文)作為零錢返回。

引用自:https://bitcoin.stackexchange.com/questions/107694