比特币(Bitcoin) RPC Wallet API中getaddressinfo的用法及代码示例。
用法:
getaddressinfo "address"
返回有关给定比特币地址的信息。一些信息要求该地址在钱包中。
参数1 - address
类型:字符串,必填
要获取信息的比特币地址。
返回结果
{
"address" : "address", (string) The bitcoin address validated
"scriptPubKey" : "hex", (string) The hex-encoded scriptPubKey generated by the address
"ismine" : true|false, (boolean) If the address is yours or not
"iswatchonly" : true|false, (boolean) If the address is watchonly
"solvable" : true|false, (boolean) Whether we know how to spend coins sent to this address, ignoring the possible lack of private keys
"desc" : "desc", (string, optional) A descriptor for spending coins sent to this address (only when solvable)
"isscript" : true|false, (boolean) If the key is a script
"ischange" : true|false, (boolean) If the address was used for change output
"iswitness" : true|false, (boolean) If the address is a witness address
"witness_version" : version (numeric, optional) The version number of the witness program
"witness_program" : "hex" (string, optional) The hex value of the witness program
"script" : "type" (string, optional) The output script type. Only if "isscript" is true and the redeemscript is known. Possible types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_keyhash, witness_v0_scripthash, witness_unknown
"hex" : "hex", (string, optional) The redeemscript for the p2sh address
"pubkeys" (string, optional) Array of pubkeys associated with the known redeemscript (only if "script" is "multisig")
[
"pubkey"
,...
]
"sigsrequired" : xxxxx (numeric, optional) Number of signatures required to spend multisig output (only if "script" is "multisig")
"pubkey" : "publickeyhex", (string, optional) The hex value of the raw public key, for single-key addresses (possibly embedded in P2SH or P2WSH)
"embedded" : {...}, (object, optional) Information about the address embedded in P2SH or P2WSH, if relevant and known. It includes all getaddressinfo output fields for the embedded address, excluding metadata ("timestamp", "hdkeypath", "hdseedid") and relation to the wallet ("ismine", "iswatchonly").
"iscompressed" : true|false, (boolean, optional) If the pubkey is compressed
"label" : "label" (string) The label associated with the address, "" is the default label
"timestamp" : timestamp, (number, optional) The creation time of the key if available in seconds since epoch (Jan 1 1970 GMT)
"hdkeypath" : "keypath" (string, optional) The HD keypath if the key is HD and available
"hdseedid" : "<hash160>" (string, optional) The Hash160 of the HD seed
"hdmasterfingerprint" : "<hash160>" (string, optional) The fingperint of the master key.
"labels" (object) Array of labels associated with the address.
[
{ (json object of label data)
"name": "labelname" (string) The label
"purpose": "string" (string) Purpose of address ("send" for sending address, "receive" for receiving address)
},...
]
}
示例
bitcoin-cli getaddressinfo "1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc"
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getaddressinfo", "params": ["1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc"] }' -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 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 listlabels用法及代码示例
注:本文由纯净天空筛选整理自bitcoin.org大神的英文原创作品 Bitcoin getaddressinfo。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。