algorithm Add_user_accounts is
input:
node_id
node main account data (node.host, node.port, node.address=${node_id}-00000000-XXXX, node.secret)
new_user_number
get_current_account_number:
call: echo '{"run":"get_block"}' | ads
from array block.nodes[] get json object which field id == ${node_id} as jsonObj
user_number := jsonObj.account_count
create_accounts:
for index := 1 to new_user_number
call: (echo '{"run":"get_me"}';echo '{"run":"create_account"}') | ads
transfer_funds:
create wire map for all new users, key is user address, value is amount, sample map: {"0001-00000001-XXXX":1.0,"0001-00000002-XXXX":1.0}
first user address is ${node_id}-{%08s}-XXXX, where s := ${user_number}, next one has same format with s=s+1
amount can be 0.1 each, sum of all amount should be less than main account balance-1 ADS, exact balance can be obtained from call echo '{"run":"get_me"}' | ads account.balance
call: (echo '{"run":"get_me"}'; echo '{"run":"send_many","wires":{"0001-00000001-XXXX":1.0,"0001-00000002-XXXX":1.0}}') | ads note that wires should be taken from previous step
It can be wrapped with