Skip to content

Instantly share code, notes, and snippets.

@thelazier
thelazier / gist:c2ccafd5bfa3dda89a18
Last active October 7, 2016 12:26
dash-cli command shell script
#Locking Masternode Tx with dash-cli
dash-cli masternode outputs |grep '"' |cut -d '"' -f 2,4|sed "s/\"/ /g" |awk '{print "dash-cli lockunspent false \"[{\\\"txid\\\":\\\"" $1 "\\\",\\\"vout\\\":" $2 "}]\"" }' |/bin/sh
#create mnbudget vote cmd from show using jq (deprecated)
CURR_BLOCK=$(dash-cli getinfo |jq '.blocks')
dash-cli mnbudget show |jq '.|keys[] as $name| {"\($name)"}[] |select(.Amount > 0)|select(.BlockEnd > '$CURR_BLOCK')| "dash-cli mnbudget vote \($name) \(.URL) \(.TotalPaymentCount) \(.BlockStart) \(.PaymentAddress) \(.Amount/100000000) no"' |cut -d'"' -f 2
#show mnbudget vote status
dash-cli mnbudget show |jq '.|keys[] as $name| {"\($name)"}[] | "\($name) Y:\(.Yeas) N:\(.Nays) A:\(.Abstains) \(.Ratio*100)%" '
@thelazier
thelazier / clean_dash_node.bash
Created October 2, 2016 06:39
Check if dash has peers from same IP more than limit or not, disconnect if exceeded.
#!/bin/bash
# Require Bash version >=4
# Require jq hexdump
# Set Dash Client command
DASH_CLI=/home/dashtest/bin/dash-cli
# Set Max connection per IP
MAX_CONN_IP=5

Keybase proof

I hereby claim:

  • I am thelazier on github.
  • I am thelazier (https://keybase.io/thelazier) on keybase.
  • I have a public key whose fingerprint is 550D 524A BE74 655C 67BB C035 0933 AB55 8425 3057

To claim this, I am signing this object:

@thelazier
thelazier / sum_mined.sh
Created October 27, 2016 06:39
Bash script to sum inputs from mining.
#!/bin/bash
# Need following config in dash.conf
## server=1
## rpcuser=AnythingYoulike
## rpcpassword=AnyPassword
#
# Open your wallet and unlock before run the script :)
#
# Suggestion for Loop `while true; do ./sum_mined.sh || break; done`
#
# Building zcoin daemon on alpine linux
apk --update add coreutils build-base git tar perl autoconf automake libtool linux-headers patch wget openssl-dev libevent-dev pkgconfig bzip2-dev unzip && rm -r /var/cache/apk/*
mkdir /depend
# DB 4.8
cd /depend && wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz \
&& tar -zxvf db-4.8.30.NC.tar.gz \
&& cd db-4.8.30.NC/build_unix \
&& ../dist/configure --prefix=/usr --enable-cxx --disable-shared --disable-replication \
2017-01-07 04:35:02,781 ElectrumX server starting
2017-01-07 04:35:02,782 switching current directory to /home/electrum/electrumx-dash-db/mainnet
2017-01-07 04:35:02,823 using leveldb for DB backend
2017-01-07 04:35:02,834 created new database
2017-01-07 04:35:02,834 creating metadata diretcory
2017-01-07 04:35:02,834 software version: ElectrumX 0.10.0
2017-01-07 04:35:02,834 DB version: 5
2017-01-07 04:35:02,834 coin: Dash
2017-01-07 04:35:02,835 network: mainnet
2017-01-07 04:35:02,835 height: -1
@thelazier
thelazier / sum_mined_jq.sh
Last active June 9, 2017 09:30
Another sum Mined coins, need "jq", "bc"
#!/bin/bash
# Need following config in dash.conf
## server=1
## rpcuser=AnythingYoulike
## rpcpassword=AnyPassword
#
# Open your wallet and unlock before run the script :)
#
# Suggestion for Loop `while true; do ./sum_mined_jq.sh || break; done`
#
@thelazier
thelazier / get_queue_pos.sh
Last active March 3, 2017 11:16
Command on Linux to get current payment queue of masternode on Dash 12.1 network.
#!/usr/bin/env bash
MNADDR=$1
dash-cli masternodelist full | grep " ENABLED" | sed -e 's/[}|{]//' -e 's/"//g' -e 's/,//g' -e 's/^ *//g'| grep -v ^$ |tr -s ' '|awk '"echo `date +%s`-\(`dash-cli masternode count enabled`\*2.6\*60\)|bc"|getline minsigtime;($8!=0||$6>minsigtime)'| sort -n -k 8 |grep -n $MNADDR |sed -e 's/:/ /g'|cut -d ' ' -f 1,6 |awk '{"dash-cli masternode count enabled"|getline mncount; print $2" "$1"/"mncount}'