Adding data to issue transaction

+2 votes
While issuing assets is there any way to add data to data field of the issuing transaction?
asked Jul 27, 2017 by amitsh

2 Answers

+2 votes

Is this what you mean?

https://www.multichain.com/developers/json-rpc-api/

issue address name|params qty (units=1) (native-amount=min-per-output) ({"custom-field-1":"x",...})

Or

createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,...} (data=[]) (action="")

 

Update:

createrawtransaction[{"txid":"id","vout":n},...] {"address":amount,...} (data=[]) (action="")

 

Issue API: I will have to dive into the code, but I dont think data is part of issue or issuefrom

here is the raw JSON-RPC for Issue as you would add your custom data. replace the address with your address, closed (your choice), units qty etc are your choice. MyKey1 is where you place your custom key/value pair

{
    "method": "issue",
    "params": ["address", {
        "name": "AssetName",
        "open": true
    }, 10, 1.0, 0.0, {
        "MyKey1": "MyVal",
        "MyKey2": "MyVal",
    }],
    "int": 0
}

 

 

answered Jul 27, 2017 by MaSsv
edited Jul 31, 2017 by MaSsv
I want to add serial numbers to quantities issued in the issue transaction. How do I do it?
Eg: While issuing  asset1 and qty = 100, want to add data like " Sl_num_from = 00001 Sl_num_to = 00099 ".
Below is the output of issue transaction.

{
    "balance" : {
        "amount" : 0.00000000,
        "assets" : [
            {
                "name" : "abcd",
                "assetref" : "304-266-31603",
                "qty" : 100.00000000
            }
        ]
    },
    "myaddresses" : [
        "1MUnwB1zyayF52xegHBzftaJJUXDCZfZ66Uzt"
    ],
    "addresses" : [
    ],
    "permissions" : [
    ],
    "issue" : {
        "name" : "abcd",
        "assetref" : "304-266-31603",
        "multiple" : 1,
        "units" : 1.00000000,
        "open" : false,
        "details" : {
        },
        "qty" : 100.00000000,
        "raw" : 100,
        "addresses" : [
            "1MUnwB1zyayF52xegHBzftaJJUXDCZfZ66Uzt"
        ]
    },
    "items" : [
    ],
    "data" : [
    ],
    "confirmations" : 11,
    "blockhash" : "003f636c2c266070d08cde68212161295261a3958a3b03547bc4d9df4140fe93",
    "blockindex" : 1,
    "blocktime" : 1501239582,
    "txid" : "737be0f90f5ae0cc25f25762dc2b5247f9040054b40005e299b7881952bacd73",
    "valid" : true,
    "time" : 1501239571,
    "timereceived" : 1501239571
}


In this I want to add data in the data field. How to do that?
see my updated answer for raw json-rpc call.
Below is the JSON-RPC, here custom data is being added in "details" field. But I need it in "data" field. is there any way?

'{"jsonrpc":"1.0", "id":"sypplytest","method":"issuefrom","params": ["1MUnwB1zyayF52xegHBzftaJJUXDCZfZ66Uzt","1MUnwB1zyayF52xegHBzftaJJUXDCZfZ66Uzt",{"name":"Medicine0007","open":true},1000,1,0,{"Sl_num_start":"Medicine0007@7267669098","Sl_num_end":"Medicine0007@7267670098"}] }'
Try createrawtransaction
I think "createrawtransaction" is used for sending already existing assets, but I want to add data in "data" field of asset issuing transaction which is "issue", "issuefrom".
I had a quick look at source code rpcassets
https://github.com/MultiChain/multichain/blob/88c27620c8be5e086bcd2ab5a5b5d73b46a92425/src/rpc/rpcassets.cpp

The issuefromcmd doesnt seem to have what you are looking for. Perhaps the developers can help you further.
0 votes

Yes, you can add a regular metadata output to an issue transaction and this will appear in the transaction's data field. To do this you should use raw transactions. Follow the instructions linked below for issuing an asset with createrawsendfrom, but add another hexadecimal-only element to the array passed for the data parameter. https://www.multichain.com/developers/raw-transactions/

answered Jul 31, 2017 by MultiChain
...