-
Notifications
You must be signed in to change notification settings - Fork 1
/
tx_signer_daemon.sh
executable file
·72 lines (63 loc) · 2.3 KB
/
tx_signer_daemon.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# Automated Transaction Signer Daemon Guide
# -----------------------------------------
# Description:
# This script is designed to automate sending transactions on Re Protocol using the `red tx oracle` command.
# It uses the `expect` utility to automate passphrase input when the command prompts for it.
#
# Prerequisites:
# 1. Ensure you have the `expect` tool installed.
# 2. Ensure you have the necessary permissions to execute scripts.
#
# Steps to Run:
# 1. Set Up the Script:
# - Replace `YOUR_PASSPHRASE_HERE` with your actual passphrase.
# 2. Make the Script Executable:
# chmod +x tx_signer_daemon.sh
# 3. Run the Script:
# ./tx_signer_daemon.sh
#
# Notes:
# - Be cautious with hardcoded passphrases in scripts.
# - Always ensure you understand the behavior and consequences of automated scripts.
# -----------------------------------------
# Ensure the script exits on errors
set -e
PASSPHRASE="YOUR_PASSPHRASE_HERE"
while true; do
# Use '&' to run the commands in the background
(
# Use expect to automatically provide the passphrase for the first command
expect << EOF
spawn red tx oracle cosmoshub-txs re1p89cpyfelqhf40dgz8cc3ggxgqnkdra2k4u5wd --from alice --chain-id test --keyring-backend test --gas 12899100
expect "Enter keyring passphrase:"
send "${PASSPHRASE}\r"
expect eof
EOF
) &
# Sleep briefly between commands (optional)
sleep 5
(
# Use expect to automatically provide the passphrase for the second command
expect << EOF
spawn red tx oracle bitcoin-txs re1t2r44rvmzqn7x3nwpnm9z2x8kfd87m8unxmqdu --from bob --chain-id test --keyring-backend test --gas 12899100
expect "Enter keyring passphrase:"
send "${PASSPHRASE}\r"
expect eof
EOF
) &
# Use '&' to run the third command in the background
(
# Use expect to automatically provide the passphrase for the third command
expect << EOF
spawn red tx oracle ethereum-txs re1t2r44rvmzqn7x3nwpnm9z2x8kfd87m8unxmqdu --from bob --chain-id test --keyring-backend test --gas 12899100
expect "Enter keyring passphrase:"
send "${PASSPHRASE}\r"
expect eof
EOF
) &
# Optionally, wait for background jobs to complete
wait
# Sleep before repeating the loop
sleep 5
done