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

Improve clarity on asset mint and universe stats RPC responses #553

Merged
merged 6 commits into from
Oct 11, 2023

Conversation

guggero
Copy link
Member

@guggero guggero commented Oct 6, 2023

Fixes #522.

Depends on #556.

Addresses the following items:

  1. Show group anchor when minting grouped assets
  2. Serialize sprouts of finalized batch (this also discovered a bug with the TapCommitment for grouped assets which we fix)
  3. Make distinction between group anchor and single asset more clear in QueryAssetStats by putting them into different fields (see below)
  4. Show total supply of asset group both in overall universe stats and individual stats.

Example output of tapcli universe stats:

{
    "num_total_assets": "707037",
    "num_total_groups": "4",
    "num_total_syncs": "200",
    "num_total_proofs": "204"
}

Example output of tapcli universe stats assets --sort_by asset_name:

{
    "asset_stats": [
        {
            "group_key": "02e46677e636646628ae8d5850faafa137dbad2d7fee2079193c700430c50c818f",
            "group_supply": "705500",
            "group_anchor": {
                "asset_id": "7080c11a75ee6f286e1ed2c043ada20ad566c76b463b183111c7b7f8ce49a3b7",
                "genesis_point": "db198dea904ba078cfbf7738312351488b77b790ea2630d1caa5843793c36ea0:1",
                "total_supply": "500",
                "asset_name": "OLIBUX1",
                "asset_type": "NORMAL",
                "genesis_height": 192,
                "genesis_timestamp": "1696609501"
            },
            "asset": null,
            "total_syncs": "0",
            "total_proofs": "3"
        },
        {
            "group_key": "",
            "group_supply": "0",
            "group_anchor": null,
            "asset": {
                "asset_id": "7f3f37d2afbccb90abf2d56036aa64adce432c65d686e705cf6a3401d8321ca4",
                "genesis_point": "e912509957ab4a5e5e4a4c21fd33eda85601a71e58c21a14e449626d7ea12d1d:1",
                "total_supply": "1337",
                "asset_name": "OLIBUX1337",
                "asset_type": "NORMAL",
                "genesis_height": 193,
                "genesis_timestamp": "1696609572"
            },
            "total_syncs": "0",
            "total_proofs": "1"
        },
        {
            "group_key": "03e20eee073814638b134062948c0d37b93e2d45ca18066ee86440d305cec1f711",
            "group_supply": "100",
            "group_anchor": {
                "asset_id": "e3e174b0a2295831735813122967b00942d77ce20048c5d05e54089a05cc95ae",
                "genesis_point": "042eb4c4327e898bcbef4677a60315c9d1ab915df2096175a7ebaf7606aa3cc4:1",
                "total_supply": "1",
                "asset_name": "jpeg-1169692082-0",
                "asset_type": "COLLECTIBLE",
                "genesis_height": 190,
                "genesis_timestamp": "1696609434"
            },
            "asset": null,
            "total_syncs": "100",
            "total_proofs": "100"
        }
    ]
}

cc @jamaljsr

@jamaljsr
Copy link
Member

jamaljsr commented Oct 6, 2023

Thanks so much for these updates! I'll test it out locally, but at first glance, this is looking great 👍

@jamaljsr
Copy link
Member

jamaljsr commented Oct 9, 2023

I ran the same script from #522 using this branch. The assets stats output looks great now. 👌

One minor quirk I noticed is that the output of tapcli assets mint finalize now has duplicate assets listed, one with a group_key value and one without.

View CLI commands & output
Creating 5 TEST collectibles on bob
Minting anchor asset TEST101
bobtap assets mint --type collectible --name TEST101 --supply 1 --enable_emission
Batch key: 0216751043e0c2c55eeedadedae4b83b5d3aca0466b1ba490a95ebdf1b57a39674

Minting remaining assets...
bobtap assets mint --type collectible --name TEST102 --supply 1 --group_anchor TEST101
{
    "pending_batch":  {
        "batch_key":  "0216751043e0c2c55eeedadedae4b83b5d3aca0466b1ba490a95ebdf1b57a39674",
        "assets":  [
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST101",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  ""
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST102",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  "TEST101"
            }
        ],
        "state":  "BATCH_STATE_PEDNING"
    }
}
bobtap assets mint --type collectible --name TEST103 --supply 1 --group_anchor TEST101
{
    "pending_batch":  {
        "batch_key":  "0216751043e0c2c55eeedadedae4b83b5d3aca0466b1ba490a95ebdf1b57a39674",
        "assets":  [
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST101",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  ""
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST102",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  "TEST101"
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST103",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  "TEST101"
            }
        ],
        "state":  "BATCH_STATE_PEDNING"
    }
}
bobtap assets mint --type collectible --name TEST104 --supply 1 --group_anchor TEST101
{
    "pending_batch":  {
        "batch_key":  "0216751043e0c2c55eeedadedae4b83b5d3aca0466b1ba490a95ebdf1b57a39674",
        "assets":  [
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST102",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  "TEST101"
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST103",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  "TEST101"
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST104",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  "TEST101"
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST101",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  ""
            }
        ],
        "state":  "BATCH_STATE_PEDNING"
    }
}
bobtap assets mint --type collectible --name TEST105 --supply 1 --group_anchor TEST101
{
    "pending_batch":  {
        "batch_key":  "0216751043e0c2c55eeedadedae4b83b5d3aca0466b1ba490a95ebdf1b57a39674",
        "assets":  [
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST105",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  "TEST101"
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST101",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  ""
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST102",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  "TEST101"
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST103",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  "TEST101"
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST104",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  "TEST101"
            }
        ],
        "state":  "BATCH_STATE_PEDNING"
    }
}

Previewing batch...
bobtap assets mint batches --batch_key 0216751043e0c2c55eeedadedae4b83b5d3aca0466b1ba490a95ebdf1b57a39674
{
    "batches":  [
        {
            "batch_key":  "0216751043e0c2c55eeedadedae4b83b5d3aca0466b1ba490a95ebdf1b57a39674",
            "assets":  [
                {
                    "asset_type":  "COLLECTIBLE",
                    "name":  "TEST101",
                    "asset_meta":  null,
                    "amount":  "1",
                    "group_key":  "",
                    "group_anchor":  ""
                },
                {
                    "asset_type":  "COLLECTIBLE",
                    "name":  "TEST102",
                    "asset_meta":  null,
                    "amount":  "1",
                    "group_key":  "",
                    "group_anchor":  "TEST101"
                },
                {
                    "asset_type":  "COLLECTIBLE",
                    "name":  "TEST103",
                    "asset_meta":  null,
                    "amount":  "1",
                    "group_key":  "",
                    "group_anchor":  "TEST101"
                },
                {
                    "asset_type":  "COLLECTIBLE",
                    "name":  "TEST104",
                    "asset_meta":  null,
                    "amount":  "1",
                    "group_key":  "",
                    "group_anchor":  "TEST101"
                },
                {
                    "asset_type":  "COLLECTIBLE",
                    "name":  "TEST105",
                    "asset_meta":  null,
                    "amount":  "1",
                    "group_key":  "",
                    "group_anchor":  "TEST101"
                }
            ],
            "state":  "BATCH_STATE_PEDNING"
        }
    ]
}

Finalizing mint...
bobtap assets mint finalize
{
    "batch":  {
        "batch_key":  "0216751043e0c2c55eeedadedae4b83b5d3aca0466b1ba490a95ebdf1b57a39674",
        "assets":  [
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST101",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  ""
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST102",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  "TEST101"
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST103",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  "TEST101"
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST104",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  "TEST101"
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST105",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "",
                "group_anchor":  "TEST101"
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST101",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
                "group_anchor":  ""
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST103",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
                "group_anchor":  ""
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST104",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
                "group_anchor":  ""
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST105",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
                "group_anchor":  ""
            },
            {
                "asset_type":  "COLLECTIBLE",
                "name":  "TEST102",
                "asset_meta":  null,
                "amount":  "1",
                "group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
                "group_anchor":  ""
            }
        ],
        "state":  "BATCH_STATE_BROADCAST"
    }
}

Assets created. Mining blocks to confirm...
mine 1
mine 1

bobtap assets mint batches --batch_key 0216751043e0c2c55eeedadedae4b83b5d3aca0466b1ba490a95ebdf1b57a39674
{
    "batches":  [
        {
            "batch_key":  "0216751043e0c2c55eeedadedae4b83b5d3aca0466b1ba490a95ebdf1b57a39674",
            "assets":  [
                {
                    "asset_type":  "COLLECTIBLE",
                    "name":  "TEST104",
                    "asset_meta":  {
                        "data":  "",
                        "type":  "META_TYPE_OPAQUE",
                        "meta_hash":  "01e246b58d8e782fc96881c090d833eefa37e804cb308aeae0f7471c9ef1ea1a"
                    },
                    "amount":  "1",
                    "group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
                    "group_anchor":  ""
                },
                {
                    "asset_type":  "COLLECTIBLE",
                    "name":  "TEST105",
                    "asset_meta":  {
                        "data":  "",
                        "type":  "META_TYPE_OPAQUE",
                        "meta_hash":  "01e246b58d8e782fc96881c090d833eefa37e804cb308aeae0f7471c9ef1ea1a"
                    },
                    "amount":  "1",
                    "group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
                    "group_anchor":  ""
                },
                {
                    "asset_type":  "COLLECTIBLE",
                    "name":  "TEST102",
                    "asset_meta":  {
                        "data":  "",
                        "type":  "META_TYPE_OPAQUE",
                        "meta_hash":  "01e246b58d8e782fc96881c090d833eefa37e804cb308aeae0f7471c9ef1ea1a"
                    },
                    "amount":  "1",
                    "group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
                    "group_anchor":  ""
                },
                {
                    "asset_type":  "COLLECTIBLE",
                    "name":  "TEST101",
                    "asset_meta":  {
                        "data":  "",
                        "type":  "META_TYPE_OPAQUE",
                        "meta_hash":  "01e246b58d8e782fc96881c090d833eefa37e804cb308aeae0f7471c9ef1ea1a"
                    },
                    "amount":  "1",
                    "group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
                    "group_anchor":  ""
                },
                {
                    "asset_type":  "COLLECTIBLE",
                    "name":  "TEST103",
                    "asset_meta":  {
                        "data":  "",
                        "type":  "META_TYPE_OPAQUE",
                        "meta_hash":  "01e246b58d8e782fc96881c090d833eefa37e804cb308aeae0f7471c9ef1ea1a"
                    },
                    "amount":  "1",
                    "group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
                    "group_anchor":  ""
                }
            ],
            "state":  "BATCH_STATE_FINALIZED"
        }
    ]
}

bobtap universe stats
{
    "num_total_assets":  "5",
    "num_total_groups":  "1",
    "num_total_syncs":  "0",
    "num_total_proofs":  "5"
}
bobtap universe stats events
{
    "events":  [
        {
            "date":  "2023-10-09",
            "sync_events":  "0",
            "new_proof_events":  "5"
        }
    ]
}
bobtap universe stats assets --sort_by asset_name
{
    "asset_stats":  [
        {
            "group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
            "group_supply":  "5",
            "group_anchor":  {
                "asset_id":  "2d6946dd8ac0923db04610cb0cf1860c943a1ec6f81073a51b50bccf109d8d23",
                "genesis_point":  "0f579bd004ddeb30ed397ae3ad388714f71c3427e74799b742899ca71a7bea6d:1",
                "total_supply":  "1",
                "asset_name":  "TEST101",
                "asset_type":  "COLLECTIBLE",
                "genesis_height":  303,
                "genesis_timestamp":  "1696870544"
            },
            "asset":  null,
            "total_syncs":  "0",
            "total_proofs":  "5"
        }
    ]
}
bobtap assets list
{
    "assets":  [
        {
            "version":  0,
            "asset_genesis":  {
                "genesis_point":  "0f579bd004ddeb30ed397ae3ad388714f71c3427e74799b742899ca71a7bea6d:1",
                "name":  "TEST101",
                "meta_hash":  "0000000000000000000000000000000000000000000000000000000000000000",
                "asset_id":  "2d6946dd8ac0923db04610cb0cf1860c943a1ec6f81073a51b50bccf109d8d23",
                "output_index":  0,
                "version":  0
            },
            "asset_type":  "COLLECTIBLE",
            "amount":  "1",
            "lock_time":  0,
            "relative_lock_time":  0,
            "script_version":  0,
            "script_key":  "0269ff4b7775a121a2a369da5b3d76895f422b72d728df10506768cc1d15dee48d",
            "script_key_is_local":  true,
            "asset_group":  {
                "raw_group_key":  "02b5e37919bf335e4c15aabf35cf9426b881f441bab398268d1abe12ffc2ab4789",
                "tweaked_group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
                "asset_witness":  "0140f68dde0878141c0f5a976e929b1a64702f1b488480ae6b20cfdb934acbdb62ba7d2b5024adb966c256372e2ae4a29eb1af32ea3c4b41c4acf2b8dff1442dc7aa"
            },
            "chain_anchor":  {
                "anchor_tx":  "020000000001016dea7b1aa79c8942b79947e727341cf7148738ade37a39ed30ebdd04d09b570f0100000000ffffffff02e8030000000000002251207ab4b7ef8c24901431d6477bbde5836744097e3bc1c7629e8339fb80d015300469dbdd2b000000002251208af37138c98a8d7f47201038bca558f5340cfeae879afb351f8501921ce6761c0140b4b6375d86dcc181a9906fe7306bcd2bd42ae2e94c4a79d8afe1f799297b867261a9b200eb5f00a632a7cfb3d6e9e2885928b16ba806665f25a20ff26ae20f9c00000000",
                "anchor_txid":  "e6d7883b4e69658837491bf94321a472840e5b72b743f86e6d5cbfdd14e39541",
                "anchor_block_hash":  "16f9e17b3a8c502deae5f4cb76d6850234ef4328a28a9895492161883bcdf9e6",
                "anchor_outpoint":  "e6d7883b4e69658837491bf94321a472840e5b72b743f86e6d5cbfdd14e39541:0",
                "internal_key":  "0216751043e0c2c55eeedadedae4b83b5d3aca0466b1ba490a95ebdf1b57a39674",
                "merkle_root":  "a22ca0c0756679aeb693d6d3dad9c1b603cbd8937f3c3cc7a4ce3c3bc3012cd7",
                "tapscript_sibling":  "",
                "block_height":  0
            },
            "prev_witnesses":  [],
            "is_spent":  false,
            "lease_owner":  "",
            "lease_expiry":  "0",
            "is_burn":  false
        },
        {
            "version":  0,
            "asset_genesis":  {
                "genesis_point":  "0f579bd004ddeb30ed397ae3ad388714f71c3427e74799b742899ca71a7bea6d:1",
                "name":  "TEST103",
                "meta_hash":  "0000000000000000000000000000000000000000000000000000000000000000",
                "asset_id":  "b06763a165eb7a890f50f69756a67ea7b5d5a433be2f8e776ad4c310bf041b4f",
                "output_index":  0,
                "version":  0
            },
            "asset_type":  "COLLECTIBLE",
            "amount":  "1",
            "lock_time":  0,
            "relative_lock_time":  0,
            "script_version":  0,
            "script_key":  "02ec703f7f8daf9fb9d8293e1bc2d9add37f6f77b633b3190d7b1251ad39a211f3",
            "script_key_is_local":  true,
            "asset_group":  {
                "raw_group_key":  "02b5e37919bf335e4c15aabf35cf9426b881f441bab398268d1abe12ffc2ab4789",
                "tweaked_group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
                "asset_witness":  "0140ac5556444321152e5c835f1dff72868681bbec8d8bcced7eb4257539d0de860e629e878cff2273b009e971a253f73029e0ed304fabc90193255fd17a27149c47"
            },
            "chain_anchor":  {
                "anchor_tx":  "020000000001016dea7b1aa79c8942b79947e727341cf7148738ade37a39ed30ebdd04d09b570f0100000000ffffffff02e8030000000000002251207ab4b7ef8c24901431d6477bbde5836744097e3bc1c7629e8339fb80d015300469dbdd2b000000002251208af37138c98a8d7f47201038bca558f5340cfeae879afb351f8501921ce6761c0140b4b6375d86dcc181a9906fe7306bcd2bd42ae2e94c4a79d8afe1f799297b867261a9b200eb5f00a632a7cfb3d6e9e2885928b16ba806665f25a20ff26ae20f9c00000000",
                "anchor_txid":  "e6d7883b4e69658837491bf94321a472840e5b72b743f86e6d5cbfdd14e39541",
                "anchor_block_hash":  "16f9e17b3a8c502deae5f4cb76d6850234ef4328a28a9895492161883bcdf9e6",
                "anchor_outpoint":  "e6d7883b4e69658837491bf94321a472840e5b72b743f86e6d5cbfdd14e39541:0",
                "internal_key":  "0216751043e0c2c55eeedadedae4b83b5d3aca0466b1ba490a95ebdf1b57a39674",
                "merkle_root":  "a22ca0c0756679aeb693d6d3dad9c1b603cbd8937f3c3cc7a4ce3c3bc3012cd7",
                "tapscript_sibling":  "",
                "block_height":  0
            },
            "prev_witnesses":  [],
            "is_spent":  false,
            "lease_owner":  "",
            "lease_expiry":  "0",
            "is_burn":  false
        },
        {
            "version":  0,
            "asset_genesis":  {
                "genesis_point":  "0f579bd004ddeb30ed397ae3ad388714f71c3427e74799b742899ca71a7bea6d:1",
                "name":  "TEST104",
                "meta_hash":  "0000000000000000000000000000000000000000000000000000000000000000",
                "asset_id":  "c6afa23e5e9409d520507a6da894937f2c153e45b28d8787be55d261833d873c",
                "output_index":  0,
                "version":  0
            },
            "asset_type":  "COLLECTIBLE",
            "amount":  "1",
            "lock_time":  0,
            "relative_lock_time":  0,
            "script_version":  0,
            "script_key":  "0292e4d756d5be79e94e312be4545bee009896a6ad53ed485efb5d693a41636370",
            "script_key_is_local":  true,
            "asset_group":  {
                "raw_group_key":  "02b5e37919bf335e4c15aabf35cf9426b881f441bab398268d1abe12ffc2ab4789",
                "tweaked_group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
                "asset_witness":  "014014bc31fdbb7ce576aea6abb8279706d7a29d4da55e1619557a872f677b30beba3781067e5d2ba5d75580fdee46352de6914af713fb7d1f0a25786c0b5e2742aa"
            },
            "chain_anchor":  {
                "anchor_tx":  "020000000001016dea7b1aa79c8942b79947e727341cf7148738ade37a39ed30ebdd04d09b570f0100000000ffffffff02e8030000000000002251207ab4b7ef8c24901431d6477bbde5836744097e3bc1c7629e8339fb80d015300469dbdd2b000000002251208af37138c98a8d7f47201038bca558f5340cfeae879afb351f8501921ce6761c0140b4b6375d86dcc181a9906fe7306bcd2bd42ae2e94c4a79d8afe1f799297b867261a9b200eb5f00a632a7cfb3d6e9e2885928b16ba806665f25a20ff26ae20f9c00000000",
                "anchor_txid":  "e6d7883b4e69658837491bf94321a472840e5b72b743f86e6d5cbfdd14e39541",
                "anchor_block_hash":  "16f9e17b3a8c502deae5f4cb76d6850234ef4328a28a9895492161883bcdf9e6",
                "anchor_outpoint":  "e6d7883b4e69658837491bf94321a472840e5b72b743f86e6d5cbfdd14e39541:0",
                "internal_key":  "0216751043e0c2c55eeedadedae4b83b5d3aca0466b1ba490a95ebdf1b57a39674",
                "merkle_root":  "a22ca0c0756679aeb693d6d3dad9c1b603cbd8937f3c3cc7a4ce3c3bc3012cd7",
                "tapscript_sibling":  "",
                "block_height":  0
            },
            "prev_witnesses":  [],
            "is_spent":  false,
            "lease_owner":  "",
            "lease_expiry":  "0",
            "is_burn":  false
        },
        {
            "version":  0,
            "asset_genesis":  {
                "genesis_point":  "0f579bd004ddeb30ed397ae3ad388714f71c3427e74799b742899ca71a7bea6d:1",
                "name":  "TEST105",
                "meta_hash":  "0000000000000000000000000000000000000000000000000000000000000000",
                "asset_id":  "9b00234972d3fc9af89e06184a23979529e899339a85ac76b8b93c8ce75782e9",
                "output_index":  0,
                "version":  0
            },
            "asset_type":  "COLLECTIBLE",
            "amount":  "1",
            "lock_time":  0,
            "relative_lock_time":  0,
            "script_version":  0,
            "script_key":  "02448254575e5626a12a19daf1d57681ce17316fd69dba818f373351f761c82bd1",
            "script_key_is_local":  true,
            "asset_group":  {
                "raw_group_key":  "02b5e37919bf335e4c15aabf35cf9426b881f441bab398268d1abe12ffc2ab4789",
                "tweaked_group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
                "asset_witness":  "014001a76b98ff922069baa074559f8d73a11818156c04859d9c389bb03f67e738ed0ae67bdef7330ae265058a0b99672d137c18d8a96976983de13da729cd80a6ee"
            },
            "chain_anchor":  {
                "anchor_tx":  "020000000001016dea7b1aa79c8942b79947e727341cf7148738ade37a39ed30ebdd04d09b570f0100000000ffffffff02e8030000000000002251207ab4b7ef8c24901431d6477bbde5836744097e3bc1c7629e8339fb80d015300469dbdd2b000000002251208af37138c98a8d7f47201038bca558f5340cfeae879afb351f8501921ce6761c0140b4b6375d86dcc181a9906fe7306bcd2bd42ae2e94c4a79d8afe1f799297b867261a9b200eb5f00a632a7cfb3d6e9e2885928b16ba806665f25a20ff26ae20f9c00000000",
                "anchor_txid":  "e6d7883b4e69658837491bf94321a472840e5b72b743f86e6d5cbfdd14e39541",
                "anchor_block_hash":  "16f9e17b3a8c502deae5f4cb76d6850234ef4328a28a9895492161883bcdf9e6",
                "anchor_outpoint":  "e6d7883b4e69658837491bf94321a472840e5b72b743f86e6d5cbfdd14e39541:0",
                "internal_key":  "0216751043e0c2c55eeedadedae4b83b5d3aca0466b1ba490a95ebdf1b57a39674",
                "merkle_root":  "a22ca0c0756679aeb693d6d3dad9c1b603cbd8937f3c3cc7a4ce3c3bc3012cd7",
                "tapscript_sibling":  "",
                "block_height":  0
            },
            "prev_witnesses":  [],
            "is_spent":  false,
            "lease_owner":  "",
            "lease_expiry":  "0",
            "is_burn":  false
        },
        {
            "version":  0,
            "asset_genesis":  {
                "genesis_point":  "0f579bd004ddeb30ed397ae3ad388714f71c3427e74799b742899ca71a7bea6d:1",
                "name":  "TEST102",
                "meta_hash":  "0000000000000000000000000000000000000000000000000000000000000000",
                "asset_id":  "f0a75c8de57e7ed2a6d7cfb7f4b94b9659096ecaa299ab77ca646176bf7219fb",
                "output_index":  0,
                "version":  0
            },
            "asset_type":  "COLLECTIBLE",
            "amount":  "1",
            "lock_time":  0,
            "relative_lock_time":  0,
            "script_version":  0,
            "script_key":  "02af9b8e349563f864ea20f6654790186e8385303e939c012db8c30a8c678c9afb",
            "script_key_is_local":  true,
            "asset_group":  {
                "raw_group_key":  "02b5e37919bf335e4c15aabf35cf9426b881f441bab398268d1abe12ffc2ab4789",
                "tweaked_group_key":  "027018ae77072546a1083639d6678dd0ea6de003a6e178f1f414050d801f44d129",
                "asset_witness":  "0140117e9e0061884231962241d2b8bf3ed6dcbee6bae68e3f33615fd9599ec1b308aa16fd01579da77e543dbb815516822596a4539f5534796cb88ceec7e4c2444b"
            },
            "chain_anchor":  {
                "anchor_tx":  "020000000001016dea7b1aa79c8942b79947e727341cf7148738ade37a39ed30ebdd04d09b570f0100000000ffffffff02e8030000000000002251207ab4b7ef8c24901431d6477bbde5836744097e3bc1c7629e8339fb80d015300469dbdd2b000000002251208af37138c98a8d7f47201038bca558f5340cfeae879afb351f8501921ce6761c0140b4b6375d86dcc181a9906fe7306bcd2bd42ae2e94c4a79d8afe1f799297b867261a9b200eb5f00a632a7cfb3d6e9e2885928b16ba806665f25a20ff26ae20f9c00000000",
                "anchor_txid":  "e6d7883b4e69658837491bf94321a472840e5b72b743f86e6d5cbfdd14e39541",
                "anchor_block_hash":  "16f9e17b3a8c502deae5f4cb76d6850234ef4328a28a9895492161883bcdf9e6",
                "anchor_outpoint":  "e6d7883b4e69658837491bf94321a472840e5b72b743f86e6d5cbfdd14e39541:0",
                "internal_key":  "0216751043e0c2c55eeedadedae4b83b5d3aca0466b1ba490a95ebdf1b57a39674",
                "merkle_root":  "a22ca0c0756679aeb693d6d3dad9c1b603cbd8937f3c3cc7a4ce3c3bc3012cd7",
                "tapscript_sibling":  "",
                "block_height":  0
            },
            "prev_witnesses":  [],
            "is_spent":  false,
            "lease_owner":  "",
            "lease_expiry":  "0",
            "is_burn":  false
        }
    ]
}

I also wrote another script to mint multiple tranches of normal assets in order to see how the stats output is reflected in this case. The only problem I've found here is in the tapcli universe stats output. The num_total_assets value is returning the combined supply of all the tranches (600) instead of the total number of assets (3).

View CLI commands & output
Creating 3 tranches of TEST on bob
Minting anchor asset TEST
bobtap assets mint --type normal --name TEST --supply 100 --enable_emission
{
    "pending_batch":  {
        "batch_key":  "0311c5d99547bd18ffb58c8bd14a6cb5e2e6615cce68e93bc07cd17e80f355ca03",
        "assets":  [
            {
                "asset_type":  "NORMAL",
                "name":  "TEST",
                "asset_meta":  null,
                "amount":  "100",
                "group_key":  "",
                "group_anchor":  ""
            }
        ],
        "state":  "BATCH_STATE_PEDNING"
    }
}
bobtap assets mint finalize
{
    "batch":  {
        "batch_key":  "0311c5d99547bd18ffb58c8bd14a6cb5e2e6615cce68e93bc07cd17e80f355ca03",
        "assets":  [
            {
                "asset_type":  "NORMAL",
                "name":  "TEST",
                "asset_meta":  null,
                "amount":  "100",
                "group_key":  "",
                "group_anchor":  ""
            },
            {
                "asset_type":  "NORMAL",
                "name":  "TEST",
                "asset_meta":  null,
                "amount":  "100",
                "group_key":  "03af4c71a953942aa29eb46d55fa61a4fba63470a9cf686cc6ce9dcc712af2390f",
                "group_anchor":  ""
            }
        ],
        "state":  "BATCH_STATE_BROADCAST"
    }
}

Asset created. Mining blocks to confirm...
mine 1
mine 6


run bobtap assets list | jq '.assets[0].asset_group.tweaked_group_key' -r
Group Key: 03af4c71a953942aa29eb46d55fa61a4fba63470a9cf686cc6ce9dcc712af2390f

Minting remaining assets...
bobtap assets mint --type normal --name bitcoind --supply 200 --group_key 03af4c71a953942aa29eb46d55fa61a4fba63470a9cf686cc6ce9dcc712af2390f
{
    "pending_batch":  {
        "batch_key":  "02bb31ea25e61734dc9419f07ef4348477866d4668d4f1c87897f3125371f6fed0",
        "assets":  [
            {
                "asset_type":  "NORMAL",
                "name":  "bitcoind",
                "asset_meta":  null,
                "amount":  "200",
                "group_key":  "03af4c71a953942aa29eb46d55fa61a4fba63470a9cf686cc6ce9dcc712af2390f",
                "group_anchor":  ""
            }
        ],
        "state":  "BATCH_STATE_PEDNING"
    }
}
bobtap assets mint finalize
{
    "batch":  {
        "batch_key":  "02bb31ea25e61734dc9419f07ef4348477866d4668d4f1c87897f3125371f6fed0",
        "assets":  [
            {
                "asset_type":  "NORMAL",
                "name":  "bitcoind",
                "asset_meta":  null,
                "amount":  "200",
                "group_key":  "03af4c71a953942aa29eb46d55fa61a4fba63470a9cf686cc6ce9dcc712af2390f",
                "group_anchor":  ""
            },
            {
                "asset_type":  "NORMAL",
                "name":  "bitcoind",
                "asset_meta":  null,
                "amount":  "200",
                "group_key":  "03af4c71a953942aa29eb46d55fa61a4fba63470a9cf686cc6ce9dcc712af2390f",
                "group_anchor":  ""
            }
        ],
        "state":  "BATCH_STATE_BROADCAST"
    }
}

Asset created. Mining blocks to confirm...
mine 1
mine 6

bobtap assets mint --type normal --name bitcoind --supply 300 --group_key 03af4c71a953942aa29eb46d55fa61a4fba63470a9cf686cc6ce9dcc712af2390f
{
    "pending_batch":  {
        "batch_key":  "0315c6aa736463e8716723e18b648c0ab1de89a18b3b5aee9d9fe49b3e79c008a9",
        "assets":  [
            {
                "asset_type":  "NORMAL",
                "name":  "bitcoind",
                "asset_meta":  null,
                "amount":  "300",
                "group_key":  "03af4c71a953942aa29eb46d55fa61a4fba63470a9cf686cc6ce9dcc712af2390f",
                "group_anchor":  ""
            }
        ],
        "state":  "BATCH_STATE_PEDNING"
    }
}
bobtap assets mint finalize
{
    "batch":  {
        "batch_key":  "0315c6aa736463e8716723e18b648c0ab1de89a18b3b5aee9d9fe49b3e79c008a9",
        "assets":  [
            {
                "asset_type":  "NORMAL",
                "name":  "bitcoind",
                "asset_meta":  null,
                "amount":  "300",
                "group_key":  "03af4c71a953942aa29eb46d55fa61a4fba63470a9cf686cc6ce9dcc712af2390f",
                "group_anchor":  ""
            },
            {
                "asset_type":  "NORMAL",
                "name":  "bitcoind",
                "asset_meta":  null,
                "amount":  "300",
                "group_key":  "03af4c71a953942aa29eb46d55fa61a4fba63470a9cf686cc6ce9dcc712af2390f",
                "group_anchor":  ""
            }
        ],
        "state":  "BATCH_STATE_BROADCAST"
    }
}

Asset created. Mining blocks to confirm...
mine 1
mine 6


bobtap universe stats
{
    "num_total_assets":  "600",
    "num_total_groups":  "1",
    "num_total_syncs":  "0",
    "num_total_proofs":  "3"
}
bobtap universe stats events
{
    "events":  [
        {
            "date":  "2023-10-09",
            "sync_events":  "0",
            "new_proof_events":  "3"
        }
    ]
}
bobtap universe stats assets --sort_by asset_name
{
    "asset_stats":  [
        {
            "group_key":  "03af4c71a953942aa29eb46d55fa61a4fba63470a9cf686cc6ce9dcc712af2390f",
            "group_supply":  "600",
            "group_anchor":  {
                "asset_id":  "32e930c6ad0ff1f564536ddc415b01e72ad86c45e12dc3798bf38ab1d3ccc730",
                "genesis_point":  "482d4de9e00a0967cadebea0901133c88d0c26539481741159a0f5864778a1b9:1",
                "total_supply":  "100",
                "asset_name":  "TEST",
                "asset_type":  "NORMAL",
                "genesis_height":  303,
                "genesis_timestamp":  "1696876456"
            },
            "asset":  null,
            "total_syncs":  "0",
            "total_proofs":  "3"
        }
    ]
}
bobtap assets list
{
    "assets":  [
        {
            "version":  0,
            "asset_genesis":  {
                "genesis_point":  "482d4de9e00a0967cadebea0901133c88d0c26539481741159a0f5864778a1b9:1",
                "name":  "TEST",
                "meta_hash":  "0000000000000000000000000000000000000000000000000000000000000000",
                "asset_id":  "32e930c6ad0ff1f564536ddc415b01e72ad86c45e12dc3798bf38ab1d3ccc730",
                "output_index":  0,
                "version":  0
            },
            "asset_type":  "NORMAL",
            "amount":  "100",
            "lock_time":  0,
            "relative_lock_time":  0,
            "script_version":  0,
            "script_key":  "02cd2d754e98c43be34e5e0e931bce1c104e4301814d177790a0eb2c67ca1c0535",
            "script_key_is_local":  true,
            "asset_group":  {
                "raw_group_key":  "038cbdc4669760325108e8162c46a5cfc6c09981e24e3909913d96b12568204fec",
                "tweaked_group_key":  "03af4c71a953942aa29eb46d55fa61a4fba63470a9cf686cc6ce9dcc712af2390f",
                "asset_witness":  "0140b34d257e96ba506860506bf09e1f15f72a56b9c9f2419728c42ecfcc3fe259836e28bbe925b3f2f4dd5e0aad39741de47352b4cd453ffce83406ccac80e97aaa"
            },
            "chain_anchor":  {
                "anchor_tx":  "02000000000101b9a1784786f5a0591174819453260c8dc8331190a0bedeca67090ae0e94d2d480100000000ffffffff02e80300000000000022512009c143b964afaa7a59543e30c44c1ab45587f5a8972e8653e50ed9561e13fb5769dbdd2b0000000022512031116255be1cc3cd70193ba77cf4ad4022abd19cfb937b863dee3fa9f6be7bf101407fbf99dab9f290721c72bc7868620f8355298536177f65bc9af86582c83883b436f60cc70826e3c92d55cd58c0d8be947c41691e423d06fb4f513c27d19f9b8b00000000",
                "anchor_txid":  "2a05acfa1a6f3d3fae7370150b95f7c09e645fba7a907ca7f067e6886c9a58ff",
                "anchor_block_hash":  "35a031c952da27076ee8a936c28cc9d74512440db8b655a25e98bdc3d120f6ed",
                "anchor_outpoint":  "2a05acfa1a6f3d3fae7370150b95f7c09e645fba7a907ca7f067e6886c9a58ff:0",
                "internal_key":  "0311c5d99547bd18ffb58c8bd14a6cb5e2e6615cce68e93bc07cd17e80f355ca03",
                "merkle_root":  "cc283f964e7fd2651213d704dbf36d70196d702fd21206925e1d2d67b642722e",
                "tapscript_sibling":  "",
                "block_height":  0
            },
            "prev_witnesses":  [],
            "is_spent":  false,
            "lease_owner":  "",
            "lease_expiry":  "0",
            "is_burn":  false
        },
        {
            "version":  0,
            "asset_genesis":  {
                "genesis_point":  "2a05acfa1a6f3d3fae7370150b95f7c09e645fba7a907ca7f067e6886c9a58ff:1",
                "name":  "bitcoind",
                "meta_hash":  "0000000000000000000000000000000000000000000000000000000000000000",
                "asset_id":  "83130e7f524272a409056a0d718963054b4adc0b529f474ba07d73a25e27d26b",
                "output_index":  0,
                "version":  0
            },
            "asset_type":  "NORMAL",
            "amount":  "200",
            "lock_time":  0,
            "relative_lock_time":  0,
            "script_version":  0,
            "script_key":  "02644b69155fc243bc544067921b4f3ab23139a5043b97770ac004969c265d0738",
            "script_key_is_local":  true,
            "asset_group":  {
                "raw_group_key":  "038cbdc4669760325108e8162c46a5cfc6c09981e24e3909913d96b12568204fec",
                "tweaked_group_key":  "03af4c71a953942aa29eb46d55fa61a4fba63470a9cf686cc6ce9dcc712af2390f",
                "asset_witness":  "01401b3f4e56ca2c3a5789ce3d044c6bf31b4951e9723ec721a607f4ce67ce15f7a77f474606db31d2e14294b2b19ce02b8ca0944591548b3ae122b2964c3e60ef51"
            },
            "chain_anchor":  {
                "anchor_tx":  "02000000000101ff589a6c88e667f0a77c907aba5f649ec0f7950b157073ae3f3d6f1afaac052a0100000000ffffffff02e80300000000000022512027bad6e8e3ca83f3c2e50f16292e92cf0d433bf2be3a55880b5cf4efa2c49b963bb9dd2b00000000225120c4e45f0f84d4768b8b9cb49737ca8f3e7607b5ab733fea7f5c6bcc4dc11d3f65014090fd07d6a60e5062a4719e8cd97f889d78789010d81f1bc31be0535cbfb0e2cce771a60810a56de7c44d8d8c9350264c13a0383bc637deb9612c9f2acc4999de00000000",
                "anchor_txid":  "2a4f97b194615115410e9b8bc154142a4738afe4c727568950bf89274c596487",
                "anchor_block_hash":  "3b5a96afaeecfcdf1e3dde6fd666d010cb66e5a9b19e4774c6c9db7d84a410f3",
                "anchor_outpoint":  "2a4f97b194615115410e9b8bc154142a4738afe4c727568950bf89274c596487:0",
                "internal_key":  "02bb31ea25e61734dc9419f07ef4348477866d4668d4f1c87897f3125371f6fed0",
                "merkle_root":  "c1d38ddde5971dd622fadd4b1216e1f2799ecc601f0f8a2c675621221ad4b72f",
                "tapscript_sibling":  "",
                "block_height":  0
            },
            "prev_witnesses":  [],
            "is_spent":  false,
            "lease_owner":  "",
            "lease_expiry":  "0",
            "is_burn":  false
        },
        {
            "version":  0,
            "asset_genesis":  {
                "genesis_point":  "2a4f97b194615115410e9b8bc154142a4738afe4c727568950bf89274c596487:1",
                "name":  "bitcoind",
                "meta_hash":  "0000000000000000000000000000000000000000000000000000000000000000",
                "asset_id":  "40f03552d0567bec2c8cc0f1a59415d576cbdebb6693e57ea954d5c035128634",
                "output_index":  0,
                "version":  0
            },
            "asset_type":  "NORMAL",
            "amount":  "300",
            "lock_time":  0,
            "relative_lock_time":  0,
            "script_version":  0,
            "script_key":  "02be41a48592298827df84510d12cb85e6b3189a19d640837067acf7ce56963332",
            "script_key_is_local":  true,
            "asset_group":  {
                "raw_group_key":  "038cbdc4669760325108e8162c46a5cfc6c09981e24e3909913d96b12568204fec",
                "tweaked_group_key":  "03af4c71a953942aa29eb46d55fa61a4fba63470a9cf686cc6ce9dcc712af2390f",
                "asset_witness":  "0140bbac7229221cd67b0efe4ed7aad01248d1c06f5779631951a8ac01aa576dc6723af16072949146f221cef2f21910c137acc36d05bf303dc2f0f347fe0e9d9d1d"
            },
            "chain_anchor":  {
                "anchor_tx":  "020000000001018764594c2789bf50895627c7e4af38472a1454c18b9b0e4115516194b1974f2a0100000000ffffffff02e803000000000000225120c7beaf36a04ab720fb50631936d09486bc1854db9c4a4e79ed367119686866390d97dd2b000000002251209fbdd47a15ac8a5bf98128a43488b3034978e8e312261830597cfbd8474e520c01406134f03aed4265fbd577ee9eca4d7e212ba01697dae7daf669bb4f27d9253a74dc4f275ba538e8ee0e937e89d545dfcc308fad62084542d533b1936415c3b66a00000000",
                "anchor_txid":  "16373edb869d7b102829ba2ac9472de86743fab7978d211e8525b4d875926253",
                "anchor_block_hash":  "5a415d6fc91e5f608df20a47e8fc2463048e3a187ca501ba61b0ff3a6158c76d",
                "anchor_outpoint":  "16373edb869d7b102829ba2ac9472de86743fab7978d211e8525b4d875926253:0",
                "internal_key":  "0315c6aa736463e8716723e18b648c0ab1de89a18b3b5aee9d9fe49b3e79c008a9",
                "merkle_root":  "51ec9f10d5e023fa2b7c25e25258974ee8f818e8cdd9af36c07b1f6c94b87371",
                "tapscript_sibling":  "",
                "block_height":  0
            },
            "prev_witnesses":  [],
            "is_spent":  false,
            "lease_owner":  "",
            "lease_expiry":  "0",
            "is_burn":  false
        }
    ]
}

Since the asset stats are now grouped by group_key, it would be nice if the output included all minted assets of a group and not just the anchor asset. Then we'd be able to display in the UI all of the asset_ids/outpoints/timestamps of each tranche. I think this would be very helpful for users to be able to identify which tranche minted the asset they hold. This isn't necessary for TW right now, just figured I'd make a note of it here for the future.

@guggero guggero force-pushed the mint-rpc-fixes branch 4 times, most recently from 78f0a4e to ac16ee0 Compare October 10, 2023 09:13
@guggero
Copy link
Member Author

guggero commented Oct 10, 2023

@jamaljsr thanks again for the detailed tests and info, really helpful!

One minor quirk I noticed is that the output of tapcli assets mint finalize now has duplicate assets listed, one with a group_key value and one without.

That's fixed in the latest version.

I also wrote another script to mint multiple tranches of normal assets in order to see how the stats output is reflected in this case. The only problem I've found here is in the tapcli universe stats output. The num_total_assets value is returning the combined supply of all the tranches (600) instead of the total number of assets (3).

I added the number of tranches as well now. This should currently be the same number as the number of proofs, as we only store issuance proofs. But when we start storing transfer proofs those numbers will start to diverge, so I think it's good to have that separate number.

Since the asset stats are now grouped by group_key, it would be nice if the output included all minted assets of a group and not just the anchor asset. Then we'd be able to display in the UI all of the asset_ids/outpoints/timestamps of each tranche. I think this would be very helpful for users to be able to identify which tranche minted the asset they hold. This isn't necessary for TW right now, just figured I'd make a note of it here for the future.

I'm not sure the universe stats call is the right one for that? Since this is supposed to be somewhat condensed. You could still look up all assets within a group, since you have the group key in the result.

Copy link
Collaborator

@jharveyb jharveyb left a comment

Choose a reason for hiding this comment

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

Looking really good!

IIUC NumTranches is now the count of all issuance events, including ungrouped assets?

itest/assertions.go Outdated Show resolved Hide resolved
tapdb/universe_stats_test.go Outdated Show resolved Hide resolved
rpcserver.go Show resolved Hide resolved
@guggero
Copy link
Member Author

guggero commented Oct 10, 2023

This PR now depends on #556, as it made more sense to group all bug fixes into a single PR.

Copy link
Collaborator

@jharveyb jharveyb left a comment

Choose a reason for hiding this comment

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

LGTM 💯

Will def need to have these fields well-documented somewhere.

rpcserver.go Show resolved Hide resolved
rpcserver.go Show resolved Hide resolved
tapdb/sqlc/queries/universe.sql Outdated Show resolved Hide resolved
tapdb/sqlc/queries/universe.sql Outdated Show resolved Hide resolved
universe/interface.go Outdated Show resolved Hide resolved
tapdb/sqlc/queries/universe.sql Outdated Show resolved Hide resolved
tapdb/sqlc/queries/universe.sql Outdated Show resolved Hide resolved
tapdb/sqlc/queries/universe.sql Show resolved Hide resolved
@jamaljsr
Copy link
Member

jamaljsr commented Oct 10, 2023

I added the number of tranches as well now. This should currently be the same number as the number of proofs, as we only store issuance proofs. But when we start storing transfer proofs those numbers will start to diverge, so I think it's good to have that separate number.

What does a tranche represent? I thought it meant that if I mint an asset, then wait sometime and mint more of that same asset, then wait some time and mint more, this would be considered 3 tranches. In my testing, the num_total_asset_tranches value appears to represent the number of unique assets where groups are counted as 1. Is this correct?

Mint 3 assets with the same group_key over time
Creating 3 tranches of MEME on bob
Minting anchor asset MEME
bobtap assets mint --type normal --name MEME --supply 100 --enable_emission
{
    "pending_batch": {
        "batch_key": "038a6ba7f4230ad9f8c17bea6436bbcc1ecbe56be8787f1e6bc8747cfcd71ec5b7",
        "assets": [
            {
                "asset_type": "NORMAL",
                "name": "MEME",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            }
        ],
        "state": "BATCH_STATE_PEDNING"
    }
}
bobtap assets mint finalize
{
    "batch": {
        "batch_key": "038a6ba7f4230ad9f8c17bea6436bbcc1ecbe56be8787f1e6bc8747cfcd71ec5b7",
        "assets": [
            {
                "asset_type": "NORMAL",
                "name": "MEME",
                "asset_meta": null,
                "amount": "100",
                "group_key": "03c643329bedae9c726ebb5c5bc43418f48ad657be23559684c48eac7da77f91a1",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            }
        ],
        "state": "BATCH_STATE_BROADCAST"
    }
}

Asset created. Mining blocks to confirm...
mine 1
mine 6


run bobtap assets list | jq '.assets[0].asset_group.tweaked_group_key' -r
Group Key: 03c643329bedae9c726ebb5c5bc43418f48ad657be23559684c48eac7da77f91a1

Minting remaining assets...
bobtap assets mint --type normal --name MEME --supply 200 --group_key 03c643329bedae9c726ebb5c5bc43418f48ad657be23559684c48eac7da77f91a1
{
    "pending_batch": {
        "batch_key": "038135b97a1403136d152a2f4760a92ea1cd354304100dd5ace431ece0c856e527",
        "assets": [
            {
                "asset_type": "NORMAL",
                "name": "MEME",
                "asset_meta": null,
                "amount": "200",
                "group_key": "03c643329bedae9c726ebb5c5bc43418f48ad657be23559684c48eac7da77f91a1",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            }
        ],
        "state": "BATCH_STATE_PEDNING"
    }
}
bobtap assets mint finalize
{
    "batch": {
        "batch_key": "038135b97a1403136d152a2f4760a92ea1cd354304100dd5ace431ece0c856e527",
        "assets": [
            {
                "asset_type": "NORMAL",
                "name": "MEME",
                "asset_meta": null,
                "amount": "200",
                "group_key": "03c643329bedae9c726ebb5c5bc43418f48ad657be23559684c48eac7da77f91a1",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            }
        ],
        "state": "BATCH_STATE_BROADCAST"
    }
}

Asset created. Mining blocks to confirm...
mine 1
mine 6

bobtap assets mint --type normal --name MEME --supply 300 --group_key 03c643329bedae9c726ebb5c5bc43418f48ad657be23559684c48eac7da77f91a1
{
    "pending_batch": {
        "batch_key": "021a65896aa71142a758d322775e03733279e76c18056c5fdedc4799be18e264d1",
        "assets": [
            {
                "asset_type": "NORMAL",
                "name": "MEME",
                "asset_meta": null,
                "amount": "300",
                "group_key": "03c643329bedae9c726ebb5c5bc43418f48ad657be23559684c48eac7da77f91a1",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            }
        ],
        "state": "BATCH_STATE_PEDNING"
    }
}
bobtap assets mint finalize
{
    "batch": {
        "batch_key": "021a65896aa71142a758d322775e03733279e76c18056c5fdedc4799be18e264d1",
        "assets": [
            {
                "asset_type": "NORMAL",
                "name": "MEME",
                "asset_meta": null,
                "amount": "300",
                "group_key": "03c643329bedae9c726ebb5c5bc43418f48ad657be23559684c48eac7da77f91a1",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            }
        ],
        "state": "BATCH_STATE_BROADCAST"
    }
}

Asset created. Mining blocks to confirm...
mine 1
mine 6


bobtap universe stats
{
    "num_total_asset_units": "600",
    "num_total_asset_tranches": "1",
    "num_total_groups": "1",
    "num_total_syncs": "0",
    "num_total_proofs": "3"
}
bobtap universe stats events
{
    "events": [
        {
            "date": "2023-10-10",
            "sync_events": "0",
            "new_proof_events": "3"
        }
    ]
}
bobtap universe stats assets --sort_by asset_name
{
    "asset_stats": [
        {
            "group_key": "03c643329bedae9c726ebb5c5bc43418f48ad657be23559684c48eac7da77f91a1",
            "group_supply": "600",
            "group_anchor": {
                "asset_id": "1306fe515cca58c1b128235070d68abdc4bf940ef0aaab3d2e9c24aeeaa5cbb3",
                "genesis_point": "8b6acaedace1f1ac663a9249126bd54e8aff203135aa3b9217a6960e942e4678:1",
                "total_supply": "100",
                "asset_name": "MEME",
                "asset_type": "NORMAL",
                "genesis_height": 303,
                "genesis_timestamp": "1696967890"
            },
            "asset": null,
            "total_syncs": "0",
            "total_proofs": "3"
        }
    ]
}
Mint 5 distinct assets on the same node as above
Creating 5 assets for bob
{
    "pending_batch": {
        "batch_key": "02d532f90ed91f9d7137f6f3b594ef5937ab51d0ba63bb65997a93b8b64a2a1d6f",
        "assets": [
            {
                "asset_type": "NORMAL",
                "name": "TEST101",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            }
        ],
        "state": "BATCH_STATE_PEDNING"
    }
}
{
    "pending_batch": {
        "batch_key": "02d532f90ed91f9d7137f6f3b594ef5937ab51d0ba63bb65997a93b8b64a2a1d6f",
        "assets": [
            {
                "asset_type": "NORMAL",
                "name": "TEST102",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            },
            {
                "asset_type": "NORMAL",
                "name": "TEST101",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            }
        ],
        "state": "BATCH_STATE_PEDNING"
    }
}
{
    "pending_batch": {
        "batch_key": "02d532f90ed91f9d7137f6f3b594ef5937ab51d0ba63bb65997a93b8b64a2a1d6f",
        "assets": [
            {
                "asset_type": "NORMAL",
                "name": "TEST101",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            },
            {
                "asset_type": "NORMAL",
                "name": "TEST102",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            },
            {
                "asset_type": "NORMAL",
                "name": "TEST103",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            }
        ],
        "state": "BATCH_STATE_PEDNING"
    }
}
{
    "pending_batch": {
        "batch_key": "02d532f90ed91f9d7137f6f3b594ef5937ab51d0ba63bb65997a93b8b64a2a1d6f",
        "assets": [
            {
                "asset_type": "NORMAL",
                "name": "TEST101",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            },
            {
                "asset_type": "NORMAL",
                "name": "TEST102",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            },
            {
                "asset_type": "NORMAL",
                "name": "TEST103",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            },
            {
                "asset_type": "NORMAL",
                "name": "TEST104",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            }
        ],
        "state": "BATCH_STATE_PEDNING"
    }
}
{
    "pending_batch": {
        "batch_key": "02d532f90ed91f9d7137f6f3b594ef5937ab51d0ba63bb65997a93b8b64a2a1d6f",
        "assets": [
            {
                "asset_type": "NORMAL",
                "name": "TEST102",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            },
            {
                "asset_type": "NORMAL",
                "name": "TEST103",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            },
            {
                "asset_type": "NORMAL",
                "name": "TEST104",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            },
            {
                "asset_type": "NORMAL",
                "name": "TEST105",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            },
            {
                "asset_type": "NORMAL",
                "name": "TEST101",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            }
        ],
        "state": "BATCH_STATE_PEDNING"
    }
}
{
    "batch": {
        "batch_key": "02d532f90ed91f9d7137f6f3b594ef5937ab51d0ba63bb65997a93b8b64a2a1d6f",
        "assets": [
            {
                "asset_type": "NORMAL",
                "name": "TEST105",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            },
            {
                "asset_type": "NORMAL",
                "name": "TEST101",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            },
            {
                "asset_type": "NORMAL",
                "name": "TEST102",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            },
            {
                "asset_type": "NORMAL",
                "name": "TEST103",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            },
            {
                "asset_type": "NORMAL",
                "name": "TEST104",
                "asset_meta": null,
                "amount": "100",
                "group_key": "",
                "group_anchor": "",
                "asset_version": "ASSET_VERSION_V0"
            }
        ],
        "state": "BATCH_STATE_BROADCAST"
    }
}
Assets created. Mining blocks to confirm
bobtap universe stats
{
    "num_total_asset_units": "1100",
    "num_total_asset_tranches": "6",
    "num_total_groups": "1",
    "num_total_syncs": "0",
    "num_total_proofs": "8"
}
bobtap universe stats events
{
    "events": [
        {
            "date": "2023-10-10",
            "sync_events": "0",
            "new_proof_events": "8"
        }
    ]
}
bobtap universe stats assets --sort_by asset_name
{
    "asset_stats": [
        {
            "group_key": "03c643329bedae9c726ebb5c5bc43418f48ad657be23559684c48eac7da77f91a1",
            "group_supply": "600",
            "group_anchor": {
                "asset_id": "1306fe515cca58c1b128235070d68abdc4bf940ef0aaab3d2e9c24aeeaa5cbb3",
                "genesis_point": "8b6acaedace1f1ac663a9249126bd54e8aff203135aa3b9217a6960e942e4678:1",
                "total_supply": "100",
                "asset_name": "MEME",
                "asset_type": "NORMAL",
                "genesis_height": 303,
                "genesis_timestamp": "1696967890"
            },
            "asset": null,
            "total_syncs": "0",
            "total_proofs": "3"
        },
        {
            "group_key": "",
            "group_supply": "0",
            "group_anchor": null,
            "asset": {
                "asset_id": "2acf2f1e802ca2eea428a4a77a0c05db29e025df53b63e5f05148ab90e009e49",
                "genesis_point": "f2a7def720fc98636e4cfd5b33c32ab546f1632de67e4c34c914d25fa9c2bbc2:1",
                "total_supply": "100",
                "asset_name": "TEST101",
                "asset_type": "NORMAL",
                "genesis_height": 324,
                "genesis_timestamp": "1696968305"
            },
            "total_syncs": "0",
            "total_proofs": "1"
        },
        {
            "group_key": "",
            "group_supply": "0",
            "group_anchor": null,
            "asset": {
                "asset_id": "e196c63d7a138b265df9496ab3b6e73773e493a43885a4b049a7a6ba61909b66",
                "genesis_point": "f2a7def720fc98636e4cfd5b33c32ab546f1632de67e4c34c914d25fa9c2bbc2:1",
                "total_supply": "100",
                "asset_name": "TEST102",
                "asset_type": "NORMAL",
                "genesis_height": 324,
                "genesis_timestamp": "1696968305"
            },
            "total_syncs": "0",
            "total_proofs": "1"
        },
        {
            "group_key": "",
            "group_supply": "0",
            "group_anchor": null,
            "asset": {
                "asset_id": "db902116c7e3a83f32e3bcfb267ee807ca0898945bc2beb8add373739c757f12",
                "genesis_point": "f2a7def720fc98636e4cfd5b33c32ab546f1632de67e4c34c914d25fa9c2bbc2:1",
                "total_supply": "100",
                "asset_name": "TEST103",
                "asset_type": "NORMAL",
                "genesis_height": 324,
                "genesis_timestamp": "1696968305"
            },
            "total_syncs": "0",
            "total_proofs": "1"
        },
        {
            "group_key": "",
            "group_supply": "0",
            "group_anchor": null,
            "asset": {
                "asset_id": "c9658e6365dcb4d19dc6dd33820253c54e0e0b0887538e78920ec62a6fb9a406",
                "genesis_point": "f2a7def720fc98636e4cfd5b33c32ab546f1632de67e4c34c914d25fa9c2bbc2:1",
                "total_supply": "100",
                "asset_name": "TEST104",
                "asset_type": "NORMAL",
                "genesis_height": 324,
                "genesis_timestamp": "1696968305"
            },
            "total_syncs": "0",
            "total_proofs": "1"
        },
        {
            "group_key": "",
            "group_supply": "0",
            "group_anchor": null,
            "asset": {
                "asset_id": "e9225923da8b91b525a6d5ee968545c62052d928d03617dcea340afff9baab84",
                "genesis_point": "f2a7def720fc98636e4cfd5b33c32ab546f1632de67e4c34c914d25fa9c2bbc2:1",
                "total_supply": "100",
                "asset_name": "TEST105",
                "asset_type": "NORMAL",
                "genesis_height": 324,
                "genesis_timestamp": "1696968305"
            },
            "total_syncs": "0",
            "total_proofs": "1"
        }
    ]
}

@Roasbeef
Copy link
Member

num_total_asset_tranches value appears to represent the number of unique assets where groups are counted as 1. Is this correct?

Yeah that's correct, we're planning on renaming that to just num_total_assets.

We want to be able to match the group key with universe roots, which use
the x-only (32-byte) part of the group key. To make the matching easier,
we add a x_only_group_key version of the tweaked group key to the
key_group_info_view.
@guggero guggero requested a review from Roasbeef October 10, 2023 21:05
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 🥐

@Roasbeef Roasbeef merged commit 9330a5d into main Oct 11, 2023
14 checks passed
@guggero guggero deleted the mint-rpc-fixes branch October 11, 2023 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[bug] Correct collectible-groups universe stats+assets mint batches CLI output
4 participants