MultiChain / multichain

Source code for multichaind, multichain-cli and multichain-util.
GNU General Public License v3.0
536 stars 259 forks source link

Asset name restriction error with createrawsendfrom #54

Open fonimus opened 6 years ago

fonimus commented 6 years ago

Apparently we can create assets with names which do not respect the 32 characters limitations. Those assets become unusable with their names. We are currently in production with multichain 1.0.2.

How do you think you will correct this issue ?

Here is the scenario to reproduce bug:

createrawsendfrom "<my-address>" '{"<my-address>": {"issue": {"raw": 3}}}' '[{"name": "1234567890123456789012345678901234567890"}]'
>> <hex>
signrawtransaction <hex>
>> <hex>
sendrawtransaction <hex>
>> success
listassets "1234567890123456789012345678901234567890" true
>> Could not parse asset key: 1234567890123456789012345678901234567890
listassets "*" true
[ ...
    {
        "name" : "1234567890123456789012345678901234567890",
        "issuetxid" : "8ab44b100220333cdff196c763e4ff676460c4d94ec687eb28005417e058e977",
        "assetref" : "60-265-46218",
        "multiple" : 1,
        "units" : 1.00000000,
        "open" : false,
        "details" : {
        },
        "issueqty" : 3.00000000,
        "issueraw" : 3,
        "subscribed" : false,
        "issues" : [
            {
                "txid" : "8ab44b100220333cdff196c763e4ff676460c4d94ec687eb28005417e058e977",
                "qty" : 3.00000000,
                "raw" : 3,
                "details" : {
                },
                "issuers" : [
                    "<my-address>"
                ]
            }
        ]
    }
]
gidgreen commented 6 years ago

This may just be an issue in reading the asset name for the listassets API, because the value that you passed looks like a txid, rather than a genuinely inaccessible asset. Please try using a different identifier instead of the name, e.g. the issuetxid or assetref. These also work throughout all APIs as allowed substitutes for the asset name.

fonimus commented 6 years ago

In listassets api call, I get an exception because I think the name I give is more than 31 characters.

I can still use the created asset via the issuetxid or the assetref once transaction has been confirmed.

The main issue is that there is no control over the asset name while performing createrawsendfrom, so I wonder if there will not be any side effects with those created assets which have a too long name (over 32 characters)

gidgreen commented 6 years ago

You should be able to use the issuetxid even before the asset is confirmed. We will check into this but it should be fine to work around it for now.

gidgreen commented 6 years ago

Version 1.0.5 of MultiChain has just been released, and it should fix this.