FOAM + Streamr for pollution monitoring (a project I have been working on)


#1

Hi FOAM community!

I just wanted to introduce myself and show you something I have been building, involving FOAM.

A brief introduction… I am a developer and part of Streamr’s community (www.streamr.com). To me, FOAM and Streamr have always seemed like a great match; FOAM provides a link between geographical locations and smart contracts and Streamr can provide real-time data streams for these locations.

In the future, Streamr’s data network will be fully decentralised, so it will be possible to have data streams coming over a decentralised network (via Streamr) for locations that have been verified in a decentralised manner (via FOAM) - seems pretty cool to me / and maybe an important part of an open, fair and decentralised smart city solution!

So here’s what I have been building… pollution.network. It’s a very early stage proof of concept (that domain is pointing to my github repo so it’s currently unstable/evolving). The idea combines both FOAM’s CSCs and Streamr’s real-time data network. It uses the context of pollution monitoring, which is an area of interest for Streamr.

Following the structure outlined in FOAM’s parking DAO example, a registry contract, running on ropsten, is used to register new pollution sensors. Sensors, instances of a LocationStream contract, have a CSC providing the link between their address and the geographical location and also reference a stream ID relevant in the Streamr ecosystem (this structure might change in future as I further develop the project).

The website picks up registration events to populate markers on a map:

On clicking one of these markers, some more details about the sensor are displayed, and the user can click on ‘Get Stream’. When clicking ‘Get Stream’, the stream ID retrieved from the smart contract for that location is used to retrieve the appropriate stream from Streamr (via a javascript library) and data points are displayed on the chart. Some historical points are reloaded. New points appear as they are generated by the sensors; in most locations, it’s approximately one per hour.

The below shows an example of a streams data points being retrieved/displayed:

The data is being received from a feed covering 60+ countries and 10,000+ sensors (although I’ve only added a few countries to the demo - currently the UK and Switzerland).

I plan to continue developing this proof of concept as FOAM and Streamr grow and add more features of both projects become available. I’m hoping the work prompts further collaboration between the FOAM and Streamr project and their respective communities, when possible.

I’m very happy to take suggestions, feedback and comments. It’s the first iteration, so I’m sure there are many improvements I could make - I’m going to improve the usability next, and want to make it more like http://manpopex.us/ eventually.

Thanks!


User Experience
#2

This is amazing. Nice work @Ross :raised_hands:

Please keep on posting here with any developments/updates!

And let the community know if there’s anything you would like to collab on.


#3

This is really exciting to see, thanks for sharing!

Is this running on a test net of some sort? Are the contracts on chain?


#4

Thanks @Bryan

Please keep on posting here with any developments/updates!

Sure, I’ll add news on updates/progress here.

And let the community know if there’s anything you would like to collab on.

Ok sounds good. I will have a think about what could be possible / I will also talk to the Streamr team about it to see if there are any ideas they have.


#5

Hey @Jimmy_maps. I have currently deployed contracts on ropsten. As it progresses, I will move over to using main net contracts.


#6

Im very impressed. We need more people like you.


#7

Thank you for bringing this up. This looks like a good synergy. I haven’t done a complete deep dive though, does Streamr allow reasonable microtransactions, or are you essentialy subscribing to a block of time for the data?

The interaction with FOAM I think would be best served by reasonable microtransactions for the visitors to a node, and if the data could be redistributed, than perhaps node operators would want to subscribe to a continuous feed of data, though that would depend on how the data can be reused for the node clients.


#8

I haven’t done a complete deep dive though, does Streamr allow reasonable microtransactions, or are you essentialy subscribing to a block of time for the data?

Hi @yinzeus, good question.

Subscriptions to streams are currently done on blocks of time, rather than per data point. I think time blocks are chosen, as per data point might incentivise data producers to add unneeded points to streams, to increase payments to them.

Although not currently available, it is likely in future the minimum time block subscription will be near one second. Then, if you only wanted one data point you could only subscribe for 1 second or less (assuming that is the frequency of data points generated).

As with most crypto projects, it’s all very much a work in progress, I’m sure if there was demand for a certain feature, the Streamr team would be happy to listen and undertake the work required.


#9

Great work @Ross. Please keep us updated on the development.


#10

Really great work, thanks for sharing. Please keep us updated on your progress or anything in particular you need help with.

FOAM + Streamr for data monitoring work really great together, especially for geocoding and visualizing. Applications with a Map interface can be stand alone, but the FOAM Map can also support additional layers.

Data monitoring and sensing is poised to be one of the largest areas of growth in IoT. It is important to remember that the value of the data being monitored is tied to the ability to verify data provenance. Proof of Location is infrastructure that can certify devices monitoring environmental data.


#11

Thanks @ryan_foam.

Applications with a Map interface can be stand alone, but the FOAM Map can also support additional layers.

That’s interesting to know. It’s true, I feel that standalone maps have their own value but that value increases rapidly the more they are integrated together (i.e. as layers on the FOAM map).

It is important to remember that the value of the data being monitored is tied to the ability to verify data provenance.

I completely agree with this too. The value of data streams (within streamr and elsewhere) depends on the provable validity of the data, and FOAM is one way to do that.

I was talking to one of the Streamr team about FOAM and Streamr and they shared the enthusiasm for how they seem like the perfect match. Do you or another member in the team have an email that they could contact regarding investigating a pilot project? They are interested in talking about a larger idea that they’ve been thinking about for a while, but still related to this proof of concept/environmental data.


#12

That would be great. You can give them ryan@foam.space would be happy to further discuss.


#13

Hey @Ross, this looks awesome. Is there anyway I can connect with you about how to build a similar map? Would love to chat via email or Telegram. Thanks!