[UPDATE] Steemfeed-JS 2.0 released! Now AppBase ready. Please update.
What is Steemfeed-JS?
Steemfeed-JS is a price feed script written by myself, which is used by many witnesses to produce their Steem:USD price feed, an important part of being an active witness.
What's new in 2.0?
It's been long overdue, but Steemfeed-JS has now been updated to use Steem-JS, making it appbase compatible. Previously it was only compatible with nodes which run Steem 0.19.6 or lower.
It's also more reliable than ever, as it includes an automatic retry system to deal with flaky RPC nodes. It's still strongly recommended to have a cron which restarts it every few hours, but overall it's much better.
Here's an example of it running on my own witness, and automatically retrying on failure:
[2018-09-16T02:00:02.979Z] Attempting to login into account someguy123
[2018-09-16T02:00:02.979Z] Loading account data for someguy123
[2018-09-16T02:00:05.808Z] Successfully connected. Getting data for someguy123
[2018-09-16T02:00:05.870Z] Successfully logged into someguy123
[2018-09-16T02:00:05.870Z] Publishing immediately, then every 180 minute(s)
[2018-09-16T02:00:05.871Z] Querying Bittrex (btc/steem)
[2018-09-16T02:00:05.873Z] Querying Poloniex (btc/usd)
[2018-09-16T02:00:06.020Z] STEEM/USD is 0.727
[2018-09-16T02:00:06.020Z] Attempting to publish feed...
Failed to publish feed...
reason: HTTP 502: Bad Gateway
Will retry in 60 seconds
[2018-09-16T02:01:21.257Z] Data published at: Sun Sep 16 2018 02:01:21 GMT+0000 (UTC)
[2018-09-16T02:01:21.257Z] Successfully published feed.
[2018-09-16T02:01:21.257Z] TXID: f4f7eb8d8a1d138f4e6c83e2fcbd432d06350728 TXNUM: 0
It even gives you the transaction ID + number, as proof that it published successfully.
How to install Steemfeed-JS
(upgrade instructions after this section)
To install Steemfeed-JS, I strongly recommend using Docker.
If you're using my Steem-in-a-box (steem-docker) to run your witness, you probably already have docker installed, so you can skip this step.
If not, you can run these commands to install docker:
sudo apt update
sudo apt install curl git
curl https://get.docker.com | sh
echo "Adding user $(whoami) to docker group"
sudo usermod -aG docker $(whoami)
After installing docker, you should log out of your server and back in again (if using SSH, close the connection and re-connect).
Now you can install it:
git clone https://github.com/someguy123/steemfeed-js.git
cd steemfeed-js
cp config.example.json config.json
You'll need to adjust your config appropriately:
nano config.json
An example config is provided, just fill out your witness name and put in your active private key.
{
"name": "your steem name",
"wif": "your active private key",
"interval": 60,
"peg": false,
"peg_multi": 1.0
}
The interval is in minutes. it's generally only needed to publish every 2 hrs (120 mins) or 3 hrs (180 mins).
The peg settings don't need changed unless you would like to set a bias on your feed. Biases are only used in times of severe instability on the SBD price.
Once you've configured it, if you're using nano, just press CTRL-X and say yes to saving.
Now that you've configured it, you can now start it up :)
# make sure you don't forget the dot (.) at the end!
docker build -t steemfeed-js .
docker run -itd --name=steemfeed steemfeed-js
If you've configured it properly, it should be working by now.
To check the status, use the docker logs command
docker logs steemfeed
You should see something like this:
[2018-09-19T20:00:03.029Z] Loaded configuration:
Username: someguy123
Bias: Disabled
RPC Node: https://steemd.privex.io
-------------
[2018-09-19T20:00:03.030Z] Attempting to login into account someguy123
[2018-09-19T20:00:03.031Z] Loading account data for someguy123
[2018-09-19T20:00:03.378Z] Successfully connected. Getting data for someguy123
[2018-09-19T20:00:03.416Z] Successfully logged into someguy123
[2018-09-19T20:00:03.416Z] Publishing immediately, then every 180 minute(s)
[2018-09-19T20:00:03.417Z] Querying Bittrex (btc/steem)
[2018-09-19T20:00:03.419Z] Querying Poloniex (btc/usd)
[2018-09-19T20:00:03.585Z] STEEM/USD is 0.781
[2018-09-19T20:00:03.585Z] Attempting to publish feed...
[2018-09-19T20:00:09.874Z] Data published at: Wed Sep 19 2018 20:00:09 GMT+0000 (UTC)
[2018-09-19T20:00:09.874Z] Successfully published feed.
[2018-09-19T20:00:09.874Z] TXID: 7f94dbf33188500b9fd99cbb95b6eb725b4c13ea TXNUM: 10
Assuming you see the "Successfully published feed" line, then everything is working. You now have a working appbase-compatible price feed :)
For good measure, I recommend setting up a cron to restart the feed every so often. This prevents any instabilities in the steem-js code, or the steemfeed-js code from hanging the script, as it will automatically be restarted by the system after a set period of time.
crontab -e
If you are asked for an editor and you're unsure, choose nano
as it is the easiest to use.
Make a new line at the bottom of the file with the following;
0 */2 * * * docker restart steemfeed
This line tells the system to restart the steemfeed docker container every 2 hours. You can adjust the 2 to something else if you want.
Now just press CTRL-X and say yes to saving. Now your feed will automatically be restarted by the system every few hours, increasing the reliability of your feed.
Upgrading from a previous version
To upgrade from a previous version of steemfeed-js, first check your config.json
for the node which it's set to.
If you don't see a node config, i.e. "node": "wss://steemd.privex.io"
, then you don't have to do anything, it will automatically use https://steemd.privex.io
, the node load balancer ran by @privex
If you do have a node config, change "wss" to "https" - this will allow it to work with both Appbase/Jussi nodes, and older nodes.
Then just type the following to upgrade your software:
git pull
docker build -t steemfeed-js .
docker stop steemfeed
docker rm steemfeed
docker run -itd --name=steemfeed steemfeed-js
The above commands will:
- Download the latest updates
- Build the new docker image
- Stop the old feed and remove the image
- Start the feed with the latest software
To check the status, use the docker logs command
docker logs steemfeed
You should see something like this:
[2018-09-19T20:00:03.029Z] Loaded configuration:
Username: someguy123
Bias: Disabled
RPC Node: https://steemd.privex.io
-------------
[2018-09-19T20:00:03.030Z] Attempting to login into account someguy123
[2018-09-19T20:00:03.031Z] Loading account data for someguy123
[2018-09-19T20:00:03.378Z] Successfully connected. Getting data for someguy123
[2018-09-19T20:00:03.416Z] Successfully logged into someguy123
[2018-09-19T20:00:03.416Z] Publishing immediately, then every 180 minute(s)
[2018-09-19T20:00:03.417Z] Querying Bittrex (btc/steem)
[2018-09-19T20:00:03.419Z] Querying Poloniex (btc/usd)
[2018-09-19T20:00:03.585Z] STEEM/USD is 0.781
[2018-09-19T20:00:03.585Z] Attempting to publish feed...
[2018-09-19T20:00:09.874Z] Data published at: Wed Sep 19 2018 20:00:09 GMT+0000 (UTC)
[2018-09-19T20:00:09.874Z] Successfully published feed.
[2018-09-19T20:00:09.874Z] TXID: 7f94dbf33188500b9fd99cbb95b6eb725b4c13ea TXNUM: 10
Assuming you see the "Successfully published feed" line, then everything is working. You now have a working appbase-compatible price feed :)
GIF Avatar by @stellabelle
Do you like what I'm doing for STEEM/Steemit?
Vote for me to be a witness - every vote counts.
Don't forget to follow me for more like this.
Have you ever thought about being a witness yourself? Join the witness channel. We're happy to guide you! Join in shaping the STEEM economy.
Are you looking for a new server provider? My company @privex offers highly-reliable and affordable dedicated and virtual servers for STEEM, LTC, and BTC! Check out our website at https://www.privex.io
I continue to think that @someguy123 is one of the best witnesses that we have. Thanks for your service to this community.
<3
Awesome job! Thanks so much for doing this so quickly!
Wow this is an exceptional upgrade. You are one of the few witnesses I can see is very active around here and I must commend you for that. Keep it up bro.
thank @someguy123 ! really appreciate all your help
Oh I reinstalled earlier today because it stopped after the crash, I'm guessing it was the new version then, it downloaded a bunch of stuff.
will check it asap, thank you
Thanks for the account helped me alot.
Posted using Partiko Android
Very tough to understand as I'm new to this. Will have to check it out. But I guess you deserve my vote for witness.
Hi
Where do you guys get help with witness issues? steemit.chat seems dead and i'm stuck for a week already trying to update my witness to 0.20...
Thanks