如何读取hyperledger结构上的资产



https://github.com/hyperledger/fabric-samples/blob/main/asset-transfer-basic/chaincode-go/chaincode/smartcontract.go

我在Kaleido平台上的区块链网络上安装了上述合同。我创建了这样一个资产:

{
"headers": {
"type": "SendTransaction",
"signer": "user2",
"channel": "default-channel",
"chaincode": "asset_transfer"
},
"func": "CreateAsset",
"args": [
"asset5","whitee","10","Tom","12300"
],
"init": false
}

反应是积极的,我认为资产是用给定的数据创建的:

{
"headers": {
"id": "4493af12-7483-49cc-60d4-ad621dc451b3",
"type": "TransactionSuccess",
"timeReceived": "2022-09-28T10:31:03.681639234Z",
"timeElapsed": 0.362129531,
"requestOffset": "",
"requestId": ""
},
"blockNumber": 86,
"signerMSP": "u0fm8amwnc",
"signer": "user2",
"transactionID": "fbc993a6ce104d4211adb36fcb391e53b01e1944b230613b44bdff38c91f8e21",
"status": "VALID"
}

现在我想读取资产5上的数据,即;white"10〃"Tom"12300";这些数据来自区块链。我试过了:

{
"headers": {
"type": "SendTransaction",
"signer": "user2",
"channel": "default-channel",
"chaincode": "asset_transfer"
},
"func": "ReadAsset",
"args": [
"asset5"
],
"init": false
}

我得到了成功的回应,但没有得到我需要的数据:

{
"headers": {
"id": "344bfc60-8950-42ec-6ec8-43689b90a881",
"type": "TransactionSuccess",
"timeReceived": "2022-09-28T11:12:26.766305515Z",
"timeElapsed": 0.290215954,
"requestOffset": "",
"requestId": ""
},
"blockNumber": 89,
"signerMSP": "u0fm8amwnc",
"signer": "user2",
"transactionID": "413c2e8a584f606bb2d31d4451d5bf90ed00c8cb1c4c6c887dca934bb1400204",
"status": "VALID"
}

https://youtu.be/bwRevURQve0?t=3313这家伙用同样的方法获取数据。

我是不是错过了什么?

我将这些请求发送到fabconnect的transactions端点。

我应该向/query发送POST请求,以便从那里读取数据。例如:

{
"headers": {
"signer": "user2",
"channel": "default-channel",
"chaincode": "asset_transfer"
},
"func": "ReadAsset",
"args": ["asset4"],
"strongread": true
}

相关内容

  • 没有找到相关文章

最新更新