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:

扫描二维码关注公众号,回复: 5685350 查看本文章
  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

猜你喜欢

转载自blog.csdn.net/weixin_44057343/article/details/87939141