Sharing transaction among multiple nodes


(Mike Hearn) #23

Ah, I see, you want to switch between different identities on the same node?

What I was referring to what the use of the same code on different nodes. At the moment we don’t support mapping different hosted identities to a single node (a la http virtual hosting).


(Rudrakshi) #24

Hi @Mike. Is there a resolution for this yet? In our use case too, we want to copy data to the 3rd party’s node so that it can use it as a reference to create its own transaction. The 3rd party doesn’t want to consume it, just use the details inside that state as a reference.


(Mike Hearn) #25

We’ve done some work on that. In master (what will become 1.0) application developers no longer have to think about the concept of relevancy, we’ve simplified that out of the API. Now we just have to add a way to force the vault to consider something relevant, even if you’re not involved. It’s a relatively small code change and I’m talking to one of our devs about including it for 1.0 - if it doesn’t make it for 1.0 it can make it very quickly afterwards.

It’s taking a while because our initial cut at this feature just made things more complicated for every CorDapp developer regardless of whether or not they needed this type of flexibility. We figured out a way that only devs who need it pay the complexity cost, have simplified down the core API, and now we need to add back in the new way to get the data into the vault for analysis.

For now, you can just receive the transaction in a flow and do stuff with the contents yourself. All we’re looking at adding at this point is a way to trigger the vault’s storage and ORM code for states you aren’t involved in. If you don’t need the ORM as part of “using the details” you already have enough, I think.


(Mayank Vikram) #26

Hey Roger,

I am looking for some help on this topic.
I want to just notify the other node about the transaction.

Please respond if you could help me on this.

-M


(Roger Willis) #27

Sure, you can use the FinalityFlow. It allows you to add additional parties that should receive the transaction.


(Mayank Vikram) #28

Thanks Roger for the response. I was trying to use Finality Flow but somehow could not do that.
Here is my State file:-1:public class IOUState implements ContractState {
private final int value;
private final Party lender;
private final Party borrower;
private final Party otherparty1;
private final Party otherparty2;
private final IOUContract contract = new IOUContract();

public IOUState(int value, Party lender, Party borrower, Party otherparty1, Party otherparty2) {
    this.value = value;
    this.lender = lender;
    this.borrower = borrower;
    this.otherparty1 = otherparty1;
    this.otherparty2 = otherparty2;
}

Now , what i need is that any transaction which is between lender and borrower should also be notified to otherparty1.

For that i tried changing my Flow:

public Void call() throws FlowException {
// We retrieve the required identities from the network map.
final Party me = getServiceHub().getMyInfo().getLegalIdentity();
final Party notary = getServiceHub().getNetworkMapCache().getAnyNotary(null);

    // We create a transaction builder.
    final TransactionBuilder txBuilder = new TransactionBuilder();
    txBuilder.setNotary(notary);

    // We add the items to the builder.
    IOUState state = new IOUState(iouValue, me, otherParty, otherparty1,otherparty2);
    Command cmd = new Command(new IOUContract.Create(), ImmutableList.of(me.getOwningKey(),otherparty1.getOwningKey()));
    txBuilder.withItems(state, cmd);

    // Verifying the transaction.
    txBuilder.verify(getServiceHub());

    // Signing the transaction.
    final SignedTransaction signedTx = getServiceHub().signInitialTransaction(txBuilder);


    // Finalising the transaction.
    subFlow(new FinalityFlow(signedTx);
 
    
   // subFlow(broadcastTransaction(signedTx,otherparty1));

    return null;
}

i tried passing otherparty1 as second parameter to the FinalityFlow subflow but guess that’s not the correct way .
Please suggest.