States

The first element of the diagram to consider is the Primary state type, in this case there is only one state type in the Smart Contract and it has been named the AgreementState. States are represented as rounded boxes with the following three sections:

  • Header: Contains the class name (type) of the state, which must implement the ContractState interface, and the status that the state is in.
  • Properties: Contains the properties in the state class together with their classes.
  • Participants: Contains the participants - the Parties that will get a copy of any transaction in which this state is included as an input or output (but not reference state).

In the Agreement example use case, the following properties are required:

  • buyer - the buyer of the goods.
  • seller - the seller of the goods.
  • goods - a description of the goods being sold.
  • price - the price of the goods being sold.
  • proposer - the Party who is proposing the agreement.
  • consenter - the party who is consenting to the proposed agreement.
  • rejectionReason - a text field for supplying an explanation of why a proposed agreement was rejected.
  • rejectedBy - the party who rejected the proposed agreement.

Note that rejectionReason and rejectedBy are nullable as they will not be required in all statuses.

As this needs to be a private transaction, the participants must be limited to the buyer and seller. So, both the buyer and seller will receive copies of the transactions but nobody else. Later, you must consider who gets copies of transaction through the transaction resolution process.

Was this page helpful?

Thanks for your feedback!

Chat with us

Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.

Propose documentation improvements directly

Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.

We're sorry this page wasn't helpful. Let us know how we can make it better!

Chat with us

Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.

Create an issue

Create a new GitHub issue in this repository - submit technical feedback, draw attention to a potential documentation bug, or share ideas for improvement and general feedback.

Propose documentation improvements directly

Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.