You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/data-contracts.md
+36-3Lines changed: 36 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -226,9 +226,10 @@ The `indices` array consists of:
226
226
* A `properties` array composed of a `<field name: sort order>` object for each document field that is part of the index (sort order: [`asc` only](https://github.com/dashpay/platform/pull/435) for Dash Platform v0.23)
227
227
* An (optional) `unique` element that determines if duplicate values are allowed for the document
228
228
229
-
> 🚧 Compound Indices
230
-
>
231
-
> When defining an index with multiple properties (i.e a compound index), the order in which the properties are listed is important. Refer to the [mongoDB documentation](https://docs.mongodb.com/manual/core/index-compound/#prefixes) for details regarding the significance of the order as it relates to querying capabilities. Dash uses [GroveDB](https://github.com/dashpay/grovedb), which works similarly but does require listing all the index's fields in query order by statements.
229
+
:::{admonition} Compound Indices
230
+
:class: attention
231
+
When defining an index with multiple properties (i.e a compound index), the order in which the properties are listed is important. Refer to the [mongoDB documentation](https://docs.mongodb.com/manual/core/index-compound/#prefixes) for details regarding the significance of the order as it relates to querying capabilities. Dash uses [GroveDB](https://github.com/dashpay/grovedb), which works similarly but does require listing all the index's fields in query order by statements.
232
+
:::
232
233
233
234
```json
234
235
"indices": [
@@ -247,6 +248,38 @@ The `indices` array consists of:
247
248
]
248
249
```
249
250
251
+
#### Contested indices
252
+
253
+
Contested unique indices provide a way for multiple identities to compete for ownership when a new document field matches a predefined pattern. This system enables fair distribution of valuable documents through community-driven decision-making.
254
+
255
+
A two week contest begins when a match occurs. For the first week, additional contenders can join by paying a fee of 0.2 Dash. During this period, masternodes and evonodes vote on the outcome. The contest can result in the awarding of the document to the winner, a locked vote where no document is awarded, or potentially a restart of the contest if specific conditions are met.
256
+
257
+
The table below describes the properties used to configure a contested index:
| fieldMatches.field | string | Name of the field to check for matches |
263
+
| fieldMatches.regexPattern | string | Regex used to check for matches |
264
+
| resolution | integer | Method to resolve the contest:<br>`0` - masternode voting |
265
+
266
+
**Example**
267
+
268
+
This example (from the [DPNS contract's `domain` document](https://github.com/dashpay/platform/blob/master/packages/dpns-contract/schema/v1/dpns-contract-documents.json)) demonstrates the use of a contested index:
269
+
270
+
```json
271
+
"contested": {
272
+
"fieldMatches": [
273
+
{
274
+
"field": "normalizedLabel",
275
+
"regexPattern": "^[a-zA-Z01-]{3,19}$"
276
+
}
277
+
],
278
+
"resolution": 0,
279
+
"description": "If the normalized label part of this index is less than 20 characters (all alphabet a-z, A-Z, 0, 1, and -) then a masternode vote contest takes place to give out the name"
280
+
}
281
+
```
282
+
250
283
#### Index Constraints
251
284
252
285
For performance and security reasons, indices have the following constraints. These constraints are subject to change over time.
0 commit comments