{"id":107612,"date":"2023-08-09T21:43:46","date_gmt":"2023-08-09T21:43:46","guid":{"rendered":"https:\/\/www.dash.org\/?p=107612"},"modified":"2023-08-12T03:24:10","modified_gmt":"2023-08-12T03:24:10","slug":"dash-platform-data-contracts","status":"publish","type":"post","link":"https:\/\/www.dash.org\/blog\/dash-platform-data-contracts\/","title":{"rendered":"Dash Platform Data Contracts"},"content":{"rendered":"

Everyone in Web3 already knows of\u00a0smart contracts<\/span>,\u00a0the groundbreaking innovation of Ethereum that popularized the concept of a\u00a0dapp. However, few are aware of Dash Platform\u2019s new supplement to smart contracts that will make dapp development more accessible to the masses:\u00a0data contracts<\/span>.<\/span><\/p>\n

Data contracts are a powerful tool already used widely across the Web2 data services\u00a0landscape due to their many benefits to user and developer experience. They\u2019re relatively simple JSON schemas that define the structures of data a dapp can store. Utilizing them in Dash Platform allows us to take advantage of their traditional benefits\u00a0while\u00a0also enabling Web2 developers to store their app data on a decentralized Web3 platform without needing to\u00a0learn a smart\u00a0contract language like Solidity. Rather, they can easily do so just by using constructs they\u2019re already familiar with.<\/span><\/p>\n

In addition to greater accessibility and smoother user experience, data contracts also enable a variety of other useful features, such as easy indexing, versioning, and\u00a0built-in documentation. Ultimately, they will assist in the cultivation of a diverse ecosystem of Dash-based dapps, and more widespread adoption for crypto as a whole.<\/p>\n

This article accompanies the release of\u00a0dashpay.io<\/a><\/span>, a web app where users can automatically generate a data contract based on descriptions of their intended dapp using AI. We will begin by walking through the high-level architecture and applications of data contracts before going back and diving deeper into the architecture details.<\/span><\/p>\n

Application<\/span><\/h3>\n

At a high level, a Dash Platform data contract is a JSON schema that defines the structures of the data a dapp will store. It\u00a0defines the\u00a0allowed properties<\/span>, such as \u201ccity\u201d or \u201ccuisine\u201d for a restaurant dapp, the\u00a0validation logic<\/span>, such as the \u201cmaxLength\u201d of a string property, and the\u00a0indexes<\/span>\u00a0created on the properties. Developers must submit their data contracts to Platform for system-level validation before the users of their dapps may submit documents to their data contracts for dapp-level validation. This ensures that the dapp data will play nicely with the rest of the system while giving developers control over the structure and types of data that can be submitted to their dapps. Data contracts are therefore useful for a number of reasons beyond just enabling an easy transition from Web2 to Web3:<\/span><\/p>\n