create account

Steemfeed-JS - A NodeJS price feed for witneses by someguy123

View this thread on: hive.blogpeakd.comecency.com
· @someguy123 · (edited)
$22.94
Steemfeed-JS - A NodeJS price feed for witneses
### This article is targeted at developers. Primarily witnesses. If you don't understand what a witness is, or why a price feed is needed, [read my article explaining witnesses](https://steemit.com/witness-category/@someguy123/seriously-what-is-a-witness-why-should-i-care-how-do-i-become-one-answer)

Due to recent changes in @xeroc's Piston, @jesta's witness price feed isn't working correctly.

While I'm not a big fan of Javascript, @svk's SteemJS-lib is pretty good. I used it to build **Steemfeed-JS**, which is a witness price feed in Javascript. It does **NOT** require `cli_wallet`, it should work across Windows, OSX, and Linux, with all dependencies in JS (just like @jesta/@clayop's).

The price data is retrieved from my service, [Steem Value](https://steemit.com/steem/@someguy123/steemvalue-instant-steem-sbd-btc-usd-conversion-rates-in-your-browser), since it offers direct `steem_usd` prices via the JSON API. If people want to add more exchanges, they can submit a Pull Request.

### How to install?

The source code is up on Github: https://github.com/Someguy123/steemfeed-js/

It requires Node v6. However I've also packaged it up with Docker for quick setup on most platforms.

First, download the git repository, then edit config.json as needed. The interval is in minutes.
```
git clone https://github.com/Someguy123/steemfeed-js.git
cd steemfeed-js
cp config.example.json config.json
nano config.json
```

Now, you can run it either with Node v6, or through Docker (recommended).

Using docker:

```
docker build -t steemfeed-js .
docker run -it --rm --name feed steemfeed-js

# Check the status with docker logs
docker logs feed
```

Using NodeJS:
```
# I recommend using NVM to manage NodeJS versioning
nvm use v6

npm install
npm start
```

Small side note:

If you see a warning like this:

```
WARNING! ws connection wss://node.steem.ws closed
WebSocket: will try to reconnect in 1 sec, attempt #1
connecting to wss://node.steem.ws
```

This is **not an error**. This is simply STEEM.WS disconnecting after 60 seconds of being idle. The script will still function with no problems at all.

---

Do you like what I'm doing for STEEM/Steemit?
----
[Vote for me to be a witness](https://steemit.com/~witnesses) - every vote counts. 
----
Don't forget to follow me for more like this.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 86 others
properties (23)
authorsomeguy123
permlinksteemfeed-js-a-nodejs-price-feed-for-witneses
categorywitness-category
json_metadata{"tags":["witness-category","steem","steem-help","steemit"],"users":["xeroc","jesta","svk"],"links":["https://steemit.com/witness-category/@someguy123/seriously-what-is-a-witness-why-should-i-care-how-do-i-become-one-answer","https://steemit.com/steem/@someguy123/steemvalue-instant-steem-sbd-btc-usd-conversion-rates-in-your-browser","https://github.com/Someguy123/steemfeed-js/","https://steemit.com/~witnesses"]}
created2016-09-16 21:45:30
last_update2016-09-16 23:44:18
depth0
children8
last_payout2016-10-17 23:20:15
cashout_time1969-12-31 23:59:59
total_payout_value20.884 HBD
curator_payout_value2.059 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,309
author_reputation103,945,664,283,580
root_title"Steemfeed-JS - A NodeJS price feed for witneses"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,270,641
net_rshares18,544,244,190,571
author_curate_reward""
vote details (150)
@diabloza ·
hi someguy123 just a question when you edit the config.json file do you use your personal wif or the wif of your witness node ??
properties (22)
authordiabloza
permlinkre-someguy123-steemfeed-js-a-nodejs-price-feed-for-witneses-20170901t141000518z
categorywitness-category
json_metadata{"tags":["witness-category"],"app":"steemit/0.1"}
created2017-09-01 14:10:03
last_update2017-09-01 14:10:03
depth1
children1
last_payout2017-09-08 14:10:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length128
author_reputation1,529,627,825
root_title"Steemfeed-JS - A NodeJS price feed for witneses"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id13,555,710
net_rshares0
@jublo ·
It is the active private key  from the permissions page
properties (22)
authorjublo
permlinkre-diabloza-re-someguy123-steemfeed-js-a-nodejs-price-feed-for-witneses-20170911t085547401z
categorywitness-category
json_metadata{"tags":["witness-category"],"app":"steemit/0.1"}
created2017-09-11 08:55:48
last_update2017-09-11 08:55:48
depth2
children0
last_payout2017-09-18 08:55:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length55
author_reputation179,662,301
root_title"Steemfeed-JS - A NodeJS price feed for witneses"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id14,535,840
net_rshares0
@drakos · (edited)
Just an observation. The following command runs the process in the foreground:
```docker run -it --rm --name feed steemfeed-js```
It should be like this, if you want to run it detached in the background:
```docker run -itd --rm --name feed steemfeed-js```
👍  ,
properties (23)
authordrakos
permlinkre-someguy123-steemfeed-js-a-nodejs-price-feed-for-witneses-20170704t045645194z
categorywitness-category
json_metadata{"tags":["witness-category"],"app":"steemit/0.1"}
created2017-07-04 04:57:15
last_update2017-07-04 05:30:39
depth1
children1
last_payout2017-07-11 04:57:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length255
author_reputation112,280,226,665,329
root_title"Steemfeed-JS - A NodeJS price feed for witneses"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id7,231,552
net_rshares0
author_curate_reward""
vote details (2)
@quochuy ·
ahhh thanks for this! Just what I needed :-)
properties (22)
authorquochuy
permlinkre-drakos-re-someguy123-steemfeed-js-a-nodejs-price-feed-for-witneses-20180311t033931812z
categorywitness-category
json_metadata{"tags":["witness-category"],"app":"steemit/0.1"}
created2018-03-11 03:39:24
last_update2018-03-11 03:39:24
depth2
children0
last_payout2018-03-18 03:39:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length44
author_reputation758,372,221,814,367
root_title"Steemfeed-JS - A NodeJS price feed for witneses"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id43,630,969
net_rshares0
@furion · (edited)
$0.03
I have fixed the feed publishing, and tested against the latest development version of piston.

Will be releasing it in a new module in [steemtools](https://steemit.com/steemtools/@furion/ann-steemtools-a-high-level-python-library-for-steem) next week. For anyone interested, the updated method looks a bit something like this:

```
    def witness_publish_feed(self, steem_usd_price, witness_name, wif, sim_mode=True):
        op = Feed_publish(
            **{"publisher": witness_name,
               "exchange_rate": {
                   "base": "%s SBD" % steem_usd_price,
                   "quote": "1.000 STEEM"
               }}
        )
        tx = self.steem.constructTx(op, wif)
        if sim_mode:
            return tx
        return self.steem.broadcast(tx)
```

I have some other witness related goodies in works as well...
👍  , , , ,
properties (23)
authorfurion
permlinkre-someguy123-steemfeed-js-a-nodejs-price-feed-for-witneses-20160916t215436225z
categorywitness-category
json_metadata{"tags":["witness-category"],"links":["https://steemit.com/steemtools/@furion/ann-steemtools-a-high-level-python-library-for-steem"]}
created2016-09-16 21:54:36
last_update2016-09-16 21:56:54
depth1
children0
last_payout2016-10-17 23:20:15
cashout_time1969-12-31 23:59:59
total_payout_value0.030 HBD
curator_payout_value0.002 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length842
author_reputation116,503,940,714,958
root_title"Steemfeed-JS - A NodeJS price feed for witneses"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,270,712
net_rshares131,951,745,939
author_curate_reward""
vote details (5)
@jesta · (edited)
$1.62
I love the effort, but I think something got lost in the principals of how this should work, and the approach used here is fundamentally flawed. 

If you look at all of the other example scripts out there, they all attach to multiple external data sources and make their own judgement of price. When once fails, it's fine because there are still multiple data sources. 

This script is reliant on the value.steem.network API for pricing information exclusively, which to be honest, shouldn't be trusted as the sole source of this information. Each witnesses price updates shouldn't be derived exactly from the same source. This creates a single point of failure for failure or abuse. 

I'm sorry, I don't mean to rain on your parade, but no one should use this.
👍  , , , , , , ,
properties (23)
authorjesta
permlinkre-someguy123-steemfeed-js-a-nodejs-price-feed-for-witneses-20160916t222142047z
categorywitness-category
json_metadata{"tags":["witness-category"]}
created2016-09-16 22:21:42
last_update2016-09-16 22:24:18
depth1
children2
last_payout2016-10-17 23:20:15
cashout_time1969-12-31 23:59:59
total_payout_value1.240 HBD
curator_payout_value0.377 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length761
author_reputation140,605,453,893,072
root_title"Steemfeed-JS - A NodeJS price feed for witneses"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,270,904
net_rshares3,578,127,553,217
author_curate_reward""
vote details (8)
@someguy123 ·
Thanks for the information Jesta.

It uses value.steem.network, just because I wanted an MVP out to temporarily replace the python feed as fast as possible. Steem Value uses Poloniex+BTC-e to determine the price, and has an API I could plug into very quickly.

One of the reasons I'm able to personally trust this, is because the network doesn't exactly use a single witness as a source. One witness reporting $5 instead of $0.50 shouldn't shake the internal market. 

This isn't to say it's perfectly fine for this to be a permanent solution, I will add more exchanges later on. But the network itself is capable of filtering out bad price feeds, because some witnesses update their feeds by hand, some witnesses use their own scripts, and others use a variety of the third party scripts available, like yours, @steempty's or @clayop's original.
properties (22)
authorsomeguy123
permlinkre-jesta-re-someguy123-steemfeed-js-a-nodejs-price-feed-for-witneses-20160916t225031447z
categorywitness-category
json_metadata{"tags":["witness-category"],"users":["steempty","clayop"]}
created2016-09-16 22:50:33
last_update2016-09-16 22:50:33
depth2
children1
last_payout2016-10-17 23:20:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length846
author_reputation103,945,664,283,580
root_title"Steemfeed-JS - A NodeJS price feed for witneses"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,271,153
net_rshares0
@clayop ·
$0.10
Every witness should have a control for its price feed, so the calculation should be transparent and easily modified  by witnesses for their preferences. Relying on a single server lacks this aspect. It's fundamentally no difference with parsing price data from the coinmarketcap IMHO.
👍  
properties (23)
authorclayop
permlinkre-someguy123-re-jesta-re-someguy123-steemfeed-js-a-nodejs-price-feed-for-witneses-20160916t225529926z
categorywitness-category
json_metadata{"tags":["witness-category"]}
created2016-09-16 22:55:30
last_update2016-09-16 22:55:30
depth3
children0
last_payout2016-10-17 23:20:15
cashout_time1969-12-31 23:59:59
total_payout_value0.096 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length285
author_reputation270,845,899,918,618
root_title"Steemfeed-JS - A NodeJS price feed for witneses"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,271,184
net_rshares362,650,129,514
author_curate_reward""
vote details (1)