Smart contract structure

Topic: Smart Contracts

See other features of Universa Smart Contracts at Smart Contract Designer Central; the overall smart contract structure, references, etc.

Overview

Each smart contract usually has several sections. In the example YAML representation (see .yml files in Github), they are represented by the top-level fields, such as definition or state; see details below.

Sections

api_level

The integer value containing the current API version. Currently set to 3.

definition

Contains the data that must be invariant in any future revisions of this contract. Altering any data here is a violation, and the Universa node (when comparing the new revision with the previous one) should prohibit registration of a contract altered this way.

definition.data

TBD

definition.permissions

TBD

state

Contains the data that can be altered in a new revision of the contract. The particular details of what and how may be altered, can be specified inside definition.permissions.

transactional

Contains the data that will not (necessary) be kept in the contract, but is bound just to the transaction. For example, when paying to some recipient, the payer can put a record about the payment reason/invoice code to the transactional data.