Compile List Of Useful Pos Commands

Discussion in 'Proof-of-stake Mining' started by sw1, Feb 23, 2016.

  1. 2017/12/15 - Decred v1.1.2 released! → Release Notes  → Downloads
  1. sw1

    sw1 Jr. Member

    Dec 31, 2015
    90
    39
    Male
    Sydney, Australia
    Hey mate, you can try using gitbash for windows and see if that works? Not sure if it will, but could be worth a try!

    https://git-for-windows.github.io/
     
    sambiohazard likes this.
  2. brencelj

    brencelj New Member

    Jan 10, 2016
    49
    17
    I will incorporate this in to my script so it will be a bit better but I will try and make it a bit better over time Thank you :)
     
  3. brencelj

    brencelj New Member

    Jan 10, 2016
    49
    17
    I'll see about that. Just tell me if there is a cmd version of this? I haven't used this in windows since I'm more of a Linux user. If there is a cmd version than I think this could be done quite easy :)
     
  4. anonminer

    anonminer New Member

    Feb 15, 2016
    1
    0
    Male
    #24 anonminer, Feb 29, 2016
    Last edited: Feb 29, 2016
    +1 from me

    If you are a relative newbie (as I am) this gives you a lot of info and is one easy command. I updated my binaries and ran this one command and it gave me all the info I needed to know about tickets, difficulty, missed votes and I whole lot more.
     
  5. techbytes

    techbytes New Member

    Jan 17, 2016
    13
    2
    Male
    Hey, is there a command to show how many of my tickets have voted?

    -tb-
     
  6. brencelj

    brencelj New Member

    Jan 10, 2016
    49
    17
    This is it :) under "voted":
    Code:
    dcrctl --wallet getstakeinfo
     
    techbytes likes this.
  7. drunkenmugsy

    drunkenmugsy Sr. Member
    Advocate (Reddit)

    Dec 28, 2015
    405
    218
    Male
    Hey @sw1 how about adding all these to the first post? Lets make this an even more useful thread.
     
  8. sw1

    sw1 Jr. Member

    Dec 31, 2015
    90
    39
    Male
    Sydney, Australia
    Good idea! I knew I'd finally get round to it eventually :)
     
  9. rohit pawar

    rohit pawar Member
    Advocate (Reddit)

    Dec 26, 2015
    166
    87
    Male
    India
    Is "consolidate" function included?
    Just add it while starting PoS mining or while login wallet . This will remove dust from wallet .
     
  10. sw1

    sw1 Jr. Member

    Dec 31, 2015
    90
    39
    Male
    Sydney, Australia
    Hey Rohit, nope you are the first to mention consolidate function on this thread..... Please tell us more and I'll add it to the first post!

    Cheers!
     
  11. toad

    toad New Member

    Feb 9, 2016
    40
    14
    Male
    #31 toad, Mar 6, 2016
    Last edited: Mar 6, 2016
    v0.0.6
    pi@pi-hole:~/decred/linux-arm $ ./dcrctl --wallet getstakeinfo
    401 Unauthorized.

    pi@pi-hole:~/decred/linux-arm $ screen -R walletPoS

    15:04:55 2016-03-06 [WRN] RPCS: Unauthorized client connection attempt
    15:05:31 2016-03-06 [WRN] RPCS: Unauthorized client connection attempt

    WTF?

    UPDATE: The command on Debian Linux v0.0.6 is

    i@pi-hole:~/decred/linux-arm $ ./dcrctl --wallet -u ''username'' -P ''password'' getstakeinfo
     
  12. drunkenmugsy

    drunkenmugsy Sr. Member
    Advocate (Reddit)

    Dec 28, 2015
    405
    218
    Male
    As little side note as well - None of these commands provide a time/date. On linux you can add ;date to any command and get a time stamp on a new line.
     
  13. brencelj

    brencelj New Member

    Jan 10, 2016
    49
    17
    I wanted to say that I have made 3 config files
    ~/.dcrctl/dcrctl.conf
    ~/.dcrd/dcrd.conf
    Code:
    [Application Options]
    
    rpcuser=USER
    rpcpass=PASS
    
    ~/.dcrwallet/dcrwallet.conf
    Code:
    [Application Options]
    
    username=USER
    password=PASS
    
    So you don't need to type your user and pass in your command.

    I have updated my script a bit:
    Code:
    #! /bin/sh
    
    dcrwalletLogFolder="~/.dcrwallet/logs/mainnet/"
    decredFolder="(DECRED FOLDER)"
    
    cd $decredFolder
    balanceAll=`./dcrctl --wallet getbalance 'default' 0 all`
    balanceLocked=`./dcrctl --wallet getbalance 'default' 0 locked`
    balanceSpendable=`./dcrctl --wallet getbalance 'default' 0 spendable`
    stakeInfo=`./dcrctl --wallet getstakeinfo`
    
    balanceWon=`echo $stakeInfo | grep -Eo '"totalsubsidy": [0-9\.]*,' | sed -ne 's/,//p' | sed -ne 's/\"totalsubsidy\":.//p'`
    votesCount=`echo $stakeInfo | grep -Eo '"voted": [0-9\.]*,' | sed -ne 's/,//p' | sed -ne 's/\"voted\":.//p'`
    missedVotesCount=`echo $stakeInfo | grep -Eo '"missed": [0-9\.]*,' | sed -ne 's/,//p' | sed -n -e 's/\"missed\":.//p'`
    revokedVotesCount=`echo $stakeInfo | grep -Eo '"revoked": [0-9\.]*' | sed -n -e 's/\"revoked\":.//p'`
    ticketPrice=`echo $stakeInfo | grep -Eo '"difficulty": [0-9\.]*,'| sed -ne 's/,//p' | sed -n -e 's/\"difficulty\":.//p'`
    ticketsImatureCount=`echo $stakeInfo | grep -Eo '"immature": [0-9\.]*,' | sed -ne 's/,//p' | sed -n -e 's/\"immature\":.//p'`
    ticketsMatureCount=`echo $stakeInfo | grep -Eo '"live": [0-9\.]*,' | sed -ne 's/,//p' | sed -n -e 's/\"live\":.//p'`
    
    cd $dcrwalletLogFolder
    votedTicketsPerDay=`cat dcrwallet.log | grep Voted | grep -o "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" | uniq -c | tr -d '\n' | sed 's/\s\{3,\}/  |  /g'`
    buyCount=`cat dcrwallet.log | grep SStx | wc -l`
    boughtTicketsPerDay=`cat dcrwallet.log | grep SStx | grep -o "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" | uniq -c | tr -d '\n' | sed 's/\s\{3,\}/  |  /g'`
    revokedTicketsPerDay=`cat dcrwallet.log | grep Revoked | grep -o "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" | uniq -c | tr -d '\n' | sed 's/\s\{3,\}/  |  /g'`
    
    echo ""
    echo "########## Decred report ##########"
    echo ""
    echo "             **Money**"
    echo "      All:          $balanceAll"
    echo "      Locked:       $balanceLocked"
    echo "      Spendable:  $balanceSpendable"
    echo "      Won:          $balanceWon"
    echo ""
    echo "            **Tickets**"
    echo "      All:          $(($ticketsImatureCount+$ticketsMatureCount))"
    echo "      Mature:       $ticketsMatureCount"
    echo "      Imature:      $ticketsImatureCount"
    echo "      Price Now:  $ticketPrice"
    echo ""
    echo "       **Bought Tickets Per Day**"
    echo "    $boughtTicketsPerDay  |"
    echo ""
    echo "            **Votes**"
    echo "      Done:         $votesCount"
    echo "      Missed:       $(($missedVotesCount-$revokedVotesCount))"
    echo "      Revoked:      $revokedVotesCount"
    echo "      Bought:       $buyCount"
    echo "      Failed:       $missedVotesCount"
    echo ""
    echo "       **Voted Tickets Per Day**"
    echo "    $votedTicketsPerDay  |"
    echo ""
    echo "       **Revoked Tickets Per Day**"
    echo "    $revokedTicketsPerDay  |"
    echo ""
    echo "###################################"
    echo ""
     
    eshriek and sw1 like this.
  14. goofoff

    goofoff New Member

    Feb 23, 2016
    4
    3
    Male
    Japan
    in version 0.6 or later, you can set the fee to purchase tickets. default fee is 0.05 dcr.
    dcrctl --wallet setticketfee 0.05

    and you can check average fee in mempool on dcrstats, just for your information.
     
    sw1 likes this.
  15. karamble

    karamble Member
    Developer

    Feb 19, 2016
    57
    71
    #35 karamble, Mar 13, 2016
    Last edited: Mar 13, 2016
    added some lines to get the upcoming Blocks which will receive Rewards:
    Code:
    #! /bin/sh
    
    dcrwalletLogFolder="<YOUR FOLDER>"
    decredFolder="<YOUR FOLDER>"
    
    cd $decredFolder
    balanceAll=`./dcrctl --wallet getbalance 'default' 0 all`
    balanceLocked=`./dcrctl --wallet getbalance 'default' 0 locked`
    balanceSpendable=`./dcrctl --wallet getbalance 'default' 0 spendable`
    stakeInfo=`./dcrctl --wallet getstakeinfo`
    blockcount=`./dcrctl getblockcount`
    
    balanceWon=`echo $stakeInfo | grep -Eo '"totalsubsidy": [0-9\.]*,' | sed -ne 's/,//p' | sed -ne 's/\"totalsubsidy\":.//p'`
    votesCount=`echo $stakeInfo | grep -Eo '"voted": [0-9\.]*,' | sed -ne 's/,//p' | sed -ne 's/\"voted\":.//p'`
    missedVotesCount=`echo $stakeInfo | grep -Eo '"missed": [0-9\.]*,' | sed -ne 's/,//p' | sed -n -e 's/\"missed\":.//p'`
    revokedVotesCount=`echo $stakeInfo | grep -Eo '"revoked": [0-9\.]*' | sed -n -e 's/\"revoked\":.//p'`
    ticketPrice=`echo $stakeInfo | grep -Eo '"difficulty": [0-9\.]*,'| sed -ne 's/,//p' | sed -n -e 's/\"difficulty\":.//p'`
    ticketsImatureCount=`echo $stakeInfo | grep -Eo '"immature": [0-9\.]*,' | sed -ne 's/,//p' | sed -n -e 's/\"immature\":.//p'`
    ticketsMatureCount=`echo $stakeInfo | grep -Eo '"live": [0-9\.]*,' | sed -ne 's/,//p' | sed -n -e 's/\"live\":.//p'`
    
    cd $dcrwalletLogFolder
    votedTicketsPerDay=`cat dcrwallet.log | grep Voted | grep -o "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" | uniq -c | tr -d '\n' | sed 's/\s\{3,\}/  |  /g'`
    buyCount=`cat dcrwallet.log | grep SStx | wc -l`
    boughtTicketsPerDay=`cat dcrwallet.log | grep SStx | grep -o "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" | uniq -c | tr -d '\n' | sed 's/\s\{3,\}/  |  /g'`
    revokedTicketsPerDay=`cat dcrwallet.log | grep Revoked | grep -o "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" | uniq -c | tr -d '\n' | sed 's/\s\{3,\}/  |  /g'`
    rewardblock=`cat dcrwallet.log | grep Voted  | cut -d "(" -f2 | cut -d ")" -f1 | sed -e 's/height / /g' | tr -d "\n" |{
      read line;
      for i in $line;
      do
      payblock="$((i +256))";
            if [ $payblock -gt $blockcount ]; then
            echo -n "$payblock ";
            fi
      done;
      echo
    }`
    echo ""
    echo "########## Decred report ##########"
    echo ""
    echo "             **Money**"
    echo "      All:          $balanceAll"
    echo "      Locked:       $balanceLocked"
    echo "      Spendable:  $balanceSpendable"
    echo "      Won:          $balanceWon"
    echo ""
    echo "            **Tickets**"
    echo "      All:          $(($ticketsImatureCount+$ticketsMatureCount))"
    echo "      Mature:       $ticketsMatureCount"
    echo "      Imature:      $ticketsImatureCount"
    echo "      Price Now:  $ticketPrice"
    echo ""
    echo "       **Bought Tickets Per Day**"
    echo "    $boughtTicketsPerDay  |"
    echo ""
    echo "            **Votes**"
    echo "      Done:         $votesCount"
    echo "      Missed:       $(($missedVotesCount-$revokedVotesCount))"
    echo "      Revoked:      $revokedVotesCount"
    echo "      Bought:       $buyCount"
    echo "      Failed:       $missedVotesCount"
    echo ""
    echo "       **Voted Tickets Per Day**"
    echo "    $votedTicketsPerDay  |"
    echo ""
    echo "       **Revoked Tickets Per Day**"
    echo "    $revokedTicketsPerDay  |"
    echo ""
    echo "      **REWARD BLOCKS**"
    echo "     Current Block: $blockcount"
    echo "     Upcoming Reward Blocks: $rewardblock"
    echo "###################################"
    echo ""
    
     
    eshriek and brencelj like this.
  16. brencelj

    brencelj New Member

    Jan 10, 2016
    49
    17
    #36 brencelj, Mar 13, 2016
    Last edited: Mar 13, 2016
    @karamble well this is interesting but how do you calculate this and how exact it is and this rewards are vote rewards right? and I have added some other stuff in mine as well :D will post it here. I hope it helped :D and thank you for this :)

    Code:
    #! /bin/sh
    
    dcrwalletLogFolder="<YOUR FOLDER>"
    decredFolder="<YOUR FOLDER>"
    
    cd $decredFolder
    balanceAll=`./dcrctl --wallet getbalance 'default' 0 all`
    balanceLocked=`./dcrctl --wallet getbalance 'default' 0 locked`
    balanceSpendable=`./dcrctl --wallet getbalance 'default' 0 spendable`
    stakeInfo=`./dcrctl --wallet getstakeinfo`
    maxPrice=`./dcrctl --wallet getticketmaxprice`
    ticketFee=`./dcrctl --wallet getticketfee`
    blockcount=`./dcrctl getblockcount`
    
    balanceWon=`echo $stakeInfo | grep -Eo '"totalsubsidy": [0-9\.]*,' | sed -ne 's/,//p' | sed -ne 's/\"totalsubsidy\":.//p'`
    votesCount=`echo $stakeInfo | grep -Eo '"voted": [0-9\.]*,' | sed -ne 's/,//p' | sed -ne 's/\"voted\":.//p'`
    missedVotesCount=`echo $stakeInfo | grep -Eo '"missed": [0-9\.]*,' | sed -ne 's/,//p' | sed -n -e 's/\"missed\":.//p'`
    revokedVotesCount=`echo $stakeInfo | grep -Eo '"revoked": [0-9\.]*' | sed -n -e 's/\"revoked\":.//p'`
    ticketPrice=`echo $stakeInfo | grep -Eo '"difficulty": [0-9\.]*,'| sed -ne 's/,//p' | sed -n -e 's/\"difficulty\":.//p'`
    ticketsImatureCount=`echo $stakeInfo | grep -Eo '"immature": [0-9\.]*,' | sed -ne 's/,//p' | sed -n -e 's/\"immature\":.//p'`
    ticketsMatureCount=`echo $stakeInfo | grep -Eo '"live": [0-9\.]*,' | sed -ne 's/,//p' | sed -n -e 's/\"live\":.//p'`
    
    cd $dcrwalletLogFolder
    votedTicketsPerDay=`cat dcrwallet.log | grep Voted | grep -o "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" | uniq -c | tr -d '\n' | sed 's/\s\{3,\}/  |  /g'`
    buyCount=`cat dcrwallet.log | grep SStx | wc -l`
    boughtTicketsPerDay=`cat dcrwallet.log | grep SStx | grep -o "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" | uniq -c | tr -d '\n' | sed 's/\s\{3,\}/  |  /g'`
    revokedTicketsPerDay=`cat dcrwallet.log | grep Revoked | grep -o "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" | uniq -c | tr -d '\n' | sed 's/\s\{3,\}/  |  /g'`
    dateNow=`date +"%d-%b-%Y %X"`
    rewardblock=`cat dcrwallet.log | grep Voted  | cut -d "(" -f2 | cut -d ")" -f1 | sed -e 's/height / /g' | tr -d "\n" |{
      read line;
      for i in $line;
      do
      payblock="$((i +256))";
            if [ $payblock -gt $blockcount ]; then
            echo -n "$payblock ";
            fi
      done;
      echo
    }`
    
    echo ""
    echo "########## Decred report ##########"
    echo ""
    echo "      $dateNow"
    echo ""
    echo "             **Money**"
    echo "      All:          $balanceAll"
    echo "      Locked:       $balanceLocked"
    echo "      Spendable:  $balanceSpendable"
    echo "      Won:          $balanceWon"
    echo ""
    echo "            **Tickets**"
    echo "      All:          $(($ticketsImatureCount+$ticketsMatureCount))"
    echo "      Mature:       $ticketsMatureCount"
    echo "      Imature:      $ticketsImatureCount"
    echo "      Price Now:  $ticketPrice"
    echo "      My Price:   $maxPrice"
    echo "      My Fee:     $ticketFee"
    echo ""
    echo "       **Bought Tickets Per Day**"
    echo "    $boughtTicketsPerDay  |"
    echo ""
    echo "            **Votes**"
    echo "      Done:         $votesCount"
    echo "      Missed:       $(($missedVotesCount-$revokedVotesCount))"
    echo "      Revoked:      $revokedVotesCount"
    echo "      Bought:       $buyCount"
    echo "      Failed:       $missedVotesCount"
    echo ""
    echo "       **Voted Tickets Per Day**"
    echo "    $votedTicketsPerDay  |"
    echo ""
    echo "       **Revoked Tickets Per Day**"
    echo "    $revokedTicketsPerDay  |"
    echo "" 
    echo "        **Reward Paying Block**"
    echo "     Current Block: $blockcount"
    echo "     Upcoming Reward Blocks: $rewardblock"
    echo ""
    echo "###################################"
    echo ""
    
     
  17. karamble

    karamble Member
    Developer

    Feb 19, 2016
    57
    71
    @brencelj - Its a clone of that 'votedTicketsperday' command. I get the votedTicketsperday, parse out the blockheight on which the vote was made and add 256 blocks to it (tickets will be rewarded 256 blocks after the vote).
    In the last step i decide, if the block is higher then the current blockcount -> this will be a future block with vote rewards..
     
    brencelj likes this.
  18. ImpellitterI

    ImpellitterI New Member

    Jan 11, 2016
    57
    2
    Male
    256 blocks to reward a voted ticket and how long blocks to refund a locked found ( to be a spendable ) ?
     
  19. davecgh

    davecgh Hero Member
    Developer Organizer

    Dec 31, 2015
    642
    788
    Male
    United States
    It's the same -- 256 blocks.
     
  20. ImpellitterI

    ImpellitterI New Member

    Jan 11, 2016
    57
    2
    Male
    Dave,
    Founds used to buy a ticket as rewards together in same block ?
     

Share This Page