Schema
In fact, the Schema validation is the very first operation step that a user needsrepresents to undergo before interacting in any way with the contract (e.g. to perform the desired contract operations).
From a functional point of view, the Schema construct addresses the following questions:
How state data are allowed to change within state transitions?
What sequences of transitions are allowed?
From a technical point of view, an RGB Schema is a functional declarative document that need to be compiled for effective usage inside RGB applications and wallets.
Among the most important properties, a Schema:
References an optional Root
SchemaId
from which a basic and customizable structure layout is derived.Metadata.
Owned state.
Global state.
Valences.
Contract Operation.
Defines all the data structure required for Genesis operation, which marks the first instantiation of the contract.
Allows for programmed updates to the contract without having to modify the infrastructure software, so that wallets and explorers can accept modified asset types without making any changes to their respective code.
Even this architectural choice regarding Schema appears to be very different from blockchain-based contracts, for example, those implemented on Ethereum. Indeed in these latter systems, the contract itself is provided as an executable code that implements the rules for changing and implementing the state which is eventually directly stored into the blockchain. In contrast, in RGB the contract is encoded in a purely declarative way.
In every Contract Operation performed in the client-side validation phase, the Contract Schema is always referenced and checked against. In particular, after compilation, the Schema can provide all the necessary data structure to perform the issuance of the contract represented by the Genesis Operation.
After compilation, the Schema is encoded in a .rgb
binary file or in an .rgba
armored binary file, which can be imported by the wallet software.
In the next subsection, we will provide an example of an actual Schema used for the issuance of a Non Inflatable Fungible Asset.
Last updated