Guides
Dash CoreDash PlatformDash.orgDash User DocsLog In
Guides
These docs are for v0.16.0. Click to read the latest docs for v0.25-redirect.

Data Trigger

Data Contract related custom logic

❗️

This page is intended to provide a brief description of how data triggers work in the first phase of Evonet. Their design will likely undergo extensive changes in the future.

Overview

Although data contracts provide much needed constraints on the structure of the data being stored on Dash Platform, there are limits to what they can do. Certain system data contracts may require server-side validation logic to operate effectively. For example, DPNS must enforce some rules to ensure names remain DNS compatible. Dash Platform Protocol (DPP) supports this application-specific custom logic using Data Triggers.

❗️

Constraints

Given a number of technical considerations (security, masternode processing capacity, etc.), data triggers are not considered a platform feature at this time. They are currently hard-coded in Dash Platform Protocol and not available for use in non-system data contracts.

Details

Since all application data is submitted in the form of documents, data triggers are defined in the context of documents. To provide even more granularity, they also incorporate the document action so separate triggers can be created for the CREATE, REPLACE, or DELETE actions.

As an example, DPP contains several data triggers for DPNS. The domain document has added constraints for creation. All DPNS document types have constraints on replacing or deleting:

Data ContractDocumentAction(s)
DPNSdomainCREATE
------------
DPNSAll Document TypesREPLACE
DPNSAll Document TypesDELETE

When document state transitions are received, DPP checks if there is a trigger associated with the document type and action. If there is, it then executes the trigger logic. Successful execution of the trigger logic is necessary for the document to be accepted and applied to the platform state.