如何获得调用该交易的参与者?

时间:2018-04-04 09:54:04

标签: hyperledger hyperledger-composer

我有一个事务doSomething像doSomething(asset1, asset2)

我是否可以检索调用doSomething事务的参与者而不将参与者引用作为参数之一传递?

更新:

doSomething(param1, param2) {
   //get caller participant reference here
   let caller = getParticipant();
}

例如,在上面的事务中,我想获得对在该函数中调用事务的参与者的引用(即事务尚未完成)

1 个答案:

答案 0 :(得分:3)

运行时API中有一个方法getCurrentParticipant,您可以从事务处理函数调用它。

在更新版本的Composer中(当然在v0.19.0中)还有getCurrentIdentity。

API参考中的document具有详细信息。