Replace old state in one node by new state shared at different nodes


(Alexandre Makiyama) #1

Hi guys,

Suppose the scenario: I have a state S1, recorded on the ledger at Node1 only, and I want to create a new state S2 replacing S1, but now shared with Node1 and Node2.

I guess I can’t create a transaction placing S1 as the old state (StateAndRef) and S2 as the new state, as long as Node2 doesn’t have the old state, am I right? How would be approach in that case? Make two transactions?

Thanks,
Alexandre


(Joel Dudley) #2

Hi Alexandre,

Nodes don’t have to hold all the states involved in a transaction - they can retrieve the states they weren’t formerly aware of from the counterparty using resolveTransactions. So your approach - a transaction consuming S1 and outputting S2 - sounds fine.


(Roger Willis) #3

As Joel says you can unilaterally issue a state on-ledger with a transaction signed by only Node1. S1 is only in Node1’s vault.

Then:

  • Node1 can then send S1 to Node2, and Node2 can assemble a transaction which evolves S1 to S2. Both Node1 and Node2 sign. Or…
  • Node1 assembles the transaction and both sign.

(Alexandre Makiyama) #4

Cool, thank you guys!