Best way to create Atomic Transactions using CORDA Flows

后端 未结 1 1860
你的背包
你的背包 2021-01-25 16:00

I have an use case where i need to send data to multiple counter parties but the parties need to be kept anonymous of each other . After the endorsements are collected back from

相关标签:
1条回答
  • 2021-01-25 16:01

    For this, you need to use confidential identities. Confidential identities are represented in states by the AnonymousParty class:

    class MyState(val party: AnonymousParty): ContractState {
        override val participants = listOf<AnonymousParty>(party)
    }
    

    The difference between a Party and an AnonymousParty is that AnonymousParty identifies participants by public key only. As long as each transaction participant generates a new public key for the transaction, their identity, and therefore their involvement in the state, will be secret.

    To create a transaction involving confidential identities, you must do the following:

    • One party who initiates the flow - let's call her Alice - must know the identity of all the counterparties (to know whom to gather signatures from)
    • Alice runs the SwapIdentitiesFlow with each counterparty to automate the creation of confidential identities for all the participants
    • Alice uses these confidential identities in building the transaction
    • Alice gathers signatures from all the counterparties
    • Alice finalises the transaction

    Each party will end up with the transaction in their vault, but each party is only identified by an anonymous public key, so the involvement of each party is kept secret from their peers.

    You can find docs about this API here: https://docs.corda.net/api-identity.html. You can find an example usage of confidential identities here: https://github.com/joeldudleyr3/whistleblower.

    0 讨论(0)
提交回复
热议问题