I have been experimenting with cardano-cli in the past week. My goal is to find a way to automate sending transactions from multiple wallets in my Daedalus Mainnet.app.
After doing some research, I found: Bash script to send the transaction through cardano-cli. So I followed the instructions on GitHub, and everything was successful.
From here on out, sending transactions from multiple wallets is easy, as I only need to run the function
daedalus-cli-send-tx numerous times with different arguments each time. Here's what I've got so far:
$ cat test.sh #!/bin/bash echo Please enter sender address: read sender echo $sender daedalus-cli-send-tx wallet1 1000000 $sender #sending from wallet1 with 1ADA to sender daedalus-cli-send-tx wallet2 1000000 $sender #sending from wallet2 with 1ADA to sender
And I also made a text file to redirect my input from
test.sh to this input file:
$ cat input addr1q8sypyrh63y6pgjq0ys0j7rkj2qjun6wnq4haj9d945d9cqu7krtq8wjazqvqxmtmmmyx20kuftmg0578npzdpy3vkasyjn3p3 #sender address 8736867242 #wallet1 passphrase 1932862497 #wallet2 passphrase
But when I redirect my input, here's what I get:
$ source ~/test.sh < input Please enter sender address: addr1q8sypyrh63y6pgjq0ys0j7rkj2qjun6wnq4haj9d945d9cqu7krtq8wjazqvqxmtmmmyx20kuftmg0578npzdpy3vkasyjn3p3 Please enter your passphrase: ********** The given encryption passphrase doesn't match the one I use to encrypt the root private key of the given wallet: 890483bc9ec5c5bfc7d612d9cad885df199c3533 Please enter your passphrase: cardano-wallet: <stdin>: hGetChar: end of file
Note that I purposely used a wrong passphrase for both transactions, but the first one actually read the input from the text file, so that isn't the problem. The problem lies in that the second transaction asked for a passphrase, yet it returned this line:
Please enter your passphrase: cardano-wallet: <stdin>: hGetChar: end of file
Even though the
input textfile supplies both passphrases.
I have very little knowledge of shell script, so I am asking for help here. What is this error
cardano-wallet: <stdin>: hGetChar: end of file (AFAIK it is because the input was not captured), and how do I actually automate entering my passphrase when prompt?