Welcome to the Dash Forum!

Please sign up to discuss the most innovative cryptocurrency!

Get Masternode's position in the payment queue

Discussion in 'Masternode Guides' started by xkcd, Jul 23, 2018.

  1. xkcd

    xkcd Member

    Joined:
    Feb 19, 2017
    Messages:
    61
    Likes Received:
    40
    Trophy Points:
    58
    Dash Address:
    XrcWshofvVCpeXoZjTiYxwysV9w2szzjRr
    A question that comes up time again is,
    Finally a simple function exists that let's you answer that question yourself and monitor your MN(s) progress through the payment queue!

    Introducing mn_queue.sh this niftly little function allows you to find your place in the payment queue, let's look at some examples.

    Run it on its own to print the entire list for your perusal. The first number is the position in the Payment Queue.

    upload_2018-7-23_18-54-43.png

    Together with grep, we can find an individual MN, replace the address seen with your MN address!

    upload_2018-7-23_18-56-45.png

    Or, if you have a bunch of MNs, we can search for a bunch as well like so,


    upload_2018-7-23_18-59-38.png

    Here I have shown an example where I only use the last few characters of the MN public key as it is usually enough to uniquely identify an MN.

    So, how do we get you setup with this capability on your MN, stat?

    Installation

    Login to the VPS and change to the user that is running the MN, for example mine is simply called dash.
    Verify you have dash-cli in your PATH.

    Code:
    which dash-cli
    If this returns an error edit your ~/.profile file and ensure that PATH variable has the location of the directory containing dash-cli.

    Next we will download the script,
    Code:
    cd /tmp
    git clone https://github.com/kxcd/mn_queue/
    cd mn_queue
    chmod a+x mn_queue.sh
    Now we can run it to test it like so,
    Code:
    . ./mn_queue.sh
    mn_queue
    On some machines the function will run after the first line, others will only execute it when both lines are entered. To make the changes permanent and why wouldn't you, continue with the below.
    Code:
    echo >> ~/.bashrc
    tail -n +17 mn_queue.sh >> ~/.bashrc
    Test it again with
    Code:
    mn_queue | head
    To print out the first 10 MNs.

    Please leave me feedback here in the forum, or if you want to chat or need support, you can contact me on the Dash Discord as xkcd#7307
     
    #1 xkcd, Jul 23, 2018
    Last edited: Jul 23, 2018
    • Like Like x 4
    • Winner Winner x 2
  2. xkcd

    xkcd Member

    Joined:
    Feb 19, 2017
    Messages:
    61
    Likes Received:
    40
    Trophy Points:
    58
    Dash Address:
    XrcWshofvVCpeXoZjTiYxwysV9w2szzjRr
    Thanks to @moocowmoo, he re-factored the code and came up with a tighter faster way of printing the above list. If you already have followed the above steps in the guide and wish to use the below version, then edit your ~/.bashrc to remove the mn_queue function before proceeding with the below.

    Create a script with the code for the mn_queue function.

    Code:
    cat >/tmp/mn_queue.sh <<"EOF"
    #!/bin/sh
    mn_queue(){
        dash-cli masternode list full \
            | grep "[^_]ENABLED 70213" \
            | awk -v date="$(date +%s)" '{as=date-$7; mst=(as>$8?as:$8); sep="\t" ; print mst sep date sep $5 sep $7 sep $8 sep as}' \
            | sort -s -k1,1n \
            | awk '{print NR "\t" $0}'
    }
    mn_queue
    EOF
    
    Make that file executable and test that it works.
    Code:
    chmod a+x /tmp/mn_queue.sh
    /tmp/mn_queue.sh
    
    You should see the full list of MNs and their relative position in the queue, if it is working execute the below command to make it permanent.

    Code:
    echo >>~/.bashrc
    tail -n +2 /tmp/mn_queue.sh |head -7 >>~/.bashrc
    
    Logout and log back in to your shell to make sure it gets loaded each time you login and test again with
    Code:
    mn_queue
    Thanks to Mr. Cow for the time spent on optimising this code, much appreciated ! :)
     
    #2 xkcd, Aug 18, 2018
    Last edited: Mar 1, 2019
    • Like Like x 4
    • Informative Informative x 1
  3. brownbear

    brownbear New Member

    Joined:
    Feb 3, 2018
    Messages:
    36
    Likes Received:
    10
    Trophy Points:
    8
    I have been checking the position in the queue at Dashcentral.org. I believe that's the easiest way. (is seems to be reliable, should one have any doubt?)

    The Payment queue rank for one of my MN = "94/4890 (masternode has reached a queue rank > 10% and is now in random selection for the payment)," that was several hours ago, but now it says: Payment queue rank: 96/4890.

    and it has been more than 16 days since last payment!!!

    Is this normal? I don't think the rank should drop down!

    Do I have to register my MN for the DIP003 masternode list? Is that step mandatory for payments?

    I would appreciate your insights into this, thanks in advance!

    BB
     
  4. xkcd

    xkcd Member

    Joined:
    Feb 19, 2017
    Messages:
    61
    Likes Received:
    40
    Trophy Points:
    58
    Dash Address:
    XrcWshofvVCpeXoZjTiYxwysV9w2szzjRr
    Hi BrownBear you have good reason to be concerned! DC is calculating the position incorrectly! The main bug I noted with DC is that if your masternode gets restarted and placed back to the end of the queue DC does not account for this. To find you actual position in the queue, use my script in the second post on this thread.
     
    • Like Like x 1
  5. brownbear

    brownbear New Member

    Joined:
    Feb 3, 2018
    Messages:
    36
    Likes Received:
    10
    Trophy Points:
    8
    Yup! that's what I learned too! I double checked on my own server and on dashninja.pl, both of which were actually OK. And BTW, I got my pay offs today as well! ;-)

    Thanks xkcd!
     
    • Like Like x 1
  6. tamias

    tamias New Member

    Joined:
    Dec 9, 2017
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    #6 tamias, Mar 18, 2019
    Last edited: Mar 18, 2019

Share This Page