Witness Failover Script incl. SMS-Alerts powered by dsteem

in #utopian-io7 years ago (edited)

image.png

Ever since I became a Witness I had this uneasy feeling of not knowing if my node was alright or if I had missed any blocks.

GINA is amazing as notification in such an event - but it could easily get under in the sheer amount of notifications. And some of the other alternatives either weren't updated in quite some time or didn't seem to handle errors well.

Thats why I've been using the skills I learned in the last months to create a Witness-Failover script which uses dsteem and should handle errors very well.

It also uses NEXMO as a service to send SMS-Alerts. While this isn't as optimal as a service which would be only used for Witness-Alerts due to the problem not knowing if an incoming SMS is actually from the Witness-Server (unless you have a specific number for that) - an alternative might come in the next releases.

To sum it up:

Features of the Script

  • Watch for Missed Blocks
  • Switch to Backup-Node(s) and / or disable the witness
  • Alert the Witness via SMS of missed blocks
  • RPC-Failover in the event of RPC-Nodes not responding

Important

Now, since the script was just finished yesterday and due to the fact that block misses doesn't happen often and hopefully never - I wasn't able to test the actual missed block logics.

However, I've implented a testmode which can be used regardless if another script is getting used, as it only reports via console.log of events (e.g. missed blocks, send sms etc.)

My goal with this release is to get some tests going - but please keep in mind that I don't take any responsibility if the script isn't working as planned!

Nevertheless, SMS sending works!

Getting Started

I wrote a small guide on how it works and what has to be done to run it in the READ-ME of the project.

Which you will find here: https://github.com/therealwolf42/witness-failover

But I will go over the config real quick - to explain a few things:

{
  "TEST_MODE": "DISABLED",
  "RPC_NODES": [
    "https://api.steemit.com",
    "https://steemd.privex.io",
    "https://gtg.steem.house:8090",
    "https://rpc.buildteam.io",
    "https://steemd.minnowsupportproject.org"
  ],
  "WITNESS": "",
  "BACKUP_KEYS": [
    ""
   ],
  "MISSED_BLOCKS_THRESHOLD":2,
  "INTERVAL":20,
  "USE_SMS_ALERT":"ENABLED",
  "SEND_AFTER_EVERY_MISSED":"ENABLED"
}

TEST_MODE => Test only logic but won't interact with the blockchain / send SMS => ENABLED / DISABLED

WITNESS => Witness Account Name

BACKUP_KEYS => Witness Public Keys

MISSED_BLOCKS_THRESHOLD => How many blocks can be missed until backup-node will be used or disabled if no-more nodes are available

INTERVAL => How often it should check for a missed block

USE_SMS_ALERT => Activate SMS Sending => ENABLED / DISABLED

SEND_AFTER_EVERY_MISSED => Send SMS in the case of a missed block - if DISABLED then SMS will only be send if THRESHOLD is breached => ENABLED / DISABLED


Now, there is also a .env file for the data which should never be uploaded to Github incl. your private active key.

But you will find all of that in the READ-ME of the repository.

Last but not least

It would be amazing if you could test it, even if only in test-mode.

Additionally, if you find any bugs in my code - please let me know (e.g. as issue)



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

People still use SMS? 🤔
I use the Pushover app for sending notifications to my devices in case of errors. Works great, you can have a look.

I get what you're saying and I will implement pushover next - but I feel that SMS is more available when away from WIFI.

Is the best witness

thank you for this post @therealwolf

Good post!Nice content!

Very good post my friend, i like your post

Nice witness post. Were did u write the code in in which program.

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @therealwolf I am @utopian-io. I have just upvoted you!

Achievements

  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x