How to send the bitcoin with Node-RED to make graph

In this example the bitcoin will be sent to the website Xively but it is possible to do the same with another website.

Xively

First of all, create an account. Next, hit on Develop

Then, add a device by clicking on + Add device:

and configure it.

To finish return at the Develop page and recover the Feed ID because it will useful for the next step.

Node-RED flow

Currently, the xively account is created. So it is necessary to have a flow that send data to xively.

Now follow the next step to create the flow.

Inject

Firstly, insert an inject node:

With the configuration bellow:

Http request

Next, take a http request node to fetch the webpage that contains the bitcoin values:

With the following parameters:

Function

After, add a function node:

This node will find and store the current value of the bitcoin.

Now write the code here in the node:

Xively

Finally drop-and-drag a xively node:

Fill in the blanks as shown in the picture:

Link them in the order there were quoted to obtain this:

There is here the code to import into node-red:

[{"id":"1c2f0501.20e483","type":"function","name":"","func":"var obj = JSON.parse(msg.payload);\nvar rates = obj.EUR.exchanges.bitcoin_central.rates; \nvar bid = rates.bid;\n\nmsg.payload = bid;\n\nreturn msg;","outputs":1,"x":513,"y":261,"z":"819e8626.375e3","wires":[["fc124473.e7a9b"]]},{"id":"eee412c3.6ad5d8","type":"inject","name":"","topic":"","payload":"","payloadType":"date","repeat":"20","crontab":"","once":false,"x":132,"y":261,"z":"819e8626.375e3","wires":[["3b77e88f.d3bac"]]},{"id":"3b77e88f.d3bac","type":"http request","name":"","method":"GET","url":"https://api.bitcoinaverage.com/all","x":323,"y":261,"z":"819e8626.375e3","wires":[["1c2f0501.20e483"]]},{"id":"fc124473.e7a9b","type":"xively","name":"","feed_id":"123456789","api_key":"API Key","id_data":"BTC","x":729,"y":261,"z":"819e8626.375e3","wires":[]}]

How to see the graph

To finish, to see the graph:

  • log in

  • hit on Graphs:

Very low value :-(