BigchainDB资产转移时踩坑

BigchainDB资产转移时踩坑

报错:

The asset id of the input does not match the asset id of the transaction",“status”:400}\n’, {‘message’: ‘Invalid transaction (AssetIdMismatch): The asset id of the input does not match the asset id of the transaction’, ‘status’: 400},
http://localhost:9984/api/v1/transactions/’)

原因:

资产的id始终是最初创建该资产的CREATE事务的id。

在这种情况下,它应该是(CREATE tx 1)的id。而的代码正在设置transfer_asset_id = tx['id']但现在tx是无符号(TRANSFER tx 1),而不是(CREATE tx 1)

参考网址

说明:

transfer_asset = {
‘id’: asset_id,
}

此处的’id’应为该笔资产创建时候的id

transfer_input = {
‘fulfillment’: output[‘condition’][‘details’],
‘fulfills’: {
‘output_index’: output_index,
‘transaction_id’: ‘ID’,
},
‘owners_before’: output[‘public_keys’],
}

在输入端输入的 'transaction_id’应为该笔资产的最后一笔交易id

tips:

  1. bdb.blocks.get(txid=‘资产创建时的id’)函数可获取当前区块高度(该笔资产的交易次数)
  2. bdb.transactions.get(asset_id=‘资产创建时的id’)函数可获取当前区块的全部交易信息
  3. block_tx=bdb.blocks.get(txid=‘资产创建时的id’), block_tx[height-1][‘outputs’][output_index]
    可输出该资产最后一次交易的信息

参考网址,bigchaindb函数库参考——Source code for bigchaindb_driver.driver

参考网址,bigchaindb函数库参考2

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值