Issue assets sometimes uses wrong address

+1 vote

I'm issuing assets semi-automatically and noticed sometimes the address I used where assets should be sent to is ignored, and the address of the node is used. I'm generating them withing a couple of seconds from the last command, but I've also tried waiting a bit longer and the same issue arises. I can reproduce the issue every time following these steps:

  • create a new address
  • issue <address> EUR 1000000
  • issue <address> DOL 1000000
  • issue <address> CURA 100
  • issue <address> CURB 100

This time CURA was having the wrong address, but I've also seen DOL or CURB having the wrong address, I don't recall seeing EUR (first issued asset) have the wrong address though, but that might just be coincidence. I'm having this issue with both the API and CLI.

I'm also not sure if I should ask questions like this here or if there is a bugtracker or something like github issues page somewhere, so feel free to point me in the correct direction.

asked Oct 26, 2015 by kamme

1 Answer

0 votes

First, this is absolutely the right place to ask these questions!

I just want to confirm that the problem is with the destination address for the issue, rather than the source address. If it's the destination address, it sounds like a bug in the product (and please let us know which version you are using). If it's the source address, you should take a look at the issuefrom API instead.

answered Oct 26, 2015 by MultiChain
Ok, thanks for clearing that up. It's definitely the destination address that's being ignored, the source address is not applicable so I'm using the issue command and not the issuefrom command. I'm using the current latest version, alpha 9: MultiChain Core Daemon build 1.0 alpha 9 protocol 10002.
Thanks. I'll point the team to this and get back to you shortly.
OK, I heard back about this. The problem is that if you use the 'issue' command, then it can end up spending a previous output containing the previously issued asset for the sake of the new issue, and sending it to an address you don't expect as change. (Every transaction needs at least one input because otherwise there's no way to manage permissions of who is allowed to do what.) So while we should probably improve the coin selection algorithm to prevent this happening, in the meantime I suggest you just use 'issuefrom' instead of 'issue', which preserves the isolation of different addresses.
Thank you for your reply! I've tried using issuefrom as suggested but I always get an error: 'error: {"code":-4,"message":"Insufficient funds"}'
I've tried using the same address twice and using 2 different addresses but always get the same error.
Is there a native currency on your blockchain? If so you need to ensure that the 'issuefrom' address has enough of that currency to create the transaction.
I'm a bit confused, after reading the documentation I was under the assumption that issuefrom and issue do the same things - create an asset - so there shouldn't be any existing asset when issuing those commands. As far as I can see, that's what the issue command does anyway... Is there something I'm missing?
The point is that, in order to create a new transaction, MultiChain must spend one of the outputs of a previous transaction. This is because the signature which identifies the sender of a transaction sits inside that transaction's input, and following the bitcoin transactional model this input must spend a previous transaction's output. MultiChain always makes sure to include a change output, so that it does not run out of these outputs to spend. However this change can end up being sent to a different address than the one spent. By using issuefrom you ensure that the same address is used for input and output.
...