Masternode Proof-of-Stake Push Notifications (Ammended)

in #cryptocurrency6 years ago (edited)

A few days back, I wrote about my journey into the proof of stake coin Nyerium. One of the later posts in the series involved push notifications (blogpost entitled Masternode Proof-of-Stake Push Notifications).

I was excited, even looking forward, to every time a note appeared or a notification sound rang. It meant my masternode(s) were passively staking for me and in the process, I was earning rewards. One quiet morning, all of them stopped. So I checked the VPS instances and found everything in order.

Why then did the push notifications stop? Further research into the issue showed that after 500 pushes or API calls, Pushbullet will not continue with the service unless I paid about $5 a month (I have consumed my monthly "free" allocation). This wasn't what I was expecting. And $5 a month is a little too steep for the service I require.

Telegram Bot

So the research continued and to cut the story short, the chosen software is the chat client, "Telegram". The bigger part of the procedure is how to create a Telegram Bot to use for the push notification. The step-by-step guide on how this is done is outlined in this website.

From the procedure, note the following information: the bot token, and your userid. The token is clearly identified (and given) by BotFather, but the userid is not. This will be part of the JSON output of the API call https://api.telegram.org/bot{TOKEN}/getUpdates]. It is usually the number before your given name. These two are the most critical information needed for push notifications. Note them down for use later.

Python Library Install

Now, connect to your VPS via PuTTY (or another SSH client of your choosing). Like Pushbullet, Python will still be used. And using Python's built in software package installer, pip, install "telegram-send". It's dependencies will be installed as well.
$ sudo pip3 install telegram-send

PIPTELESEND.PNG

If python3-setuptools is not installed, the above command may complain. In case it does, install python3-setuptools.
$ sudo apt-get -y install python3-setuptools

 

Configure Telegram-Send

Having successfully installed telegram-send, configure it using the information obtained above. Input the token and the userid when asked.
$ telegram-send --configure

Test Push Notification

Since this procedure uses Telegram, you may opt to uninstall Pushbullet and replace it with Telegram. In any case, install Telegram.
$ telegram-send "[NYEX] Balance: $(nyerium-cli getbalance)"

Configure Nyerium Staker

You will then get a notification about your wallet's Nyerium balance. If that is successful, make the necessary edits to make Telegram the default notification vehicle for the wallet.

Using your favorite text editor edit the file ~nyex/.nyerium/nyerium.conf and change the walletnotify line:
walletnotify=telegram-send "[NYEX] Balance: $(nyerium-cli getbalance) | %s"

You may opt to replace the "alertnotify=" line as well.

Now, everytime a wallet-related event is involved the push goes to Telegram. The difference between Pushbullet is that the Telegram Bot you created can notify you an unlimited number of times about events on your Nyerium wallet.

 
If you happened to stumble upon this post and wondering what a masternode is (or what Nyerium is), you may want to backread some of the posts created specifically on how to build your own masternode.

 


Find this post useful? Buy me coffee or beer by these wallets. Cheers!

  • Bitcoin (BTC) - 3Kyjg1Wj1PNGN3KhiRprxYvvQpdjC5kT3k
  • Etherium (ETH) - 0x5F168F895C63ccC5FbEf921047bc2b63f6780c3F
  • SmartCash - SbgqBUuGBVaaFERmc5zPn8XStxXe7vE1SL

 

Sort:  

This post has received a 0.52 % upvote from @drotto thanks to: @dillagr.

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by dillagr from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.

How Cool!

You got a 3.12% upvote from @coolbot courtesy of @dillagr!

Help us grow, delegate today!

Hey man ! Interesting ;) thanks. But is there a way to do this without having to start the server ? Does this notification command need to go out of the wallet in order to ask the balance of this wallet ? ;) cheers

it uses the wallet's RPC interface to communicate.. if you want to check the balance of the wallet, you may alter the telegram-send and incorporate (in this case, NYEX): $(nyerium-cli getbalance)

any change you make to the wallet.conf file needs a restart of the wallet itself. i don't think there is a workaround to it.

Thanks a lot ! ;)