Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement black rarities #18

Merged
merged 2 commits into from
Oct 19, 2023
Merged

Implement black rarities #18

merged 2 commits into from
Oct 19, 2023

Conversation

haozhiliu
Copy link

This change implements black rarities, and return them with RPC response.

Tested with signet:

POST: rpc/v1
Data:

{
"jsonrpc": "2.0",
"method": "getSatRanges",
"params": { "utxos": [
  "be298714112a28136f8db7b3c40aca49e5a8c2d3a864750d5c0ff28d56c5705c:1"]},
"id": 0
}

Response:

{
    "jsonrpc": "2.0",
    "result": {
        "utxos": [
            {
                "rare_sats": [
                    {
                        "offset": 53652,
                        "rarity": "black-uncommon",
                        "sat": 805849999999999,
                        "sat_details": {
                            "cycle": 0,
                            "decimal": "161169.4999999999",
                            "degree": "0°161169′1905″4999999999‴",
                            "epoch": 0,
                            "height": 161169,
                            "name": "idifaoacgww",
                            "number": 805849999999999,
                            "offset": 4999999999,
                            "period": 79,
                            "rarity": "black-uncommon"
                        }
                    },
                    {
                        "offset": 53653,
                        "rarity": "uncommon",
                        "sat": 805875000000000,
                        "sat_details": {
                            "cycle": 0,
                            "decimal": "161175.0",
                            "degree": "0°161175′1911″0‴",
                            "epoch": 0,
                            "height": 161175,
                            "name": "idibxpwqcjh",
                            "number": 805875000000000,
                            "offset": 0,
                            "period": 79,
                            "rarity": "uncommon"
                        }
                    },
                    {
                        "offset": 5000053652,
                        "rarity": "black-uncommon",
                        "sat": 805879999999999,
                        "sat_details": {
                            "cycle": 0,
                            "decimal": "161175.4999999999",
                            "degree": "0°161175′1911″4999999999‴",
                            "epoch": 0,
                            "height": 161175,
                            "name": "idibhlbdgra",
                            "number": 805879999999999,
                            "offset": 4999999999,
                            "period": 79,
                            "rarity": "black-uncommon"
                        }
                    },
                    {
                        "offset": 5000067703,
                        "rarity": "uncommon",
                        "sat": 805880000000000,
                        "sat_details": {
                            "cycle": 0,
                            "decimal": "161176.0",
                            "degree": "0°161176′1912″0‴",
                            "epoch": 0,
                            "height": 161176,
                            "name": "idibhlbdgqz",
                            "number": 805880000000000,
                            "offset": 0,
                            "period": 79,
                            "rarity": "uncommon"
                        }
                    }
                ],
                "sat_ranges": [
                    {
                        "block_rarities": [
                            {
                                "block_rarity": "palindrome",
                                "chunks": [
                                    [
                                        805849999948508,
                                        805849999948509
                                    ]
                                ]
                            }
                        ],
                        "end": 805850000000000,
                        "start": 805849999946347
                    },
                    {
                        "block_rarities": [],
                        "end": 805880000000000,
                        "start": 805875000000000
                    },
                    {
                        "block_rarities": [],
                        "end": 186090370516545,
                        "start": 186090370509174
                    },
                    {
                        "block_rarities": [],
                        "end": 193490016622561,
                        "start": 193490016622340
                    },
                    {
                        "block_rarities": [],
                        "end": 193490016612340,
                        "start": 193490016612187
                    },
                    {
                        "block_rarities": [],
                        "end": 16037104144773,
                        "start": 16037104139526
                    },
                    {
                        "block_rarities": [],
                        "end": 16037104128936,
                        "start": 16037104128715
                    },
                    {
                        "block_rarities": [],
                        "end": 16037104126008,
                        "start": 16037104125508
                    },
                    {
                        "block_rarities": [],
                        "end": 193490016622340,
                        "start": 193490016622150
                    },
                    {
                        "block_rarities": [],
                        "end": 193490016622150,
                        "start": 193490016622003
                    },
                    {
                        "block_rarities": [],
                        "end": 805884999932297,
                        "start": 805880000000000
                    }
                ],
                "utxo": "be298714112a28136f8db7b3c40aca49e5a8c2d3a864750d5c0ff28d56c5705c:1"
            }
        ]
    },
    "id": 0
}

Note: this PR didn't change sat::is_common() function, which is used as part of the indexer to track inscriptions. So no need to re-index

@@ -8,6 +8,10 @@ pub enum Rarity {
Epic,
Legendary,
Mythic,
BlackUncommon,
Copy link

@mi-yu mi-yu Oct 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we keep this enum sorted in order of relative rarity? i assume black sats are less rare than Mythic

unless there is a breaking change

@haozhiliu haozhiliu merged commit 524b954 into 6.x Oct 19, 2023
nothing0012 pushed a commit that referenced this pull request Oct 23, 2023
* implement black rarities

* rename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants