我有一个带有 -P 'OR (ORG1.peer, ORG2.peer)'
认可政策的链码 . 当我使用命令 peer chaincode invoke ...
调用链代码时,它只接受交易提议而没有任何中断或等待认可 . 换句话说: endorsement logic
总是返回true . 根据this part of documentation:
By default, endorsing logic at a peer accepts the tran-proposal and simply signs the tran-proposal. However, endorsing logic may interpret arbitrary functionality, to, e.g., interact with legacy systems with tran-proposal and tx as inputs to reach the decision whether to endorse a transaction or not.
现在我想覆盖这个逻辑,以便它在端口上侦听来自外部应用程序的接受或拒绝消息 .
可能吗?
如果是这样,我该怎么做?
我是否需要为fabric-peer构建自己的docker镜像?
我的认可逻辑, waiting for an external call (ex. the administrator of organization)
对现实世界的面料用例有什么意义吗?
1 回答
通过执行智能合约(结构中的链代码)来完成认可 . Chaincodes主要用Go,NodeJs和Java编写 .
虽然不推荐(因为如果 endpoints 不受信任,它会使您的 Contract 容易受到攻击),您可以访问驱动您的认可逻辑的任何外部应用程序(例如使用HTTP) .
成功执行 Contract 意味着运行您的链代码的特定对等方已签署您的交易 . 例如,如果Org1对等体和Org2对等体成功运行了链代码,则您的事务中都有两个签名 .
有关详细信息,请参阅这些文档:http://hyperledger-fabric.readthedocs.io/en/release/chaincode.html
http://hyperledger-fabric.readthedocs.io/en/release/endorsement-policies.html
http://hyperledger-fabric.readthedocs.io/en/release/txflow.html