Make the last siging key disabled one so it will disable your node in case all your witness nodes are down. I have taken out the code to send a email for notification since it is quite customised to my settings but you can easily add it, the easily way to send a email would be to launch the mail utility.
The default setting is to switch if there are 4 missed blocks in the last 6 minutes. You can adjust if you are outside TOP 20. The interval is the time interval to check if there are new misses.
Last but not least, I would recommend running this using screen or pm2
Every little helps! I hope this helps!
Steem On!~
If you like my work, please consider voting for me, thanks! https://steemit.com/~witnesses type in justyy and click VOTE
Alternatively, you could proxy to me if you are too lazy to vote!
Let’s introduce a concept i.e. witness-voting factor that represent the average witness voting each other in the TOP 20. The maximum value is 20, and the minimal is 0.
If the witness-voting factor is 20, it means that all top 20 witnesses are voting each other. This is not healthy as the gap (of votes) between TOP 20 and the rest will be always increasing. Also, since witnesses are voting each other, it is kinda controlled by a group of people who share the same interests - this is centralisation admit it or not.
SteemJs code to compute the witness-voting factor
The idea is to retrieve the list of the votes of the TOP 20, and group them, count the frequency and sort them. Compute the average. The witness-voting factor for Top 20 on STEEM blockchain is 4.5, compared to 12.65 on HIVE.
How many witnesses are running on 23.1 and how many of them are active? It turns out answering this question does not require preprocess blocks on steem blockchain e.g. SteemSQL. Rather, we can get the answer by pure SteemJS.
Get All Witnesses
First, we can use the steemp.api.getWitnessCount to return the list of all registered witnesses - which is a lot more than we thought, currently more than 1400 witnesses but of course many of them have been disabled or never produced a block.
1 2 3 4 5 6 7 8 9 10 11
function getTotalWitnesses() { return new Promise((resolve, reject) => { steem.api.getWitnessCount(function(err, result) { if (!err) { resolve(result); } else { reject(err); } }); }); }
Get All Witnesses Accounts
Then, we can use steem.api.getWitnesses to retreive the witnesses information for multiple accounts at the same time.
1 2 3 4 5 6 7 8 9 10 11 12
function getAllWitnessAccounts(total) { return new Promise((resolve, reject) => { steem.api.getWitnesses([...Array(total).keys()], function(err, result) { if (!err) { resolve(result); } else { reject(err); } }); }); } `
Filtering
Then, we can chain those two functions to filter out those witnesses that are running 23.1 and are active.
1 2 3 4 5 6 7
(async function () { const totalWitnesses = await getTotalWitnesses(); let data = await getAllWitnessAccounts(totalWitnesses); log(data.filter(x => { return x.running_version === "0.23.1" && (x.signing_key !== "STM1111111111111111111111111111111114T1Anm"); }).length); })();
The answer is 46 witnesses are running on 23.1 and all of them are active.
If we point the RPC node to HIVE chain, we get 107 witnesses running on 23.0.
Slightly changing the query, we know: There are 24 Witnesses running at 0.23.0 but they are disabled. And there are 9 witnesses running at 0.23.0 and they are ‘active’ which may be those HIVE witnesses who didn’t take offline they witnesses.
Latest blocks are showing 0 transactions, please refresh in a few minutes (I am looking into solving this issue, any help would be appreciated). The Last Irreversible blocks are fine.
customizing known operations - I will gradually improve it.
showing account’s history page
search field, filtering
Every little helps! I hope this helps!
Steem On!~
If you like my work, please consider voting for me, thanks! https://steemit.com/~witnesses type in justyy and click VOTE
Alternatively, you could proxy to me if you are too lazy to vote!
Blockchain is a fancy word, and not many people understand it. If you want to explain this to your GF/partner, what would be the most simple way?
Right, blocks are chained in one way, as time goes on, in particular for STEEM blockchain, every 3 seconds, we append a new block to the end of the current chain. So the chain goes longer and longer each day.
We need a way to tell if the current block can be attached (we can’t just produce a random block and force appending it). For each block, we will have a unique block ID, and we will have a previous field that match the previous Block ID. The first block on steem blockchain has previous set to 0000000000000000000000000000000000000000.
As you can see, the previous value is the same as the block_id for the Block 1. This goes on and on. Let’s print the first 10 blocks’ previous and block_id:
Steem Blockchain is a public database. Every 3 seconds, one witness helps to package operations (comment, vote, transfer etc) into a block, seal it with the signing key, and finally push to the chain for a small reward.
As the blockchain gets bigger and bigger, it takes enormous efforts to alter the chain, as you will need to modify every prior blocks.
Let’s say, I have an application that is written in NodeJs, that process the latest blocks of the steem blockchain and write data into a database. I have three ways of running it on my server.
Using Screen
As you probably know, when you are disconnected from a SSH session, the programs that are launched in the session will be terminated. There is any easy way to fix this. You can start a session by using command screen -S name before you run any long-running program e.g. system updates or a program that needs to run forever.
In case the SSH is disconnected, the programs will be still running. And you can use command screen -r name to re-connect to the session. You can screen -ls to list the current sessions, and screen -d name to detach a session.
The advantage of using this method is:
you can easily monitor the application (by seeing its output)
you can easily terminate or restart the application e.g. Ctrl + C
the application runs continuously, meaning that you can keep up to the latest blocks and provide a less than 3 second sync time.
Some disadvantages:
If the application exists abnormaly, it is not restarted automatically - thus you would need to add the error-handling in your code.
Long-running code may tend to have more problems: e.g. memory-leaks, crash at some point.
Putting it in Crontab
Another way is to run your program in crontab. However, the finest granularity is every minute i.e. you can specify your application to run every minute.
Advantages are:
You probably don’t need to do error-handling. In case it fails, it fails. You can just wait for next minute (restart automatically).
Not to worry about memory leaks. It is less likely to go wrong due to memory issue.
Disadvantages:
Lose the ability to sync real-time with the blocks
Not easy to monitor the output (you can redirect the errors to files though)
Using a Process Manager
You can combine the both advantages using a Process Manager. For example, if it is a NodeJs application, you can use pm2 utility.
Advantages:
automatically restart your application in case it crashes or some conditions are met e.g. memory constraints, age.
easy to monitor the output of each application e.g. you can pm2 show app
easy to terminate pm2 delete app or restart pm2 restart app
the application runs continuously
error-handling is optional - but considered a good practise not to let pm2 restart your app.