additons and fixeds
This commit is contained in:
27
README.md
27
README.md
@@ -29,19 +29,24 @@ rpc_password="YOURPASSWORD"
|
|||||||
|
|
||||||
Commands available
|
Commands available
|
||||||
```
|
```
|
||||||
info: Check basic info. \n
|
Usage: blk [ info | unlock | stake | latest | dust | past24 | setpassword | changepassword | acctbalance | acctaddr | addrbalance | alladdr ]
|
||||||
stake: Enables staking; Passes password without storing it in memory. \n
|
|
||||||
latest: Compares latest block with the BlackcoinNL hosted block explorer. \n
|
info: Check basic info.
|
||||||
dust: Prunes dust from wallet. Dust is defined as less than .0001BLK. Requires jq. \n
|
unlock: Unlock the wallet for transfer; Passes password without storing it in memory.
|
||||||
past24: Shows staking numbers from the past 24hrs. \n
|
stake: Enables staking; Passes password without storing it in memory.
|
||||||
setpassword: Set encryption password if wallet is *UNENCRYPTED*. \n
|
latest: Compares latest block with the BlackcoinNL hosted block explorer.
|
||||||
changepassword: change wallet password. \n
|
dust: Prunes dust from wallet. Dust is defined as less than .0001BLK. Requires jq.
|
||||||
balance: show balance of addresses (using curl). \n
|
past24: Shows staking numbers from the past 24hrs.
|
||||||
alladdr: show all addr and balances \n
|
setpassword: Set encryption password if wallet is *UNENCRYPTED*.
|
||||||
addr: show addresses of default wallet \n"
|
changepassword: change wallet password.
|
||||||
|
acctbalance: show balance of addresses derived from ACCOUNT name(using curl+cryptoid.info).
|
||||||
|
addrbalance: show balance of addresses derived from ADDRESS name(using curl+cryptoid.info).
|
||||||
|
alladdr: show all addr and balances
|
||||||
|
acctaddr: show addresses of wallet ACCOUNT name
|
||||||
|
|
||||||
```
|
```
|
||||||
Example:
|
Example:
|
||||||
```
|
```
|
||||||
blk.sh info
|
./blk.sh info
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
86
blk.sh
86
blk.sh
@@ -1,6 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# original script from blackcoin.nl (https://blackcoin.nl/scripts-for-using-blackcoin-from-the-command-line-interface/)
|
# original script from blackcoin.nl (https://blackcoin.nl/scripts-for-using-blackcoin-from-the-command-line-interface/)
|
||||||
# adjusted to my likes yikes!
|
# adjusted to my likes yikes!
|
||||||
|
# also i added several functions like setpassword, changepassword, balance and addr
|
||||||
|
# DONE
|
||||||
|
# ----
|
||||||
|
# * added unlock
|
||||||
|
# * added setpassword
|
||||||
|
# * added changepassword
|
||||||
|
# * added balance
|
||||||
|
# * added addr
|
||||||
|
# * added alladdr
|
||||||
|
# * added possiblity to use rpcuser/rpcpass
|
||||||
|
# * added fallback for default cookie usage
|
||||||
|
#
|
||||||
|
# FIXED
|
||||||
|
# -----
|
||||||
|
#
|
||||||
|
# TODO
|
||||||
|
#-----
|
||||||
|
# * change user/pass cmdline option
|
||||||
|
# * add cookie option
|
||||||
|
# * add datadir option
|
||||||
|
|
||||||
# ATTENTION, you need to adjust those values
|
# ATTENTION, you need to adjust those values
|
||||||
# the directory the blackcoin-cli is located at
|
# the directory the blackcoin-cli is located at
|
||||||
@@ -8,41 +28,78 @@ bin_home="/home/blk/bin/"
|
|||||||
# the directory specified with --datadir, if not specified default is $HOME/.blackmore
|
# the directory specified with --datadir, if not specified default is $HOME/.blackmore
|
||||||
data_dir="/home/blk/.blackmore/"
|
data_dir="/home/blk/.blackmore/"
|
||||||
# username
|
# username
|
||||||
rpc_user="YOURUSER"
|
rpc_user="EXAMPLE_USER"
|
||||||
# password for RPC access
|
# password for RPC access
|
||||||
rpc_password="YOURPASSWORD"
|
rpc_password=""
|
||||||
|
|
||||||
usage="Usage: blk [ info | stake | latest | dust | past24 | setpassword | changepassword | balance | addr | alladdr ] \n \n
|
usage="Usage: blk [ info | unlock | stake | latest | dust | past24 | setpassword | changepassword | acctbalance | acctaddr | addrbalance | alladdr ] \n \n
|
||||||
info: Check basic info. \n
|
info: Check basic info. \n
|
||||||
|
unlock: Unlock the wallet for transfer; Passes password without storing it in memory. \n
|
||||||
stake: Enables staking; Passes password without storing it in memory. \n
|
stake: Enables staking; Passes password without storing it in memory. \n
|
||||||
latest: Compares latest block with the BlackcoinNL hosted block explorer. \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
|
dust: Prunes dust from wallet. Dust is defined as less than .0001BLK. Requires jq. \n
|
||||||
past24: Shows staking numbers from the past 24hrs. \n
|
past24: Shows staking numbers from the past 24hrs. \n
|
||||||
setpassword: Set encryption password if wallet is *UNENCRYPTED*. \n
|
setpassword: Set encryption password if wallet is *UNENCRYPTED*. \n
|
||||||
changepassword: change wallet password. \n
|
changepassword: change wallet password. \n
|
||||||
balance: show balance of addresses (using curl). \n
|
acctbalance: show balance of addresses derived from ACCOUNT name(using curl+cryptoid.info). \n
|
||||||
|
addrbalance: show balance of addresses derived from ADDRESS name(using curl+cryptoid.info). \n
|
||||||
alladdr: show all addr and balances \n
|
alladdr: show all addr and balances \n
|
||||||
addr: show addresses of default wallet \n"
|
acctaddr: show addresses of wallet ACCOUNT name\n"
|
||||||
|
|
||||||
|
if [ $rpc_user = 'EXAMPLE_USER' ];then
|
||||||
|
echo 'No user given, using cookie.'
|
||||||
|
blkc="$bin_home/blackmore-cli"
|
||||||
|
else
|
||||||
|
echo 'Using rpc-user-authentication scheme'
|
||||||
|
blkc="$bin_home/blackmore-cli -rpcuser=$rpc_user -rpcpassword=$rpc_password -datadir=$data_dir"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
blkc="$bin_home/blackmore-cli -rpcuser=$rpc_user -rpcpassword=$rpc_password -datadir=$data_dir"
|
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
|
|
||||||
balance ) account=''
|
addrbalance )
|
||||||
|
if [ $# -ne 2 ]; then
|
||||||
|
echo 'No address give.'
|
||||||
|
echo 'Abort.'
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
addr=$2
|
||||||
|
bal=`curl "https://chainz.cryptoid.info/blk/api.dws?q=getbalance&a=$addr" 2>/dev/null`
|
||||||
|
echo "Address Balance"
|
||||||
|
echo "$addr $bal BLK"
|
||||||
|
|
||||||
|
;;
|
||||||
|
acctbalance ) account=''
|
||||||
myaddr=''
|
myaddr=''
|
||||||
if [ $# -ne 2 ]; then
|
if [ $# -ne 2 ]; then
|
||||||
echo 'No accountname given, using default'
|
echo 'No accountname given, using default'
|
||||||
myaddr=`$blkc getaddressesbyaccount ""| jq .|grep \"B|sed -e 's/[ ",]//g'`
|
myaddr=`$blkc getaddressesbyaccount ""| jq .|grep \"B|sed -e 's/[ ",]//g'`
|
||||||
else
|
else
|
||||||
account=$2
|
account=$2
|
||||||
myaddr=`$blkc getaddressesbyaccount $account| jq .|grep \"B|sed -e 's/[ ",]//g'`
|
myaddr=`$blkc getaddressesbyaccount "$account"| jq .|grep \"B|sed -e 's/[ ",]//g'`
|
||||||
fi
|
fi
|
||||||
|
echo "Address Balance"
|
||||||
for item in $myaddr; do
|
for item in $myaddr; do
|
||||||
bal=`curl "https://chainz.cryptoid.info/ric/api.dws?q=getbalance&&a=$item" 2>/dev/null`
|
bal=`curl "https://chainz.cryptoid.info/blk/api.dws?q=getbalance&a=$item" 2>/dev/null`
|
||||||
echo "$item: $bal"
|
echo "$item $bal BLK"
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
acctaddr ) account=''
|
||||||
|
myaddr=''
|
||||||
|
if [ $# -ne 2 ]; then
|
||||||
|
echo 'No accountname given, using default'
|
||||||
|
myaddr=`$blkc getaddressesbyaccount ""| jq .|grep \"B|sed -e 's/[ ",]//g'`
|
||||||
|
else
|
||||||
|
account=$2
|
||||||
|
echo $account
|
||||||
|
myaddr=`$blkc getaddressesbyaccount "$account"| jq .|grep \"B|sed -e 's/[ ",]//g'`
|
||||||
|
fi
|
||||||
|
echo 'Address'
|
||||||
|
for i in `echo $myaddr`; do echo $i; done
|
||||||
|
;;
|
||||||
|
|
||||||
alladdr ) $blkc listaddressgroupings
|
alladdr ) $blkc listaddressgroupings
|
||||||
;;
|
;;
|
||||||
info )
|
info )
|
||||||
@@ -70,7 +127,16 @@ changepassword )
|
|||||||
BLKPWNEW=null
|
BLKPWNEW=null
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
unlock )
|
||||||
|
echo 'ATTENTION! Unlocking Wallet!'
|
||||||
|
echo 'enter Blackcoin Password'
|
||||||
|
read -s BLKPW
|
||||||
|
$blkc walletpassphrase $BLKPW 99999999 false
|
||||||
|
BLKPW=null
|
||||||
|
;;
|
||||||
|
|
||||||
stake )
|
stake )
|
||||||
|
echo 'Change Wallet to STAKING ONLY'
|
||||||
echo 'enter Blackcoin Password'
|
echo 'enter Blackcoin Password'
|
||||||
read -s BLKPW
|
read -s BLKPW
|
||||||
$blkc walletpassphrase $BLKPW 99999999 true
|
$blkc walletpassphrase $BLKPW 99999999 true
|
||||||
|
|||||||
Reference in New Issue
Block a user