Skip to content

Instantly share code, notes, and snippets.

@sieemma
Last active January 28, 2021 16:33
Show Gist options
  • Save sieemma/09ab36bcffbaada56e35a5785c767697 to your computer and use it in GitHub Desktop.
Save sieemma/09ab36bcffbaada56e35a5785c767697 to your computer and use it in GitHub Desktop.
concordium_txn_bulksend
Mission T3
Simple bash files to help with bulk sending transactions successively.
Thanks to Ataraxia and Javier from the concordium community for coming in to help get this working.
To begin, let's install the following packages:
cd
sudo apt-get update -y
sudo apt-get install -y expect
sudo apt-get install jq
# Firstly, you have to import your account thorugh the node dashboard if you haven't done that yet. After this do:
./concordium-client config show # This displays the name of your accounts. Take note of those you wanna use.
# We will be using [sieemma1 with address, 4stdLq7RzgYqCfLkGHdKB6wBuDXr8rDj41hUKtJweqHWBLPzJM] and [sieemma2 with address, 5stdLq7RzgYqCfLkGHdKB6wBuDXr8rDj41hUKtJweqHWBLPzda] as example only. please change them to your own.
# We will be creating 2 different files namely, expect.sh, bulk.sh
# Let's start by creating our various scripts.
cd $HOME/Documents/concordium-software
# First file: expect.sh
nano expect.sh
# Check your balance and make sure it can send the 1000 transactions.
# If you don't have enough, create a new account and request GTU then transfer to your rpefered account.
# You should check the --amount option and use per what you have. I will be sending 0.005 GTU.
# Use ./concordium-client config show to check which accounts you want to use and their names.
# Look for [send -- "your_imported_account_password\r"] and change your_imported_account_password to your password.
# Look for [spawn ./concordium-client account show sieemma1] and change sieemma1 to your sending account name.
# Edit the 2 lines below with your details and copy paste in the nano editor. Do not omit: #!/bin/bash
#!/usr/bin/expect -f
set timeout -1
spawn ./concordium-client transaction send-gtu --receiver sieemma2 --amount 1 --sender sieemma1 --no-confirm --no-wait
expect "Enter password for signing key: "
send -- "your_imported_account_password\r"
interact ### Send the transaction
spawn ./concordium-client account show sieemma1
interact ### Check the decrypted encrypted balance
# After this save the file with ctrl + x, y then enter.
# Make it executable by:
chmod +x expect.sh
# Second file: expect.sh
nano bulk.sh
# Copy and paste the lines below into the nano editor. Do not omit: #!/bin/bash
#!/bin/bash
for i in {1..1000}
do
./expect.sh >> tx-out.log
done
cat tx-out.log | grep "Transaction is finalized into block" > blocks.log
cat tx-out.log | grep "Transaction '" > txs.log
# After this save the file with ctrl + x, y then enter.
# Make it executable by:
chmod +x bulk.sh
# Check the nounce before starting the script. Should be from the account you will be sending from.
./concordium-client account show sieemma1
# Let's start sending our 1000 transaction from a tmux session. We want to keep an eye on the screen
# just in case our session expires due to inactivity.
# Let's call the session bulksend
tmux new -s bulksend
# From this session, let's make our 1000 transactions.
./bulk.sh
# This will hang upon entering thst command. Open your app and check if it's sending
#Detach from the tmux by using:
ctrl + b, then d
#To return to the bulksend session again, use:
tmux attach-session -t bulksend
# Next for the tx id:
# To get the transaction ids, look for a file called txs.log in the same directory.[cd $HOME/Documents/concordium-software]
# Download from your winscp and submit it.
Next guide loading...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment