I'm working with the BYFN example using 3 organizations, 2 channels. One channel(c12) between Org1 and Org2, another channel (c23) between Org2 and Org3. The first chaincode is an example where I'm able to transfer value between "A" and "B". When I run the code over c12, I can see I'm able to transfer an amount from A to B. But when I query the same chaincode over c23, the initialization is kept. I understand why (different ledgers) and etc.
Now I would like to introduce the following requirement. I, as an organization, need to transfer this value only if I have the amount available.
The sequence would be: 1. I'm on org2, I have 100, and I wanna transfer 60 to org1. And everything works as expected. 2. I'm on org2, I have 40 and I'll try to transfer 50 to org3 (another ledger - channel). This should fail because I have only 40.
How can I achieve this? Where will the "shared state" be stored? MSP? The same approach would work for a complex asset?
Extra information: - I already have read the documentation, about the assets, account model, the examples, but usually, they are focused only one channel only. Maybe I'm losing something. - I'm not using hyperledger composer
答案 0 :(得分:0)
在结构中,每个通道的链码和分类帐不同。因此,如果您要描述业务逻辑,则只需使用一个渠道(拥有3个组织)。
您可能可以使用私人数据对两个通道进行分离