"version" : "1.0 alpha 19"
I have a native asset named msg_only in the chain. If I try to send zero quantity of asset from an address (new created address with permission send, receive) using sendfromaddress it fails, but it works if I use the sequence of createrawtransaction, signrawtransaction and sendrawtransaction. Once (lifetime once) the asset is part of the unspent transaction of the address, the command sendfromaddress works perfectly no matter if the destination address is self or different unlimited times. I am providing the sequence of commands to reproduce the scenario below. To me it looks like a bug in the wallet core and not the node core.
(Creating a new test address)
$ multichain-cli loan getnewaddress
1XzrPzx5PAK7xVeNue2Qa7kAfjuEgmoK3xj8L6
$ a=1XzrPzx5PAK7xVeNue2Qa7kAfjuEgmoK3xj8L6 (The newly created test address)
$ admin=1VUV2Ud8dokuP6e3DTpXVYVJX7U8d3HKdR3pZn (The address having admin and other permissions)
(Granting send,receive permission to test address $a)
{"method":"grantfrom","params":["1VUV2Ud8dokuP6e3DTpXVYVJX7U8d3HKdR3pZn","1XzrPzx5PAK7xVeNue2Qa7kAfjuEgmoK3xj8L6","send,receive"],"id":1,"chain_name":"loan"}
3d4c01887e12f484d077df7bc618f71df052d71785ea39f5fbd550579359772e
(Checking balance of test address $a)
{"method":"getaddressbalances","params":["1XzrPzx5PAK7xVeNue2Qa7kAfjuEgmoK3xj8L6"],"id":1,"chain_name":"loan"}
[]
(Making attempt to send zero quantity of msg_only asset from test address $a to $a using sendfromaddress command)
$ multichain-cli loan sendfromaddress $a $a '{"msg_only":0}'
{"method":"sendfromaddress","params":["1XzrPzx5PAK7xVeNue2Qa7kAfjuEgmoK3xj8L6","1XzrPzx5PAK7xVeNue2Qa7kAfjuEgmoK3xj8L6",{"msg_only":0}],"id":1,"chain_name":"loan"}
error code: -4 error message: Insufficient funds
(Using listunspent command to check and select an unspent txid and vout to attempt sequence of createrawtransaction, signrawtransaction and signrawtransaction)
$ multichain-cli loan listunspent 0 80000000 '["'$a'"]'
{"method":"listunspent","params":[0,80000000,["1XzrPzx5PAK7xVeNue2Qa7kAfjuEgmoK3xj8L6"]],"id":1,"chain_name":"loan"}
{
"txid" : "3d4c01887e12f484d077df7bc618f71df052d71785ea39f5fbd550579359772e",
"vout" : 0,
"address" : "1XzrPzx5PAK7xVeNue2Qa7kAfjuEgmoK3xj8L6",
"assets" : [
],
"permissions" : [
{
"connect" : false,
"send" : true,
"receive" : true,
"issue" : false,
"mine" : false,
"admin" : false,
"activate" : false,
}
]
}
(Using transactionid and vout highlighted above in createrawtransaction )
$ multichain-cli loan createrawtransaction '[{"txid":"3d4c01887e12f484d077df7bc618f71df052d71785ea39f5fbd550579359772e","vout":0}]' '{"'$a'":{"msg_only":0}}'
{"method":"createrawtransaction","params":[[{"txid":"3d4c01887e12f484d077df7bc618f71df052d71785ea39f5fbd550579359772e","vout":0}],{"1XzrPzx5PAK7xVeNue2Qa7kAfjuEgmoK3xj8L6":{"msg_only":0}}],"id":1,"chain_name":"loan"}
01000000012e7759935750d5fbf539ea8517d752f01df718c67bdf77d084f4127e88014c3d0000000000ffffffff0100000000000000003176a914e55907d8d6bacf5e8519595c5d38009de517787b88ac1673706b7117000000090100008b9200000000000000007500000000
(Using wallet default to sign the transaction )
$ multichain-cli loan signrawtransaction 01000000012e7759935750d5fbf539ea8517d752f01df718c67bdf77d084f4127e88014c3d0000000000ffffffff0100000000000000003176a914e55907d8d6bacf5e8519595c5d38009de517787b88ac1673706b7117000000090100008b9200000000000000007500000000
{"method":"signrawtransaction","params":["01000000012e7759935750d5fbf539ea8517d752f01df718c67bdf77d084f4127e88014c3d0000000000ffffffff0100000000000000003176a914e55907d8d6bacf5e8519595c5d38009de517787b88ac1673706b7117000000090100008b9200000000000000007500000000"],"id":1,"chain_name":"loan"}
{
"hex" : "01000000012e7759935750d5fbf539ea8517d752f01df718c67bdf77d084f4127e88014c3d000000006b483045022100aa26f9bc5aae78bfc16c0b0740a4d12a4fa611eca46955d057b7ecc23ad32061022028fe3121a3deaf5dd270f704a6650f0799e18e4913f86cc690c36b3be70ca6110121025e7b85b0be94bf6486df9c61f70e5ed6d5d6c3bea25c1b86494b1978d7a17473ffffffff0100000000000000003176a914e55907d8d6bacf5e8519595c5d38009de517787b88ac1673706b7117000000090100008b9200000000000000007500000000",
"complete" : true
}
(Using wallet default node to send to mine )
$ multichain-cli loan sendrawtransaction 010000............
{"method":"sendrawtransaction","params":["01000000....0000"],"id":1,"chain_name":"loan"}
8ed45d7d5387d997582d35b8013225584cc9d1aed1ddfc4d6f7f72365717555f
(Checking balance )
$ multichain-cli loan getaddressbalances $a
{"method":"getaddressbalances","params":["1XzrPzx5PAK7xVeNue2Qa7kAfjuEgmoK3xj8L6"],"id":1,"chain_name":"loan"}
[
{
"name" : "msg_only",
"assetref" : "23-265-37515",
"qty" : 0.00000000
}
]
(Re-Attempt using sendfromaddress - Now Works)
$ multichain-cli loan sendfromaddress $a $a '{"msg_only":0}'
{"method":"sendfromaddress","params":["1XzrPzx5PAK7xVeNue2Qa7kAfjuEgmoK3xj8L6","1XzrPzx5PAK7xVeNue2Qa7kAfjuEgmoK3xj8L6",{"msg_only":0}],"id":1,"chain_name":"loan"}
ad4a8fd7364a99dc23c77ffd95221112911c1b3276284073460fb906b827c73b
(Sending again to a diff address)
$ multichain-cli loan sendfromaddress $a 1NyRG1o5E3TifvnUys5PAABJZHLucptUcxPoGt '{"msg_only":0}'
{"method":"sendfromaddress","params":["1XzrPzx5PAK7xVeNue2Qa7kAfjuEgmoK3xj8L6","1NyRG1o5E3TifvnUys5PAABJZHLucptUcxPoGt",{"msg_only":0}],"id":1,"chain_name":"loan"}
6431ac2f68b1554d4a2d92f1616b354e315a22a7288dffcfa1b70baecc0b7be6
(Sending again to a diff address - 2nd time)
$ multichain-cli loan sendfromaddress $a 1NyRG1o5E3TifvnUys5PAABJZHLucptUcxPoGt '{"msg_only":0}'
{"method":"sendfromaddress","params":["1XzrPzx5PAK7xVeNue2Qa7kAfjuEgmoK3xj8L6","1NyRG1o5E3TifvnUys5PAABJZHLucptUcxPoGt",{"msg_only":0}],"id":1,"chain_name":"loan"}
4760cb166a0b0d35817a90a4944605ab146e0bba93216663af09dda1b57c27e8
(Sending from test address 2 $b to $b - Works)
$ multichain-cli loan sendfromaddress 1NyRG1o5E3TifvnUys5PAABJZHLucptUcxPoGt 1NyRG1o5E3TifvnUys5PAABJZHLucptUcxPoGt '{"msg_only":0}'{"method":"sendfromaddress","params":["1NyRG1o5E3TifvnUys5PAABJZHLucptUcxPoGt","1NyRG1o5E3TifvnUys5PAABJZHLucptUcxPoGt",{"msg_only":0}],"id":1,"chain_name":"loan"}
02b2c7451dd907f17c0509729739f4906c2717a39be9388db25108a3051bce3b
Key Observation: Once the asset becomes as part of a unspent transaction output for the address, it continues to work (even if spent). As of now there are 2 ways for making the asset using zero asset quantity transaction to an address:
1. Use the same address (to and from), using create raw ... sequence
2. From an address which have balance of asset send zero quantity of asset to this address.
3. From an address which at some point of time had sequence of activities referred in 1