gettxout
Returns details about an unspent transaction output. This method uses 80 credits from your daily balance.
Returns null when the output is spent or doesn't exist.
Parameters
txid: (string) [required] - Transaction ID.n: (integer) [required] - Output index.include_mempool: (boolean) [optional] -trueto treat outputs spent in the mempool as spent, and to include unconfirmed outputs. The default istrue.
Returns
result: (object or null) - The unspent output, or null.
bestblock: (string) - Hash of the chain tip.confirmations: (integer) - Number of confirmations.0for unconfirmed outputs.value: (number) - Amount, in BTC.scriptPubKey: (object) - Locking script, withasm,desc,hex,type, and, when available,addressfields. Seegetrawtransactionfor the field descriptions.coinbase: (boolean) -truewhen the output belongs to a coinbase transaction.
Request
- curl
curl https://bitcoin-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "gettxout", "params": ["0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098", 0]}'
Response
- JSON
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"bestblock": "00000000000000000000d5e7a6f1b2c39484a5b6c7d8e9f0a1b2c3d4e5f60718",
"confirmations": 971402,
"value": 50.00000000,
"scriptPubKey": {
"asm": "0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee OP_CHECKSIG",
"desc": "pk(0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee)#qnv32gt7",
"hex": "410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac",
"type": "pubkey"
},
"coinbase": true
}
}