States

States represent the shared facts between Corda nodes. States are immutable objects which can contain arbitrary data depending on the use case.

Since states are immutable, they cannot be modified directly to reflect a change in the state of the world. Instead, the current state is marked as historic and is replaced by a new state, which creates a chain of states that gives us a full view of the evolution of a shared fact over time. A Corda transaction does this evolution.

Corda transaction

Corda transaction specifies the states marked as historic (also known as the input states of the transaction) and the new states that supersede them (also known as the output states of the transaction).

Of course, there are particular rules to specify the kind of states each state can be replaced by. Smart contracts specify these rules, and each state also contains a reference to the contract that governs its evolution.

Smart contract

The smart contract is a pure function that takes a transaction as an input and determines whether this transaction is considered valid based on the contract’s rules.

Transactions can also contain commands, which indicate the transaction’s intent regarding how the data of the states are used. Each command is also associated with a list of public keys that need to sign the transaction to be valid.

Get hands-on with 1200+ tech skills courses.