forked from mikispag/rusty-blockparser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_clusters.sh
More file actions
38 lines (31 loc) · 1.11 KB
/
update_clusters.sh
File metadata and controls
38 lines (31 loc) · 1.11 KB
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
#!/bin/bash
# Show commands, expanding variables
set -x
# Exit on error
set -e
# Do not return wildcards if glob returns no matches
shopt -s nullglob
(bitcoin-cli getinfo && (bitcoin-cli stop || killall -9 bitcoind)) || true
sleep 5
if [ ! -f ~/clusterizer/chain.json ]; then
echo "chain.json not found, running from scratch!"
MODE="--new"
else
echo "Resuming txoutdump..."
MODE="--resume"
cp -f ~/clusterizer/chain.json ~/clusterizer/chain.json.old
cp -f ~/clusterizer/chain.json ~/clusterizer/chain.json.old-$(date -Iseconds)
fi
rusty-blockparser -t $(nproc) "${MODE}" --chain-storage ~/clusterizer/chain.json txoutdump ~/clusterizer
for csvfile in ~/clusterizer/tx_out-*.csv
do
echo "Sorting ${csvfile}..."
LC_ALL=C sort -c "${csvfile}" || LC_ALL=C sort -u --parallel=$(nproc) "${csvfile}" -o "${csvfile}"
echo "Done."
done
echo "Running clusterizer..."
rusty-blockparser -t $(nproc) "${MODE}" --chain-storage ~/clusterizer/chain.json.old clusterizer ~/clusterizer
echo "Sorting clusters.csv..."
LC_ALL=C sort --parallel=$(nproc) ~/clusterizer/clusters.csv -o ~/clusterizer/clusters.csv
echo "Done."
bitcoind