比特幣(Bitcoin) RPC Wallet API中lockunspent的用法及代碼示例。
用法:
lockunspent unlock ( [{"txid":"hex","vout":n},...] )
更新暫時不可用的輸出列表。
臨時鎖定(解鎖= false)或解鎖(解鎖= true)指定的事務輸出。
如果在解鎖時未指定任何事務輸出,那麽所有當前鎖定的事務輸出都將被解鎖。
花費比特幣時,不會通過自動硬幣選擇來選擇鎖定的交易輸出。
鎖僅存儲在內存中。節點以零個鎖定輸出開始,並且當節點停止或發生故障時,鎖定輸出列表始終會被清除(通過進程退出)。
另請參閱listunspent調用
參數1 - unlock
類型:布爾值,必填
是解鎖(true)還是鎖定(false)指定的交易
參數2 - transactions
類型:json數組,可選,默認=空數組
對象的json數組。每個對象都是txid(字符串)vout(數字)。
[
{ (json object)
"txid": "hex", (string, required) The transaction id
"vout": n, (numeric, required) The output number
},
...
]
返回結果
名稱 |
類型 |
描述 |
---|---|---|
真|假 |
boolean |
命令是否成功 |
示例
列出未使用的交易:
bitcoin-cli listunspent
鎖定未使用的交易:
bitcoin-cli lockunspent false "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":1}]"
列出鎖定的事務:
bitcoin-cli listlockunspent
再次解鎖交易:
bitcoin-cli lockunspent true "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":1}]"
作為JSON-RPC調用:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "lockunspent", "params": [false, "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":1}]"] }' -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 lockunspent。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。