-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhotCCSpam.sh
108 lines (93 loc) · 3.81 KB
/
hotCCSpam.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#! /bin/bash
# Variables and Colors
REQUEST_NO=1
MAX_REQUESTS=40
WITNESS=$((MAX_REQUESTS+1))
CREDENTIALS_NO_SUBMITED=40
YELLOW='\033[1;33m'
NC='\033[0m'
# Time passing animation for the mempool check
time_passing_animation() {
local total_duration=5
local elapsed=0
while [ $elapsed -le $total_duration ]; do
local progress=$((elapsed*50/total_duration))
local filled=$progress
local unfilled=$((50-filled))
echo -ne "\r["
for _ in $(seq 1 $filled); do echo -n "#"; done
for _ in $(seq 1 $unfilled); do echo -n " "; done
echo -n "] $elapsed sec Waiting"
sleep 1
((elapsed++))
done
echo -e "\nRunning query again."
}
# Verify mempool function
verify_mem_pool() {
MEMPOOL=$(cardano-cli conway query tx-mempool --testnet-magic 4 tx-exists $(cardano-cli conway transaction txid --tx-file tx.signed) | jq .exists)
while true; do
if [ "$MEMPOOL" != "false" ]; then
echo "Your Transaction is still in the memory pool. Please Wait...."
MEMPOOL=$(cardano-cli conway query tx-mempool --testnet-magic 4 tx-exists $(cardano-cli conway transaction txid --tx-file tx.signed) | jq .exists)
sleep 1
else
echo "Your Transaction as been included into a block!"
break
fi
done
}
# Creating CC cold, hot credentials, hashes and certificates
create_credentials() {
mkdir -p keysAndHash > /dev/null 2>&1
while [ $REQUEST_NO -le $MAX_REQUESTS ]; do
cardano-cli conway governance committee key-gen-cold \
--cold-verification-key-file keysAndHash/cc-cold${REQUEST_NO}.vkey \
--cold-signing-key-file keysAndHash/cc-cold${REQUEST_NO}.skey
cardano-cli conway governance committee key-gen-hot \
--verification-key-file keysAndHash/cc-hot${REQUEST_NO}.vkey \
--signing-key-file keysAndHash/cc-hot${REQUEST_NO}.skey
cardano-cli conway governance committee key-hash \
--verification-key-file keysAndHash/cc-cold${REQUEST_NO}.vkey > keysAndHash/cc-cold${REQUEST_NO}.hash
cardano-cli conway governance committee create-hot-key-authorization-certificate \
--cold-verification-key-file keysAndHash/cc-cold${REQUEST_NO}.vkey \
--hot-key-file keysAndHash/cc-hot${REQUEST_NO}.vkey \
--out-file keysAndHash/cc-hot-key-authorization${REQUEST_NO}.cert
echo " --certificate-file keysAndHash/cc-hot-key-authorization${REQUEST_NO}.cert" >> keysAndHash/batchedCerts.txt
echo " --signing-key-file keysAndHash/cc-cold${REQUEST_NO}.skey" >> keysAndHash/batchedSigners.txt
((REQUEST_NO++))
done
}
# Building Transaction, signatures and submit them (double check le witness override)
transaction_build_sign_submit () {
cardano-cli conway transaction build \
--testnet-magic 4 \
--tx-in $(cardano-cli query utxo --address $(cat payment.addr) --testnet-magic 4 --out-file /dev/stdout | jq -r 'keys[0]') \
--change-address $(cat payment.addr) \
$(cat keysAndHash/batchedCerts.txt) \
--witness-override ${WITNESS} \
--out-file tx.raw
cardano-cli conway transaction sign \
--testnet-magic 4 \
--tx-body-file tx.raw \
--signing-key-file payment.skey \
$(cat keysAndHash/batchedSigners.txt) \
--out-file tx.signed
cardano-cli conway transaction submit \
--testnet-magic 4 \
--tx-file tx.signed
rm -rf keysAndHash > /dev/null 2>&1
echo "${CREDENTIALS_NO_SUBMITED} invalid authorization certificates submitted."
CREDENTIALS_NO_SUBMITED=$((CREDENTIALS_NO_SUBMITED+40))
REQUEST_NO=1
}
# Main function
main() {
create_credentials
transaction_build_sign_submit
verify_mem_pool
}
# Simple loop to spam the chain
while true; do
main
done