2
votes

I am trying to implement scenario where first few transactions done with state1 and later point in time try to batch all transaction into new state say state2 which can hold all these transaction. Can one state hold multiple states of other type? Can we include bulk states as input and output multiple states?

1

1 Answers

2
votes

Technically, yes, a state can contain other states. For example:

class StateContainingStates(
        val states: List<StateAndRef<ContractState>>,
        override val participants: List<Party>
) : ContractState

The main problem is that if you include the state above as an input to a transaction, the states held in the StateContainingStates.states field will not be consumed.

Another problem is that the contracts of the states held in the StateContainingStates.states field will not be executed as part of the transaction.