OmniCore RPC API文档

交易创建API
omni_send omni_senddexsell omni_senddexaccept omni_sendissuancecrowdsale omni_sendissuancefixed omni_sendissuancemanaged omni_sendsto omni_sendgrant omni_sendrevoke omni_sendclosecrowdsale omni_sendtrade omni_sendcanceltradesbyprice omni_sendcanceltradesbypair omni_sendcancelalltrades omni_sendchangeissuer omni_sendall omni_sendenablefreezing omni_senddisablefreezing omni_sendfreeze omni_sendunfreeze omni_sendrawtx omni_funded_send omni_funded_sendall
数据查询API
omni_getinfo omni_getbalance omni_getallbalancesforid omni_getallbalancesforaddress omni_getwalletbalances omni_getwalletaddressbalances omni_gettransaction omni_listtransactions omni_listblocktransactions omni_listpendingtransactions omni_getactivedexsells omni_listproperties omni_getproperty omni_getactivecrowdsales omni_getcrowdsale omni_getgrants omni_getsto omni_gettrade omni_getorderbook omni_gettradehistoryforpair omni_gettradehistoryforaddress omni_getactivations omni_getpayload omni_getseedblocks omni_getcurrentconsensushash
裸交易API
omni_decodetransaction omni_createrawtx_opreturn omni_createrawtx_multisig omni_createrawtx_input omni_createrawtx_reference omni_createrawtx_change omni_createpayload_simplesend omni_createpayload_sendall omni_createpayload_dexsell omni_createpayload_dexaccept omni_createpayload_sto omni_createpayload_issuancefixed omni_createpayload_issuancecrowdsale omni_createpayload_issuancemanaged omni_createpayload_closecrowdsale omni_createpayload_grant omni_createpayload_revoke omni_createpayload_changeissuer omni_createpayload_trade omni_createpayload_canceltradesbyprice omni_createpayload_canceltradesbypair omni_createpayload_cancelalltrades omni_createpayload_enablefreezing omni_createpayload_disablefreezing omni_createpayload_freeze omni_createpayload_unfreeze
手续费API
omni_getfeecache omni_getfeetrigger omni_getfeeshare omni_getfeedistribution omni_getfeedistributions
内核配置API
omni_setautocommit

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}]"