Читать книгу The New Advanced Society - Группа авторов - Страница 33

2.3.2 States

Оглавление

A state is an immutable object that represents a fact known by one or more Corda nodes at a particular point in time and these are updated by marking the current state as historic and creating an updated state. Unlike traditional blockchains, each peer is associated with a vault which is a database that tracks all the current data (otherwise known as the unconsumed state) and historic data (otherwise known as the consumed state) that it is aware of, along with the timestamps. Vaults may have different versions of data depicted by state objects, but only one of them is the current data and the remaining are historic data [56]. The states used in this solution are described below.

In this scenario, the state object is the “task” and the state sequence is the “completion of the task”. As mentioned in Figure 2.1, the participants are the client, the main contractor, and the subcontractor. The properties involved here are:

 Task ID—the ID of the task

 Task description—a detailed description of the task to be completed

 Amount—the amount that is required to complete the task

 Assignee—the subcontractor assigned by the main contractor to complete the task

 Deadline—the date by when the given task is to be completed

The main contractor can create a task and assign it to a subcontractor. The subcontractor can update the state of the task upon completion.

Apart from the state mentioned in Figure 2.1, there is another state in which the state object is the “cash” and the state sequence is the “flow of the cash”. As mentioned in Figure 2.2, the participants are the client, the main contractor, and the subcontractor. The properties involved here are:


Figure 2.1 Representation of the “task” state.

Figure 2.2 Representation of the “cash” state.

 From—the participant that sends the cash

 To—the participant that receives the cash

 Amount—the cash that is being transferred

The client can transfer the amount required to complete the task only to the main contractor, upon request. The main contractor can then transfer this cash to the subcontractor assigned for the completion of the task.

The New Advanced Society

Подняться наверх