net.corda.core.contracts / ContractState

# ContractState

`interface ContractState`

A contract state (or just "state") contains opaque data used by a contract program. It can be thought of as a disk file that the program can use to persist data across transactions. States are immutable: once created they are never updated, instead, any changes must generate a new successor state. States can be updated (consumed) only once: the notary is responsible for ensuring there is no "double spending" by only signing a transaction if the input states are all free.

### Properties

contract | `abstract val contract: Contract` An instance of the contract class that will verify this state.
encumbrance | `open val encumbrance: Int?` All contract states may be encumbered by up to one other state.
participants | `abstract val participants: List<CompositeKey>` A participant is any party that is able to consume this state in a valid transaction.

### Extension Functions

hash | `fun ContractState.hash(): SecureHash` Returns the SHA-256 hash of the serialised contents of this state (not cached)
with notary | `infix fun <T : ContractState> T.with notary(newNotary: Party): TransactionState<T>` Wraps the ContractState in a TransactionState object
withNotary | `infix fun <T : ContractState> T.withNotary(newNotary: Party): TransactionState<T>`

### Inheritors

DummyState | `data class DummyState : ContractState` Dummy state for use in testing. Not part of any contract, not even the DummyContract.
LinearState | `interface LinearState : ContractState` A state that evolves by superseding itself, all of which share the common "linearId".
MultiOwnerState | `data class MultiOwnerState : ContractState, State` Alternative state with multiple owners. This exists primarily to provide a dummy state with multiple participants, and could in theory be merged with SingleOwnerState by putting the additional participants in a different field, however this is a good example of a contract with multiple states.
OwnableState | `interface OwnableState : ContractState` A contract state that can have a single owner.
QueryableState | `interface QueryableState : ContractState` A contract state that may be mapped to database schemas configured for this node to support querying for, or filtering of, states.
SchedulableState | `interface SchedulableState : ContractState`
State | `interface State : ContractState`