Corda 与新参与者共享交易
Corda是否具有将新节点的数据共享到网络中的最佳实践?例如,节点A有交易,我们有一个新的节点B。节点A必须与节点B共享过去3个月的交易 你能分享一些如何做的例子吗Corda 与新参与者共享交易,corda,Corda,Corda是否具有将新节点的数据共享到网络中的最佳实践?例如,节点A有交易,我们有一个新的节点B。节点A必须与节点B共享过去3个月的交易 你能分享一些如何做的例子吗 谢谢。您可以很容易地为此编写一个流对 第一方调用以下流程将其所有存储的交易发送给交易对手: @InitiatingFlow @StartableByRPC class Sender(val counterparty: Party) : FlowLogic<Unit>() { @Suspendable ov
谢谢。您可以很容易地为此编写一个流对 第一方调用以下流程将其所有存储的交易发送给交易对手:
@InitiatingFlow
@StartableByRPC
class Sender(val counterparty: Party) : FlowLogic<Unit>() {
@Suspendable
override fun call() {
val (existingTransactions, _) = serviceHub.validatedTransactions.track()
val counterpartySession = initiateFlow(counterparty)
counterpartySession.send(existingTransactions)
}
}
@InitiatingFlow
@星表
类发送方(val对方:参与方):FlowLogic(){
@暂停
覆盖有趣的调用(){
val(existingTransactions,=serviceHub.validatedTransactions.track()
val交易对手Session=发起流动(交易对手)
counterpartySession.send(现有交易)
}
}
交易对手通过调用以下流程来接收和记录所有交易:
@InitiatedBy(Sender::class)
class Receiver(val counterpartySession: FlowSession) : FlowLogic<Unit>() {
@Suspendable
override fun call() {
val existingTransactions = counterpartySession.receive<List<SignedTransaction>>().unwrap { it }
serviceHub.recordTransactions(existingTransactions)
}
}
@InitiatedBy(发件人::类)
类接收器(val counterpartySession:FlowSession):flowslogic(){
@暂停
覆盖有趣的调用(){
val existingTransactions=counterpartySession.receive().unwrap{it}
serviceHub.recordTransactions(现有事务)
}
}
你好!非常感谢你的例子。Corda是否有任何工具用于过滤事务,例如通过时间戳?如果我要在某一特定时间段内同步状态?不是现在,不是。在这种情况下,交易对手是否成为参与者之一?它是否能够更新事务,即:使用收到的事务的状态作为输入并创建另一个事务?