Extra string in transfer

+1 vote
I want to send transactions/assets and store a 32 byte string along with the transfer in the blockchain - but it doesn't appear to be possible in the current assets API.
asked Aug 31, 2015 by anonymous

2 Answers

0 votes

* Call preparelockunspent to create a single transaction output containing the assets you want to send.

* Use createrawtransaction to create a raw transaction, which spends that output and sends its contents to the other address (see MultiChain docs for how createrawtransaction is extended to support assets).

* Append the metadata to the raw transaction returned by createrawtransaction before calling signrawtransaction and sendrawtransaction. See the OP_RETURN_create_txn function in our PHP and Python libraries linked below - just skip the first line that calls createrawtransaction and instead set raw_txn/$raw_txn to the hexadecimal already generated by your call to createrawtransaction.



answered Aug 31, 2015 by MultiChain
As of alpha 7 there is a much easier way to add metadata to a transaction, via the appendrawmetadata API - see the 'Transaction metadata' section of the Getting Started guide for a full example: http://www.multichain.com/getting-started/
0 votes

You may be interested that alpha 12 adds new sendwithmetadata and sendwithmetadatafrom APIs that make all this a lot easier.

answered Nov 26, 2015 by MultiChain