比特幣(Bitcoin) RPC Wallet API中listtransactions的用法及代碼示例。
用法:
listtransactions ( "label" count skip include_watchonly )
如果提供了標簽名稱,這將僅返回支付給具有指定標簽的地址的入賬交易。
最多返回‘count’個最近的事務,而跳過前‘from’個事務。
參數1 - label
類型:字符串,可選
- 如果設置,則應為有效的標簽名稱,以僅返回傳入的交易
帶有指定標簽的標簽,或者使用“*”禁用過濾並返回所有事務。
參數2 - count
類型:數字,可選,默認值= 10
要退回的交易數
參數3 - skip
類型:數字,可選,默認值= 0
要跳過的交易數
參數4 - include_watchonly
類型:布爾值,可選,默認= false
包括到watch-only地址的交易(請參閱‘importaddress’)
返回結果
[
{
"address":"address", (string) The bitcoin address of the transaction.
"category": (string) The transaction category.
"send" Transactions sent.
"receive" Non-coinbase transactions received.
"generate" Coinbase transactions received with more than 100 confirmations.
"immature" Coinbase transactions received with 100 or fewer confirmations.
"orphan" Orphaned coinbase transactions received.
"amount": x.xxx, (numeric) The amount in BTC. This is negative for the 'send' category, and is positive
for all other categories
"label": "label", (string) A comment for the address/transaction, if any
"vout": n, (numeric) the vout value
"fee": x.xxx, (numeric) The amount of the fee in BTC. This is negative and only available for the
'send' category of transactions.
"confirmations": n, (numeric) The number of confirmations for the transaction. Negative confirmations indicate the
transaction conflicts with the block chain
"trusted": xxx, (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.
"blockhash": "hashvalue", (string) The block hash containing the transaction.
"blockindex": n, (numeric) The index of the transaction in the block that includes it.
"blocktime": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).
"txid": "transactionid", (string) The transaction id.
"time": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).
"timereceived": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT).
"comment": "...", (string) If a comment is associated with the transaction.
"bip125-replaceable": "yes|no|unknown", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);
may be unknown for unconfirmed transactions not in the mempool
"abandoned": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the
'send' category of transactions.
}
]
示例
列出係統中最近的10個事務:
bitcoin-cli listtransactions
列出交易100到120:
bitcoin-cli listtransactions "*" 20 100
作為JSON-RPC調用:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listtransactions", "params": ["*", 20, 100] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
相關用法
- Bitcoin abandontransaction用法及代碼示例
- Bitcoin abortrescan用法及代碼示例
- Bitcoin addmultisigaddress用法及代碼示例
- Bitcoin backupwallet用法及代碼示例
- Bitcoin bumpfee用法及代碼示例
- Bitcoin createwallet用法及代碼示例
- Bitcoin dumpprivkey用法及代碼示例
- Bitcoin dumpwallet用法及代碼示例
- Bitcoin encryptwallet用法及代碼示例
- Bitcoin getaddressesbylabel用法及代碼示例
- Bitcoin getaddressinfo用法及代碼示例
- Bitcoin getbalance用法及代碼示例
- Bitcoin getnewaddress用法及代碼示例
- Bitcoin getrawchangeaddress用法及代碼示例
- Bitcoin getreceivedbyaddress用法及代碼示例
- Bitcoin getreceivedbylabel用法及代碼示例
- Bitcoin gettransaction用法及代碼示例
- Bitcoin getwalletinfo用法及代碼示例
- Bitcoin importaddress用法及代碼示例
- Bitcoin importmulti用法及代碼示例
- Bitcoin importprivkey用法及代碼示例
- Bitcoin importpubkey用法及代碼示例
- Bitcoin importwallet用法及代碼示例
- Bitcoin keypoolrefill用法及代碼示例
- Bitcoin listaddressgroupings用法及代碼示例
注:本文由純淨天空篩選整理自bitcoin.org大神的英文原創作品 Bitcoin listtransactions。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。