From c86d7bdfe180ed50b26dc0dfe05b9f0403f07fb5 Mon Sep 17 00:00:00 2001 From: danielclough Date: Wed, 18 Nov 2020 23:22:22 -0800 Subject: [PATCH 1/2] add blk script for cli usage. including dust cleanup, unlock for staking, compare latest with explorer, and a basic report. --- contrib/blk | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 contrib/blk diff --git a/contrib/blk b/contrib/blk new file mode 100644 index 000000000..75b684e08 --- /dev/null +++ b/contrib/blk @@ -0,0 +1,50 @@ +#!/bin/bash + +usage="Usage: blk [ info | stake | latest | dust ] \n \n + info: Check basic info. \n + stake: Enables staking; Passes password without storing it in memory. \n + latest: Compares latest block with the BlackcoinNL hosted block explorer. \n + dust: Prunes dust from wallet. Dust is defined as less than .0001BLK. Requires jq. \n" + +blkc='/usr/local/bin/blackmore-cli -datadir=/var/lib/.blackmore/' + +case $1 in + +info ) + $blkc getwalletinfo | egrep "balance|staked_balance|txcount|unconfirmed_balance|immature_balance|total_balance"; + $blkc getnetworkinfo | egrep "subversion|connections"; + $blkc getinfo | egrep "blocks"; + $blkc getblockchaininfo | egrep "best"; + $blkc getstakinginfo | egrep "enabled|staking|netstakeweight|expectedtime"; +;; + +stake ) + echo 'enter Blackcoin Password' + read -s BLKPW + $blkc walletpassphrase $BLKPW 99999999 true + BLKPW=null +;; + +latest ) + latest=$($blkc getblockcount) && \ + blacksight=$(curl -s https://node.blackcoin.io/insight-api/block-index/$latest? | cut -d '"' -f4) && \ + blackmore=$($blkc getblockhash $latest) && \ + diff -sy --label Local <(echo $blackmore) --label Explorer <(echo $blacksight) +;; + +dust ) + IFS=$'\n'; + + /usr/local/bin/blackmore-cli -datadir=/var/lib/.blackmore/ listtransactions "*" 99999 | jq -r '.[] | select(.category != "send") | select(.amount < .0001) | .txid' | uniq >txid.txt + + while read line; do + echo $line + /usr/local/bin/blackmore-cli -datadir=/var/lib/.blackmore/ removeprunedfunds $(echo $line) + done < "txid.txt" +;; + +*) + echo -e $usage +;; + +esac From e241b1f59b4b5e280a022595632673cf906db083 Mon Sep 17 00:00:00 2001 From: danielclough Date: Wed, 18 Nov 2020 23:34:25 -0800 Subject: [PATCH 2/2] add #include to fix docker build --- src/httpserver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 3eb5b1042..052129314 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -12,6 +12,7 @@ #include "sync.h" #include "ui_interface.h" +#include #include #include #include