Rules (Subrealms & DMINT)
Subrealms and NFT items (with DMINT - Decentralized Mints) can be minted (or "claimed") according to the rules
set up by the owner of the parent realm or in in the case of DMINT, the creator of the container.
It is possible to pay for a subrealm or DMINT'ed item using only proof of work (Bitwork) and/or also paying any set of output addresses a certain amount of Satoshis or value in an ARC20 token.
Format of Rules Data-structure
The rules
section in the dmint
(for containers) and subrealms
section for Realms is identical and has the same syntax and semantics.
We demonstrate the use of the rules, by building upon simple examples and gradually increasing complexity.
Warning: The regex standard being used is the one in Python 3.9. This means that all regex patterns are matched in "full string mode" - meaning that the match is always from the very beginning of a string to the very end even in the absence of ^
or $
Example 1: Require only Bitworkc mining to claim mint
Require the use of Bitwork to mine on the commit transaction (bitworkc
). The pattern "p": ".*"
means to match any subrealm name or any dmint item id, then the only form of "payment" required is that the item must be minted with "bitworkc": "1234"
on the commit transaction to claim.
```json
{
"rules": [
{
"p": ".*",
"bitworkc": "1234"
}
]
}
```
Example 2: Require both Bitworkc and Bitworkr mining to claim mint
Require the use of Bitwork to mine on the commit transaction (bitworkc
). The pattern "p": ".*"
means to match any subrealm name or any dmint item id, then the form of "payment" required is that the item must be minted with "bitworkc": "1234"
on the commit transaction to claim. Additionally the reveal transaction must have "bitworkr": "8888.10" which means it must match "8888.*"
for the transaction hash as long as the 5th hex character is greater than or equal to "a" (10 in hex).
```json
{
"rules": [
{
"p": ".*",
"bitworkc": "1234",
"bitworkr": "8888.10"
}
]
}
```
Example 3: Require different Bitworkc based on the name of the item
In the third example, we specify that if the item name starts with the number "0"
or the name ends in .gif
then the Bitwork required is about 16x harder (ie: 16x more CPU/GPU mining will be required)
```json
{
"rules": [
{
"p": "^0|\.gif$",
"bitworkc": "77777"
},
{
"p": ".*",
"bitworkc": "7777"
}
]
}
```
Example 4: Require a payment to a certain address to claim the item
To enable "pay to claim" use the "o"
(output script) field to indicate what output must be paid in order to successfully claim.
```json
{
"rules": [
{
"p": ".*",
"o": {
"5120a97636cf3492a546d976e053f61b50788ef57a10b28885275b60bb369e6290e4": {
"v": 1000
}
},
}
]
}
```
The above means that the output script of 5120a97636cf3492a546d976e053f61b50788ef57a10b28885275b60bb369e6290e4 must be paid at least "v": 1000
satoshis for the claim to succeed. The script decodes to address bc1p49mrdne5j2j5dktkupflvx6s0z8027ssk2yg2f6mvzand8nzjrjqschm45
Note: Use the CLI utility commands "yarn cli script-address \