Issue with sendsendasset command.

+2 votes

Hi experts,

I 've a two node setup with every default configuration. My node1 holds all the wallet addresses (created using getnewaddress) 

When I 'm trying to transfer an asset from admin to another wallet using the CLI, the transaction goes through. Now when I repeat the transaction, nothing happens. I change the amount, the transaction goes through and then when I repeat that amount again, nothing happens. Is it a issue or limitation with the blockchain itself or it's a CLI issue? When I see getaddresstransaction for the transactions where assets were not transferred I don't see anything inside the asset block. This behavior is really weird. Does it have something to do with unspent transactions? Anything else which I can check to understand the issue. 

 

[ec2-user@ip-172-31-26-41 ~]$ multichain-cli chain1 getaddressbalances "1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7" 0
{"method":"getaddressbalances","params":["1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7",0],"id":1,"chain_name":"chain1"}

[
    {
        "name" : "asset1",
        "assetref" : "60-265-32336",
        "qty" : 5.00000000
    }
]

-------------------------------------------------------------------------------------------------------------

[ec2-user@ip-172-31-26-41 ~]$ multichain-cli chain1 sendasset "1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7" asset1 2
{"method":"sendasset","params":["1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7","asset1",2],"id":1,"chain_name":"chain1"}

134e3747832f1b410f9f116f708be8823d188b93214a467fb5b207be20da9275

----------------------------------------------------------------------------------------------------------------
[ec2-user@ip-172-31-26-41 ~]$
[ec2-user@ip-172-31-26-41 ~]$ multichain-cli chain1 getaddressbalances "1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7" 0
{"method":"getaddressbalances","params":["1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7",0],"id":1,"chain_name":"chain1"}

[
    {
        "name" : "asset1",
        "assetref" : "60-265-32336",
        "qty" : 5.00000000
    }
]

------------------------------------------------------------------------------------------------------------

[ec2-user@ip-172-31-26-41 ~]$ multichain-cli chain1 getaddresstransaction "1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7" 134e3747832f1b410f9f116f708be8823d188b93214a467fb5b207be20da9275
{"method":"getaddresstransaction","params":["1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7","134e3747832f1b410f9f116f708be8823d188b93214a467fb5b207be20da9275"],"id":1,"chain_name":"chain1"}

{
    "balance" : {
        "amount" : 0.00000000,
        "assets" : [
        ]
    },
    "myaddresses" : [
        "1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7"
    ],
    "addresses" : [
    ],
    "permissions" : [
    ],
    "items" : [
    ],
    "data" : [
    ],
    "confirmations" : 4,
    "blockhash" : "0019708d793edea600fa6a04e7f91e5bbb9f921cb07617d0a553799496d6daae",
    "blockindex" : 1,
    "blocktime" : 1510827629,
    "txid" : "134e3747832f1b410f9f116f708be8823d188b93214a467fb5b207be20da9275",
    "valid" : true,
    "time" : 1510827602,
    "timereceived" : 1510827602
}

-------------------------------------------------------------------------------------------------------------

[ec2-user@ip-172-31-26-41 ~]$ multichain-cli chain1 sendasset "1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7" asset1 5
{"method":"sendasset","params":["1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7","asset1",5],"id":1,"chain_name":"chain1"}

48b28d74ff7de4da02303ff5d8ad24a3584c09f5e1b5755d3cfc4eed4d01b9d0
 

------------------------------------------------------------------------------------------------------------------

[ec2-user@ip-172-31-26-41 ~]$ multichain-cli chain1 getaddressbalances "1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7" 0
{"method":"getaddressbalances","params":["1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7",0],"id":1,"chain_name":"chain1"}

[
    {
        "name" : "asset1",
        "assetref" : "60-265-32336",
        "qty" : 10.00000000
    }
]

-----------------------------------------------------------------------------------------------------------

[ec2-user@ip-172-31-26-41 ~]$ multichain-cli chain1 getaddresstransaction "1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7" 48b28d74ff7de4da02303ff5d8ad24a3584c09f5e1b5755d3cfc4eed4d01b9d0
{"method":"getaddresstransaction","params":["1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7","48b28d74ff7de4da02303ff5d8ad24a3584c09f5e1b5755d3cfc4eed4d01b9d0"],"id":1,"chain_name":"chain1"}

{
    "balance" : {
        "amount" : 0.00000000,
        "assets" : [
            {
                "name" : "asset1",
                "assetref" : "60-265-32336",
                "qty" : 5.00000000
            }
        ]
    },
    "myaddresses" : [
        "1QXfk319xWZ87pusZczeaapgLjStLQ5zCJuSg7"
    ],
    "addresses" : [
        "18eKSJXDe7yrGZx9dpuk2oniXPbZfg3JXh8KVL"
    ],
    "permissions" : [
    ],
    "items" : [
    ],
    "data" : [
    ],
    "confirmations" : 4,
    "blockhash" : "0042b0a77dc7d94430d83e92139430bb193bb7c308e7d09984612257272a11eb",
    "blockindex" : 2,
    "blocktime" : 1510827729,
    "txid" : "48b28d74ff7de4da02303ff5d8ad24a3584c09f5e1b5755d3cfc4eed4d01b9d0",
    "valid" : true,
    "time" : 1510827724,
    "timereceived" : 1510827724
}

 

 

Thanks,

Ashish 

asked Nov 16, 2017 by ashish235

1 Answer

0 votes

The sendasset API only specifies which address the asset is sent to, but not the address the asset is sent from. So it will automatically take from any address (or even multiple addresses). In your case the problem is that you're often sending from this address back to itself. Try sendassetfrom instead.

answered Nov 16, 2017 by MultiChain
Yeah sure, will try with the sendassetfrom command. But I didn't understand " In your case the problem is that you're often sending from this address back to itself."
My to address is present in the sendasset command even if from address is changed (picked up automatically) it should give an error or at least show the from address in the transaction.
In the case where both the from and to address are the same, you'll see a single item in the myaddresses field showing that address. No error is shown in this case because it's legitimate to send funds from an address back to itself.
...