Publish to stream without using the publish method

+1 vote
First I'm trying createrawsendfrom:

createRawSendFrom, err := multichainClient.CreateRawSendFrom(sendAddress, receiveAddress, assets)

...where assets is an existing currency (I know has been issued to that address) with a zero value.

SideQuestion: What happens if the address has has no outputs pointing at it? How can it publish?

Then i'm passing the hex output to:

appendRawData, err := multichainClient.AppendRawData(tx, streamName, key, hex)

...But then when I sign it with the correct key, it is incomplete.

I tried hunting down existing examples here to find the solution but I give up.
asked Jun 25, 2018 by Alex

1 Answer

+1 vote
An address with no outputs cannot transmit any transactions. In practice this isn't a problem because when an address is granted initial permissions, that creates an output for it.

In terms of your more general question I'm not sure what library you're using there. But in a general sense to help we would need to see the actual JSON-RPC requests and responses.
answered Jun 25, 2018 by MultiChain
{"id":"multichain-client","jsonrpc":"1.0","method":"createrawsendfrom","params":["1VYWCMyPgKqwkYPrKpq2H19B8FCohE4RU6KMei",{"1VYWCMyPgKqwkYPrKpq2H19B8FCohE4RU6KMei":{"8D3C9F719F08955BDF7AE4998A1F050F":0}}]}
{"error":null,"id":"multichain-client","result":"0100000001473858f7a42a897d4e500b02d8f2133f91e5a0f8c84713552851a6cd41e228750000000000ffffffff0200000000000000003776a914d33050e6b0940f5d315d6d100970c4eacac2bca488ac1c73706b7146b620924cf82a23f3e4a25045b4548600000000000000007500000000000000001976a914d33050e6b0940f5d315d6d100970c4eacac2bca488ac00000000"}

{"id":"multichain-client","jsonrpc":"1.0","method":"appendrawdata","params":["0100000001473858f7a42a897d4e500b02d8f2133f91e5a0f8c84713552851a6cd41e228750000000000ffffffff0200000000000000003776a914d33050e6b0940f5d315d6d100970c4eacac2bca488ac1c73706b7146b620924cf82a23f3e4a25045b4548600000000000000007500000000000000001976a914d33050e6b0940f5d315d6d100970c4eacac2bca488ac00000000",{"data":"0000000000000000000000000000000000000000000000000000000000000000","for":"EB79649843464945BDF77A8CF11DACAC","key":"testkey"}]}
{"error":null,"id":"multichain-client","result":"0100000001473858f7a42a897d4e500b02d8f2133f91e5a0f8c84713552851a6cd41e228750000000000ffffffff0300000000000000003776a914d33050e6b0940f5d315d6d100970c4eacac2bca488ac1c73706b7146b620924cf82a23f3e4a25045b4548600000000000000007500000000000000001976a914d33050e6b0940f5d315d6d100970c4eacac2bca488ac0000000000000000451473706b65879fe711d7c81d67aa948efe7ebb28f5750b73706b6b746573746b6579756a20000000000000000000000000000000000000000000000000000000000000000000000000"}

Decoded output:

 {"error":null,"id":"multichain-client","result":{"locktime":0,"txid":"222c972fdbb7860f341abf3d5b441058713ea4ea1cbc6434c16cd775247ad81f","version":1,"vin":[{"scriptSig":{"asm":"","hex":""},"sequence":4294967295,"txid":"7528e241cda65128551347c8f8a0e5913f13f2d8020b504e7d892aa4f7583847","vout":0}],"vout":[{"assets":[{"assetref":"6536-761-21638","issuetxid":"8654b44550a2e4f3232af84c9220b6461f89af696f6e4bea51010699b4774d45","name":"8D3C9F719F08955BDF7AE4998A1F050F","qty":0,"raw":0,"type":"transfer"}],"n":0,"scriptPubKey":{"addresses":["1VYWCMyPgKqwkYPrKpq2H19B8FCohE4RU6KMei"],"asm":"OP_DUP OP_HASH160 d33050e6b0940f5d315d6d100970c4eacac2bca4 OP_EQUALVERIFY OP_CHECKSIG 73706b7146b620924cf82a23f3e4a25045b454860000000000000000 OP_DROP","hex":"76a914d33050e6b0940f5d315d6d100970c4eacac2bca488ac1c73706b7146b620924cf82a23f3e4a25045b45486000000000000000075","reqSigs":1,"type":"pubkeyhash"},"value":0},{"n":1,"scriptPubKey":{"addresses":["1VYWCMyPgKqwkYPrKpq2H19B8FCohE4RU6KMei"],"asm":"OP_DUP OP_HASH160 d33050e6b0940f5d315d6d100970c4eacac2bca4 OP_EQUALVERIFY OP_CHECKSIG","hex":"76a914d33050e6b0940f5d315d6d100970c4eacac2bca488ac","reqSigs":1,"type":"pubkeyhash"},"value":0},{"items":[{"createtxid":"f528bb7efe8e94aa671dc8d711e79f878af0246f07f75147ebb825e1fbaf4841","data":"0000000000000000000000000000000000000000000000000000000000000000","keys":["testkey"],"name":"EB79649843464945BDF77A8CF11DACAC","publishers":[],"streamref":"6594-1289-10485","type":"stream"}],"n":2,"scriptPubKey":{"asm":"73706b65879fe711d7c81d67aa948efe7ebb28f5 OP_DROP 73706b6b746573746b6579 OP_DROP OP_RETURN 0000000000000000000000000000000000000000000000000000000000000000","hex":"1473706b65879fe711d7c81d67aa948efe7ebb28f5750b73706b6b746573746b6579756a200000000000000000000000000000000000000000000000000000000000000000","type":"nulldata"},"value":0}]}}

Post-signature decoded output:

{"error":null,"id":"multichain-client","result":{"locktime":0,"txid":"222c972fdbb7860f341abf3d5b441058713ea4ea1cbc6434c16cd775247ad81f","version":1,"vin":[{"scriptSig":{"asm":"","hex":""},"sequence":4294967295,"txid":"7528e241cda65128551347c8f8a0e5913f13f2d8020b504e7d892aa4f7583847","vout":0}],"vout":[{"assets":[{"assetref":"6536-761-21638","issuetxid":"8654b44550a2e4f3232af84c9220b6461f89af696f6e4bea51010699b4774d45","name":"8D3C9F719F08955BDF7AE4998A1F050F","qty":0,"raw":0,"type":"transfer"}],"n":0,"scriptPubKey":{"addresses":["1VYWCMyPgKqwkYPrKpq2H19B8FCohE4RU6KMei"],"asm":"OP_DUP OP_HASH160 d33050e6b0940f5d315d6d100970c4eacac2bca4 OP_EQUALVERIFY OP_CHECKSIG 73706b7146b620924cf82a23f3e4a25045b454860000000000000000 OP_DROP","hex":"76a914d33050e6b0940f5d315d6d100970c4eacac2bca488ac1c73706b7146b620924cf82a23f3e4a25045b45486000000000000000075","reqSigs":1,"type":"pubkeyhash"},"value":0},{"n":1,"scriptPubKey":{"addresses":["1VYWCMyPgKqwkYPrKpq2H19B8FCohE4RU6KMei"],"asm":"OP_DUP OP_HASH160 d33050e6b0940f5d315d6d100970c4eacac2bca4 OP_EQUALVERIFY OP_CHECKSIG","hex":"76a914d33050e6b0940f5d315d6d100970c4eacac2bca488ac","reqSigs":1,"type":"pubkeyhash"},"value":0},{"items":[{"createtxid":"f528bb7efe8e94aa671dc8d711e79f878af0246f07f75147ebb825e1fbaf4841","data":"0000000000000000000000000000000000000000000000000000000000000000","keys":["testkey"],"name":"EB79649843464945BDF77A8CF11DACAC","publishers":[],"streamref":"6594-1289-10485","type":"stream"}],"n":2,"scriptPubKey":{"asm":"73706b65879fe711d7c81d67aa948efe7ebb28f5 OP_DROP 73706b6b746573746b6579 OP_DROP OP_RETURN 0000000000000000000000000000000000000000000000000000000000000000","hex":"1473706b65879fe711d7c81d67aa948efe7ebb28f5750b73706b6b746573746b6579756a200000000000000000000000000000000000000000000000000000000000000000","type":"nulldata"},"value":0}]}}

TRANSACTION WAS RETURNED INCOMPLETE!

The signing function I use is an API to multichain-cold, and it works fine with general stuff incl. appendrawexchange so that step should not be the problem (I don't have the debug logs to hand anyway unfortunately).
This transaction is not being signed between the two last steps. Are you following the instructions on this page closely?

https://www.multichain.com/developers/cold-nodes-wallets/
Multichain cold works fine, I have it dockerised and working sending assets etc. I know the last two jsons are the same, I need to know whether my approach is generally wrong or if the input to signrawtransaction is not correct in my example. Thanks
Okay, I fixed it. In this instance I was neglecting to pass the data on the output in the supplied origin transaction to the signing function. Cheers
Great, thanks for the update.
...