omni_decodetransaction
omni_decodetransaction
调用解码指定的Omni交易。
如果交易输入不在链上,那么必需手动提供,因为交易输入要用来识别交易的发送方。
可以提供一个区块高度来确定解析规则。
调用参数
- rawtx:要解码的裸交易,字符串,必需
- prevtxs:交易输入JSON数组,字符串,可选,默认值:none
- height:解析区块高度,数值,可选,默认值:0,表示使用链高度
prevtxs
参数的格式如下:
[
{
"txid" : "hash", // (string, required) 交易哈希
"vout" : n, // (number, required) 输出序号
"scriptPubKey" : "hex", // (string, required) 输出脚本
"value" : n.nnnnnnnn // (number, required) 输出值
}
,...
]
返回结果
omni_decodetransaction
调用返回如下的描述对象:
{
"txid" : "hash", // (string) 交易哈希
"fee" : "n.nnnnnnnn", // (string) 以比特币计算的交易手续费
"sendingaddress" : "address", // (string) 发送方的比特币地址
"referenceaddress" : "address", // (string) 作为参照的比特币地址
"ismine" : true|false, // (boolean) 交易是否涉及钱包内地址
"version" : n, // (number) 交易版本
"type_int" : n, // (number) 交易类型代码
"type" : "type", // (string) 交易类型字符串
[...] // (mixed) 其他特定交易类型相关的属性
}
示例代码
~$ omnicore-cli "omni_decodetransaction" "010000000163af14ce6d477e1c793507e32a5b7696288fa89705c0d02a3f66beb3c \
5b8afee0100000000ffffffff02ac020000000000004751210261ea979f6a06f9dafe00fb1263ea0aca959875a7073556a088cdf \
adcd494b3752102a3fd0a8a067e06941e066f78d930bfc47746f097fcd3f7ab27db8ddf37168b6b52ae22020000000000001976a \
914946cb2e08075bcbaf157e47bcb67eb2b2339d24288ac00000000" \
"[{\"txid\":\"eeafb8c5b3be663f2ad0c00597a88f2896765b2ae30735791c7e476dce14af63\",\"vout\":1, \
\"scriptPubKey\":\"76a9149084c0bd89289bc025d0264f7f23148fb683d56c88ac\",\"value\":0.0001123}]"