Error: Asset issue script rejected - asset with such name/asset-ref/txid already exists"

+1 vote
Hi,

We are in the process of testing the blockchain performance when trying to create 1000 and more assets.

We have a loop in which we make an "issue" call 1000 times. With each loop iteration we change the
name of the asset, so for first asset to be created the name is "test1asset1", for the second "test1asset2", the third one "test1asset3" and so on up until the last one "test1asset1000".
The "jsonCustomField" is a JSONObject containing some custom values:
{"BizDt":"2006-05-23","LastQty":"10000000.00"}

            for(int i = 0; i < 1000; i++){    
                _assetName = "test1asset" + (i + 1);
                JSONObject jsonCustomField = Utility.getJSONObject(customFieldList.get(i));
                blockchainClient.issue(
                        address,            // node address
                        _assetName,         // asset name
                        new Double(555),    // quantity
                        new Double(0.5),    // units
                        0,                  // native amount
                        jsonCustomField);   // custom field
            }
            
When we run this we manage to create a certain amount of assets, we are never able to create
all 1000 of assets. At some point after 30, 50, 60 or more assets have been created, we get
following response with error message:

{
  "result" : null,
  "id" : "6ab80d5c-7e3a-4cbd-8afd-c4e9efc4bc25",
  "error" : {
    "code" : -4,
    "message" : "Error: The transaction was rejected: 16: Asset issue script rejected - asset with such name/asset-ref/txid already exists"
  }
}

Now, name certainly does not already exist, since we are creating new ones and each asset has distinctly different name.
So the only problem may be with asset-ref or txid which we do not have control over when creating an asset. Is it possible that these items may be double created on the multichain server itself, so once it figures out that particular asset-ref or txid already is assigned to already created asset, it throws this error.
Please can you advise and assist.
asked Feb 14, 2016 by Nenad P.

1 Answer

0 votes
Thanks for reporting this. As it happens, we're already aware of the issue, which occurs when lots of assets are issued before their issuances have been confirmed in the blockchain. It will be fixed in the next alpha version - for now you can work around it by introducing an artificial delay between creating each asset.
answered Feb 14, 2016 by MultiChain
...