forked from valory-xyz/mech
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_agent.sh
44 lines (36 loc) · 1.14 KB
/
run_agent.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
cleanup() {
echo "Terminating tendermint..."
if kill -0 "$tm_subprocess_pid" 2>/dev/null; then
kill "$tm_subprocess_pid"
wait "$tm_subprocess_pid" 2>/dev/null
fi
echo "Tendermint terminated"
}
# Link cleanup to the exit signal
trap cleanup EXIT
# Remove previous agent if exists
if test -d agent; then
echo "Removing previous agent build"
sudo rm -r agent
fi
# Remove empty directories to avoid wrong hashes
find . -empty -type d -delete
make clean
# Ensure hashes are updated
autonomy packages lock
# Fetch the agent
autonomy fetch --local --agent valory/mech --alias agent
# Copy and add the keys, env and issue certificates
cd agent
cp $PWD/../.agentenv .
cp $PWD/../ethereum_private_key.txt .
autonomy add-key ethereum ethereum_private_key.txt
autonomy issue-certificates
# Run tendermint
rm -r ~/.tendermint
tendermint init > /dev/null 2>&1
echo "Starting Tendermint..."
tendermint node --proxy_app=tcp://127.0.0.1:26658 --rpc.laddr=tcp://127.0.0.1:26657 --p2p.laddr=tcp://0.0.0.0:26656 --p2p.seeds= --consensus.create_empty_blocks=true > /dev/null 2>&1 &
tm_subprocess_pid=$!
# Run the agent
aea -s run --env .agentenv