Batch for sending coin not working

+1 vote

Hello,

I'm trying to setup a batch in order to send some coins to all the addresses through the multichain-cli.

Here is my code :

#!/bin/bash

echo "Fetching all addresses from Multichain..."

addresses=$(multichain-cli mychain getaddresses)

for address in $addresses; do
    extract=${address:1:38}
    if [ ! -z $extract ]; then
        multichain-cli mychain send $extract 10
    fi
done

exit 0

But sometimes this fails with :

error code: -704
error message:
Insufficient funds, but there are coins belonging to addresses without send or receive permission.

... and all the addresses seems to have an empty balance (no more coin...)

Is this normal?

Thanks in advance for your help.

 

asked Jan 24, 2018 by el

1 Answer

0 votes

First I'm not sure that your bash script syntax is correct, since multichain-cli responses are in JSON format, and I'm not sure the script is processing that correctly. But putting that question aside, it will probably be better if you are explicit about which address you want to send the coins *from*, i.e. use sendfrom instead of send. Then if the error appears again we'll know better what to check.

answered Jan 25, 2018 by MultiChain
What I want to achieve is to "generate" some coins and send them to every address.

Am I wrong with using a "send" directly from the multichain-cli?
The send command does not generate coins – it sends those that are already in the sending wallet. Assuming you want to use the native blockchain currency rather than an issued asset, coins are only generated in block rewards. It sounds like you might want to consider using an issued asset instead, in which case if the asset is issued as "open", more units can be created at any time.
...