Initiating transaction to other nodes based on the receiver node

(Mayank Vikram) #1

I am not sure as how to put my question.

But what i am looking for is something like this:
Say i have 5 nodes- A,B,C,D,E. If A makes a transaction to B it should be notified to C and if A makes a transaction to D it should be notified to E.
I tried using BroadcastTransactionFlow but somehow not able to do much on that.
I am very new to Corda, and need quick help.

Thanks in adavance.

(francis.guttridge) #2

Long time since I’ve posted on these forums/used Corda,
But here goes nothing.

Basically, and you can verify this with remote debug but, you are in fact broadcasting the transaction to the party you think you are. The problem is that the party receiving it doesn’t see their name anywhere on it, and so they throw it away.
The Corda Vault interface if I recall correctly has some method “isRelevant()” that checks some attribute like “participants”

I think this might also require a particular state abstract. You can check the implementation.

So basically your options as I see them are to write the party to be notified onto every state
Write a flow to send a new state to notify that the transaction happened on completing the previous flow and call it as a subflow.

Whatever suits your needs the best.

(Mayank Vikram) #3

Hello Francis,

I am still stuck at the same problem.
I am using the cordapp-tutorial code to implement this.

Again , what i am looking is, a transaction which took place between NodeA and Node B, NodeC should be notified about it.

Any help would be much appreciated.


(francis.guttridge) #4

Just jumping through the new code as it’s been a while since I’ve had a chance to touch it.
Looks to be the same.

If you bring up package

You’ll see something like :

internal fun isRelevant(state: ContractState, myKeys: Set): Boolean {
val keysToCheck = when (state) {
is OwnableState -> listOf(state.owner.owningKey)
else -> { it.owningKey }
return keysToCheck.any { it in myKeys }

So you can see if the state is of type OwnableState, it will just check the key of the owner. If you don’t own the state you won’t store it is my understanding.
Alternatively, if it is another type of State(Could be anything really so long as it sub classes ContractState), it will check the field state.participants and if your nodes key exists in this list it will store the state.

TLDR: Add party C to participants of the state, and make sure you are not using OwnableState interface.
You should talk to one of the great developer relation folks from R3 if you still don’t understand, I’m sure they can explain it better than me :slight_smile: