[CLI Feature] Send coda to multiple address

it would be great to implement a feature to send coda to multiple address with the same amount without keep executing same command twice.

coda send-multiple-payment NUMBER_OF_ADDRESS ADDRESS_1 ADDRESS_2 AMOUNT_CODA

coda send-multiple-payment 2 0x00000001 0x00000002 3

discord: ansonlau3#9535

1 Like

There does seem to be a similar feature:

$ coda advanced help batch-send-payments
Send multiple payments from a file

$ coda advanced batch-send-payments PAYMENTS-FILE

It’s not clear what format that PAYMENTS-FILE needs to be in?

I really like the original suggestion, but why not make it more generic so you don’t have to pay the same amount and maybe pass in an array of JSON objects for the payment address, amount and memo?

coda-cli sendmany "from" '[{"address": "to" ,"amount": 100, "memo": "mymemo"}]' fee

1 Like

@garethtdavies It’s kind of cryptic, but imputing bad parameters to the batch-send-payments command gets you the OCaml s-expression it’s expecting:

$ coda advanced batch-send-payments -privkey-path ~/foo foo
Could not read payments from foo.
The file should be a sexp list of payments. Here is an example file:
(((receiver
   tNciBPvhjLJTGqLwYD9kvKrGYPLZGMrt9crpTTH4mSFUCtBEGKJqiymKpsoczAGFDiRGmGhe3R1owhmdFekMBDmBoGru8H5eDNrwW8ksp7osMSuwx5SeYTHdCp48dffSdz6xp4DesywDqA)
  (amount 4) (fee 44))
 ((receiver
   tNciHMA61fxCfe1B8N2e2cn2Fb77pnSnqihRrwwMSaGUERVXqNyMazQ4HP1mDUNKRTAYEkxwBd5UQzypiad6hyV5xFgRcHksjrCHtzZ3HpMNtkr7p2K2f5hqAuztGxo45zwhAyW1C78yVb)
  (amount 30) (fee 84))
 ((receiver
   tNciLFRoB5cPRXV7Aqj18dyHH3NzBDQ69ZiW4Ynkq2EPfRr2RGQsRPYptYLeogC2MJjAj7EVE3W4QvGTsiVoU5bneSpMHa8V8eQskgDAxPjkmVC57xXC5PrUC36mi3F8Xi7TrD7pL6kPNL)
  (amount 81) (fee 50)))
1 Like
#!/usr/bin/python3
# Python 3.6+ is required
receiver_address = '<PUB_KEY>'
amount_to_send = 1
fee = 8
transactions_count = 100
transactions_string = '('


for i in range(1, transactions_count+1):
    template = f'((receiver\n  {receiver_address}) (amount {str(amount_to_send)}) (fee {str(fee)}))'
    if i != transactions_count:
        transactions_string = transactions_string + f'{template}\n'
    else:
        transactions_string = transactions_string + f'{template})'

with open('batch.txt', 'w') as f:
    f.write(transactions_string)
1 Like