You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.9 KiB
68 lines
1.9 KiB
#!/bin/bash
|
|
#Config area
|
|
komodo_data=~/.komodo #default would be ~/.komodo
|
|
komodopath=komodo-cli #path to komodo-cli
|
|
komododpath=komodod #path to komodod
|
|
NNaddress=RSuXRScqHNbRFqjur2C3tf3oDoauBs2B1i #Your NN public key goes here
|
|
source ~/komodo/src/pubkey.txt #path to your pubkey.txt
|
|
args="-connect=172.16.16.11" #Any special args you pass komodod on start
|
|
DATE=`date +%Y-%m-%d` #get todays date for your wallet.dat backup file
|
|
currdir=$(echo $PWD) #get the working directory
|
|
|
|
waitforconfirm () {
|
|
sleep 30
|
|
confirmations=0
|
|
while [[ $confirmations -lt 1 ]]; do
|
|
confirmations=$($komodopath gettransaction $1 | jq -r .confirmations)
|
|
sleep 2
|
|
done
|
|
}
|
|
|
|
#stop the deamon
|
|
$komodopath stop
|
|
|
|
#wait for deamon to stop
|
|
stopped=0
|
|
while [[ $stopped -eq 0 ]]; do
|
|
sleep 5
|
|
pgrep -a komodod | grep "komodod -notary"
|
|
outcome=$(echo $?)
|
|
if [[ $outcome -ne 0 ]]; then
|
|
stopped=1
|
|
fi
|
|
sleep 10
|
|
done
|
|
|
|
#move your old wallet, then return to our working directory
|
|
cd $komodo_data
|
|
mv wallet.dat wallet.bak$DATE
|
|
cd $currdir
|
|
|
|
#restart the komodo deamon, it will generate a new empty wallet.dat on start
|
|
$komododpath -notary -pubkey=$pubkey $args &
|
|
|
|
#wait for deamon to start
|
|
started=0
|
|
while [[ $started -eq 0 ]]; do
|
|
sleep 15
|
|
$komodopath getbalance
|
|
outcome=$(echo $?)
|
|
if [[ $outcome -eq 0 ]]; then
|
|
started=1
|
|
fi
|
|
done
|
|
|
|
# Get the NN privkey from the other node
|
|
NNprivkey=$(ssh node@172.16.16.11 "bash -s" -- < ./dumpKMDprivkey $NNaddress)
|
|
|
|
# import the private key of notary node without a rescan.
|
|
$komodopath importprivkey $NNprivkey "" false
|
|
|
|
# Execute the sendtoself script on the second node and return us the TXID
|
|
TXID=$(ssh node@172.16.16.11 "bash -s" -- < ./sendtoself $NNaddress)
|
|
|
|
#Check for confirmation of received funds
|
|
waitforconfirm $TXID
|
|
|
|
#split funds
|
|
acsplit KMD 100
|
|
|