Corda 如何将安全哈希传递给事务生成器
我将一个文件上载到Corda节点,并将以下十六进制值作为字符串返回: 854AAE9BE6607CE0B15A70EEBEF19C553557103FB051413F2AA35E70F5B44313 现在我需要将其作为secureHash参数传递给事务生成器: txBuilder.addAttachment(??) 如何将从文件上载获得的十六进制字符串结果作为输入参数构建安全哈希到Corda 如何将安全哈希传递给事务生成器,corda,Corda,我将一个文件上载到Corda节点,并将以下十六进制值作为字符串返回: 854AAE9BE6607CE0B15A70EEBEF19C553557103FB051413F2AA35E70F5B44313 现在我需要将其作为secureHash参数传递给事务生成器: txBuilder.addAttachment(??) 如何将从文件上载获得的十六进制字符串结果作为输入参数构建安全哈希到addAttachment SecureHash具有toString()函数,该函数将哈希作为上面的十六进制字符串返
addAttachment
SecureHash具有toString()
函数,该函数将哈希作为上面的十六进制字符串返回。我需要使用上面的十六进制字符串创建安全哈希
谢谢
已尝试对代码进行以下更新:
在Hello World教程中将attachId参数添加到IOUFlow。将附件添加为txBuilder.addAttachment(attachId)。见下面的代码:
class IOUFlow(val iouValue: Int,
val otherParty: Party, val attachId: SecureHash.SHA256) :
FlowLogic<Unit>() {
/** The progress tracker provides checkpoints indicating the progress of
the flow to observers. */
override val progressTracker = ProgressTracker()
/** The flow logic is encapsulated within the call() method. */
@Suspendable
override fun call() {
// We retrieve the notary identity from the network map.
val notary = serviceHub.networkMapCache.notaryIdentities[0]
val txBuilder = TransactionBuilder(notary = notary)
txBuilder.addAttachment(attachId)
....
}
使用以下shell命令启动流:
开始IOU低IOU值:99,另一方:“O=PartyB,L=New York,C=US”,
附件:C5C84DADD15B2359EBDF0DFC6CCCAA48A0DBA3A04EFD8F03EB117186CC0B2D08
Shell只响应'>',什么也没有发生。必须使用CTRL-C返回Shell提示符。使用SecureHash.parse()
将字符串转换为SecureHash
C5C84DADD15B2359EBDF0DFC6CCCAA48A0DBA3A04EFD8F03EB117186CC0B2D08