multichain-cli survey gettotalbalances problem

+1 vote
I'm making a survey using multichain,  initially I created a blockchain, that i will call survey, on a computer (the poll server) and I issued 10 000 assets on it (token).
The I asked two different new address to the poll server (the two candidates for the election) and gave them the permission to receive token. On another computer (ex voter n1) I then connect to the blockchain survey, ask for a new address, and with this address i can receive a token, then i send the token to one of the two candidates. So far, so good, I can track how the voting is going launching the command "multichain-cli getaddressbalances" followed by the address of the candidate from the poll server.
The problem is, when from another computer (voter n.2) I make a new address and i receive the asset (token) the problem is that the asset that i receive is one of the candidates vote.
I've noticed that when i ask for an asset the "multichain-cli survey gettotalbalances" command (initially 10 000) goes to 9 999 and when i send the token to one of the candidates the "multichain-cli survey gettotalbalances" command goes back to 10 000 and the candidates who I gave the vote goes right to 1, so i think that's because it's the same wallet. when another voter ask for a token the poll server give him the candidates token, making the "multichain-cli survey gettotalbalance addresscandidates1" command return 0.

Is it normal for the blockchain to redistribute the assets like that ?
Is there anyone who can help me with this ?
Thanks
asked Sep 1, 2018 by andre95bo

2 Answers

+1 vote
gettotalbalances gets the total balances of assets within the same wallet (or node) in this case. If you are creating many addresses from the same node and calling gettotalbalances after performing transactions it won't reflect the change as they all are part of the same wallet.

Try getaddressbalances for your scenario.
answered Sep 2, 2018 by jeshocarmel
Thank you jeshocamel for the fast response, I think i've mispelled above, when i said I used the command "multichain-cli survey gettotalbalances idcandidates" instead I was using getaddressbalances, the problem is that when i send a token to an address (candidate), and after that I ask to the poll server to give me another token to vote, it gaves me one of the token that i just gave to one of the candidates, so I'm starting to think that it's because I can just have on wallet on multichain
+1 vote

You need to use one of the APIs that controls the sending address, so you can send the funds from one specific address rather than any in the node's wallet. Take a look at sendassetfrom perhaps?

answered Sep 3, 2018 by MultiChain
Thank you so so much, it works now !!! You made my day
...