Elements侧链RPC API文档

在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

gettransaction - 获取指定钱包交易

gettransaction调用返回钱包交易的详细信息。

Elements的gettransaction调用类似于bitcoin core的同名调用, 但可以显示额外的信息,例如比特币之外的资产类型、是否使用私密交易等。

调用参数

  • TXID:要查询的交易ID
  • IncludeWatchOnly:是否包含WatchOnly地址,默认值:false
  • AssetIdentifier:资产标识符

返回结果

gettransaction调用返回钱包交易描述对象,结构如下:

  • amount:交易金额,对象或数值
  • fee:交易手续费,数值
  • confirmations:交易确认数,数值
  • generated:是否币基交易,布尔值
  • blockhash:区块哈希
  • blockindex:区块内交易索引,数值
  • txid:交易id,字符串
  • walletconflicts:与本交易冲突的其他交易ID,数组
  • time:交易进入钱包的时间,数值
  • timereceived:本地节点收到交易的时间,数值
  • bip125-replacable:交易是否bip125可替换,字符串,yes或no
  • comment:备注
  • to:备注to
  • details:交易详情
    • involvesWatchonly:是否包含watchonly地址
    • account:账户
    • address:对方地址
    • category:交易类别,可以为:
      • send:付款交易
      • receive:收款交易
      • generate:成熟可消费的币基交易
      • immature:不成熟的币基交易
      • orphan:孤儿块的币基交易
    • amount:交易金额,付款交易为负,收款交易为正
    • amountblinder:金额盲化因子,可能是32字节0
    • asset:资产标识符或资产标签
    • assetblinder:资产盲化器,避免泄漏消费的资产种类
    • vout:输出序号
    • fee:手续费,收款交易不返回此字段,付款交易该字段为负值,可能为0
    • abandoned:是否已废弃
  • hex:交易的序列化表示

示例代码

请求:

~$ elements-cli gettransaction f4f30db53238a7529bc51fcda04ea22bd8f8b188622a6488da12281874b71f72

响应结果:

{ 
  "amount": { 
    "bitcoin": 0.00000000 
  }, 
  "fee": -0.00039460, 
  "confirmations": 2, 
  "blockhash": "5c81a92979fdc82a40d0aa8c1e39976a4fdcd890bf864794243052aae4ddb514", 
  "blockindex": 1, 
  "blocktime": 1497552832, 
  "txid": "f4f30db53238a7529bc51fcda04ea22bd8f8b188622a6488da12281874b71f72", 
  "walletconflicts": [ 
  ], 
  "time": 1497551591, 
  "timereceived": 1497551591, 
  "bip125-replaceable": "no", 
  "details": [ 
    { 
      "account": "", 
      "address": "2dmCj9T1PZ2osmWDjsaFsaoToCK2wyGkscT", 
      "category": "send", 
      "amount": -100.00000000, 
      "amountblinder": "2f6c001bdd96ba6950443f46d8ec53ab2a46cc6d3eedf4d9e86dcfff359d5c49", 
      "asset": "09f663de96be771f50cab5ded00256ffe63773e2eaa9a604092951cc3d7c6621", 
      "assetblinder": "ed8030dcfb6a0d299cf548f72e2034f6199f2fc90e6af35457b19f87cf65e16d", 
      "label": "", 
      "vout": 1, 
      "fee": -0.00039460, 
      "abandoned": false 
    },  
    { 
      "account": "", 
      "address": "2dmCj9T1PZ2osmWDjsaFsaoToCK2wyGkscT", 
      "category": "receive", 
      "amount": 100.00000000, 
      "amountblinder": "2f6c001bdd96ba6950443f46d8ec53ab2a46cc6d3eedf4d9e86dcfff359d5c49", 
      "asset": "09f663de96be771f50cab5ded00256ffe63773e2eaa9a604092951cc3d7c6621", 
      "assetblinder": "ed8030dcfb6a0d299cf548f72e2034f6199f2fc90e6af35457b19f87cf65e16d", 
      "label": "", 
      "vout": 1 
    } 
  ], 
  "hex": "01000000000101f4[...]729da00003a000000"
}