Welcome to Quark Community

Quark is an open source software used mainly as a digital currency that employs multiple cryptographic algorithms, which unlike fiat/national currencies provides the platform for a decentralised monetary system.

Quark was launched in 2013 with the belief that the control of money should not be in the hands of the few, but in the hands of the many. This forum tries to build on that ideology by distributing Quarks in the hands of those that are active in the community. By posting quality articles and contributing to general discussions you will earn Quarks.


Sign up Learn more about Quark
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Linux useful scripts for digital currencies 1

linux

  1. dcs
    Since i am a linux user most of the time i find it difficult to remember by heart a lot of commands , so i am trying to make my life easier by using script's and aliases. Also since i am trying different kind of altcoins I am gonna explain 2 scripts that i am using to organize all of them and check my balance and transactions in all altcoins. Even more this is really useful if you're working from ssh as well. You can further implement it or correct them if you find anything you don't like. Also i am not taking any responsibility for whatever YOU do to your pc. (even if the commands are straight forward YOU take full responsibility).
    So, first i assume you have a working wallet and the headless wallet quarkcoind up and working( i am not gonna provide details on how to install those , there are plenty simple guides as well as instructions in the /doc file of the quark repository).Also i assume you have a basic knowledge of linux commands.

    The first script lets name it quark_amount.sh will be for listing the balance of your quarks and the mining hashrate you have.

    Here's the code for quark_amount.sh

    Code:
    #!/bin/bash
    #change the walllet path in order to point to the /src folder of your quark repo
    wallet_path=/home/user/*/quark/src
    if [[ -z "$1" ]]; then
        coins=$($wallet_path/quarkcoind getbalance)
        generate=$($wallet_path/quarkcoind getmininginfo | grep generate | awk '{print $3}' | sed 's/,//g' )
        hash=$($wallet_path/quarkcoind getmininginfo | grep hashespersec | awk '{print $3}' | sed 's/,//g' )
        if [ "$generate" == "true" ];then
            echo -n "Quark Amount : " && echo -n $coins && echo -n " -- Mining at " &&  echo -n  $hash && echo " H/sec"
        else
            echo -n "Quark Amount : " && echo -n  $coins && echo " -- Idle"
        fi
    elif [ $1 == "list" ]; then
        $wallet_path/quarkcoind listtransactions "*" 99999999999
        $wallet_path/quarkcoind listtransactions "*" 99999999999 | grep "amount" | awk '{print $3}' | sed 's/,//g' |awk '{sum+=$1}END{print "Quark Amount : " sum}'
    else
        $wallet_path/quarkcoind listtransactions "$1"  99999999999 | grep "amount" | awk '{print $3}' | sed 's/,//g' |awk 'BEGIN{sum=0}{sum+=$1}END{print "Quark Amount : " sum}'
    fi
    
    So what the code does is using the quarkcoind commands to get the balance of your wallet ,to get the hashrate if you are mining and listing the transactions.
    Just copy paste it to a new document and save it as quark_amount.sh. Then you make it executable chmod 755 ./quark_amount.sh .
    - Running ./quark_amount.sh with no arguments will list the balance and whether or not you are mining and with what hahsrate.
    - If you give the argument "list" , example "./quark_amount list" it will list all the transactions (up to 99999999999 transactions)
    - if you specify an account name it will list the total amount of quarks of that account example "./quark_amount accountX"

    Now since we have that up and working you want it to work from any path on your system. There are two ways of doing this. Either you provide the path in the $PATH variable, or you create an alias.
    Let's create an alias type in the command prompt.(Use whatever editor you like i'll use gedit)
    gedit ~/.bashrc
    (scroll at the end and type)
    alias quark_amount='/path of your script/quark_amount.sh'
    (save it and close)
    source ~/.bashrc

    Now if you have another coin for example "coinX" do the same but wherever you see quark replace with "coinX"

    The second script sums up all those Quark_amount.sh, coinX_amount.sh , coinX1_amount.sh to one script called coins.sh that gives the balance of every coin you have and if you'r mining with what hashpersec

    coins.sh
    Code:
    #!/bin/bash
    
    /path of quark_amount script/quark_amount.sh
    /path of coinX1_amount script/coinX1_amount.sh
    /path of coinX2_amount script/coinX2_amount.sh
    

    Again make it executable by chmod 755 ./coins and create an alias in ~/.bashrc
    gedit ~/.bashrc
    (scroll at the end and type)
    alias coins='/path of your coins script/coins.sh'
    (save it and close)
    source ~/.bashrc

    Now type coins and see what happens!!!!
    If you like the idea and want to support donate quarks at QSKM1JAGEEAkQJD8jpQHDfNnDM7kcmyLcV

    P.S i included those files a zip folder. So just download it, extract the files , change your wallet path in both files, save it , make them executable (chmod 755 ./quark_amount.sh ./coins.sh) and create the aliases.

    Hope you liked it and sorry for any typos :)
    tieum and MasterQ like this.