qubic / core

The Qubic Core is the Node Software which runs the Qubic Network
Other
74 stars 44 forks source link

Add `qxListAssets` or similar to list all assets #109

Open nnz-qubic opened 4 months ago

nnz-qubic commented 4 months ago

Hi,

playing around I noticed that to get Qx bid/asks for an asset one needs to specify the asset name and issuer. That's because apparently it's possible to have multiple assets with the same name (CfB).

While for SC it's easy as the issuer is always the all-A (AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFXIB), getting the issuer of an asset is more complicated (*). Furthermore, with more and more Tokens being created it will be hard to keep track of which assets exist, and most probably we don't want UI/tool developers to maintain an hard-coded list of assets and their issuers.

It would be great therefore to have a way of asking nodes for a list of all existing assets, SC and tokens. Opening this issue as of CfB advice.

I haven't found where this data can be found in memory yet, but judging from the other Qx calls the implementation could be something like:

struct Assets_input
{
    uint64 offset;
};

struct Assets_output
{
    struct Asset
    {
        id issuer;
        uint64 assetName;
     };

     array<Asset, 256> assets;
};

struct Assets_locals
{
    // ...
};

PUBLIC_FUNCTION_WITH_LOCALS(Assets)
   // ...
_

This assuming is a Qx function/responsibility. It could also be just a core network message. Especially dubious after readong #102 ... Again, I'm not sure where this info is in memory yet, I'll investigate more and if able I may try and provide a PR.

(*) I haven't found a way to do it yet

Qsilver97 commented 3 months ago

You need to iterate through the universe file! There are entries for asset creation mixed in with all the transfers

To be able to get a realtime list a new core data structure is needed, TokenList I will make an issue out of that to explain in more detail and the advantages it provides