Browse Source

Getting there

web
blackjok3r 6 years ago
parent
commit
ed5e375daa
  1. 19
      install/buildkomodo.sh
  2. 12
      install/installnanomsg.sh
  3. 18
      listclis.sh
  4. 5
      listcoins.sh
  5. 7
      splitfunds.sh
  6. 3
      start.sh
  7. 61
      utxosplitter.sh

19
install/buildkomodo.sh

@ -0,0 +1,19 @@
#Install Deps
sudo apt-get update
sudo apt-get -y install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python python-zmq zlib1g-dev wget libcurl4-openssl-dev bsdmainutils automake curl
#Install Komodo
cd ~
git clone https://github.com/libscott/komodo.git -b staked
cd komodo
./zcutil/fetch-params.sh
./zcutil/build.sh -j$(nproc)
cd ~
mkdir .komodo
cd .komodo
touch komodo.conf
echo "rpcuser=user`head -c 32 /dev/urandom | base64`" > komodo.conf
echo "rpcpassword=password`head -c 32 /dev/urandom | base64`" >> komodo.conf
echo "daemon=1" >> komodo.conf
echo "server=1" >> komodo.conf
echo "txindex=1" >> komodo.conf
chmod 0600 komodo.conf

12
install/installnanomsg.sh

@ -0,0 +1,12 @@
#!/bin/bash
sudo apt-get update
sudo apt-get -y install build-essential pkg-config git libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libqrencode-dev ntp ntpdate software-properties-common curl libcurl4-gnutls-dev cmake clang libevent-dev libboost-all-dev
cd ~
git clone https://github.com/nanomsg/nanomsg
cd nanomsg
mkdir build
cd build
cmake .. -DNN_TESTS=OFF -DNN_ENABLE_DOC=OFF
cmake --build . -j$(nproc)
sudo cmake --build . --target install
sudo ldconfig

18
listclis.sh

@ -0,0 +1,18 @@
#!/bin/bash
cd "${BASH_SOURCE%/*}" || exit
# Optionally just get the cli for a single coin
# e.g "KMD"
specific_coin=$1
komodo_cli="komodo-cli"
if [[ -z "${specific_coin}" ]] || [[ "${specific_coin}" = "KMD" ]]; then
echo ${komodo_cli}
fi
./listassetchains.py | while read coin; do
if [[ -z "${specific_coin}" ]] || [[ "${specific_coin}" = "${coin}" ]]; then
echo "${komodo_cli} -ac_name=${coin}"
fi
done

5
listcoins.sh

@ -0,0 +1,5 @@
#!/bin/bash
cd "${BASH_SOURCE%/*}" || exit
echo "KMD"
./listassetchains.py

7
splitfunds.sh

@ -0,0 +1,7 @@
#!/bin/bash
cd "${BASH_SOURCE%/*}" || exit
coin=$1
duplicates=$2
curl http://127.0.0.1:7776 --silent --data "{\"coin\":\"${coin}\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":${utxo_size},\"sendflag\":1,\"duplicates\":${duplicates}}"

3
start.sh

@ -23,5 +23,6 @@ echo "[KMD] : $(./validateaddress.sh KMD)"
mv "$chain"_7776 iguana/coins
echo "[$chain] : $(./validateaddress.sh $chain)"
done
echo "Building Iguana"
./build_iguana
echo "Finished: Please check chains are synced before running start_iguana.sh"
echo "Finished: Please check ALL your chains are synced before running start_iguana.sh"

61
utxosplitter.sh

@ -0,0 +1,61 @@
#!/bin/bash
cd "${BASH_SOURCE%/*}" || exit
# Optionally just split UTXOs for a single coin
# e.g "KMD"
specific_coin=$1
kmd_target_utxo_count=500
kmd_split_threshold=250
other_target_utxo_count=10
other_split_threshold=5
date=$(date +%Y-%m-%d:%H:%M:%S)
calc() {
awk "BEGIN { print "$*" }"
}
if [[ -z "${specific_coin}" ]]; then
echo "----------------------------------------"
echo "Splitting UTXOs - ${date}"
echo "KMD target UTXO count: ${kmd_target_utxo_count}"
echo "KMD split threshold: ${kmd_split_threshold}"
echo "Other target UTXO count: ${other_target_utxo_count}"
echo "Other split threshold: ${other_split_threshold}"
echo "----------------------------------------"
fi
./listcoins.sh | while read coin; do
if [[ -z "${specific_coin}" ]] || [[ "${specific_coin}" = "${coin}" ]]; then
cli=$(./listclis.sh ${coin})
if [[ "${coin}" = "KMD" ]]; then
target_utxo_count=$kmd_target_utxo_count
split_threshold=$kmd_split_threshold
else
target_utxo_count=$other_target_utxo_count
split_threshold=$other_split_threshold
fi
satoshis=10000
amount=$(calc $satoshis/100000000)
utxo_count=$(${cli} listunspent | jq -r '.[].amount' | grep ${amount} | wc -l)
echo "[${coin}] Current UTXO count is ${utxo_count}"
utxo_required=$(calc ${target_utxo_count}-${utxo_count})
if [[ ${utxo_required} -gt ${split_threshold} ]]; then
echo "[${coin}] Splitting ${utxo_required} extra UTXOs"
json=$(./splitfunds.sh ${coin} ${utxo_required})
txid=$(echo ${json} | jq -r '.txid')
if [[ ${txid} != "null" ]]; then
echo "[${coin}] Split TXID: ${txid}"
else
echo "[${coin}] Error: $(echo ${json} | jq -r '.error')"
fi
fi
fi
done
Loading…
Cancel
Save