New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Getting Started Developing with the FOAM Map API by Ryan John King of FOAM

ETHGlobalFri, Oct 9, 2020, 12:00 AM

Ryan John King, Co-Founder and CEO of FOAM, delivers a talk at ETHBoston about developing with the FOAM Map API. ETHBoston was an ethereum-focused hackathon that took place Sep. 6-8, 2019 at the Northwest Building, Harvard Campus. ETHBoston was a hackathon organized by ETHGlobal and a team of hackers, developers and enthusiasts interested in building and creating in the ethereum ecosystem. The ethereum focused hackathon took place for 3 days at the Northwest Building, Harvard Campus in Cambridge, MA. For more information visit eth.boston and ethglobal.co

Transcript

thank you really appreciated I'm here today presented on foam foam provides tools to enable a crowdsource map and these centralized location services the project really has kind of three elements one focus is on location encoding standards just bringing these kind of standards into the blockchain world as there aren't any kind of geospatial inspector to begin with now the next element is what we call a spatial index visual hazard so this is that how do you actually visualize on chain data in a spatial way and the third element is what we call proof of location that's where the foam token comes into play and it's about how to be come to consensus and verify these things that are making the official claims on ting so today we have our first product that's live it's called the foam app it's a token created registry for curating points of interest data it's been alive on the media area for about one year and really kind of the goals of this protocol is that anyone can add places to the phone map and then anyone can also curate that map so basically look at that data challenge it and be incentivized to kind of keep up all that information up to date and so we're trying to basically make this on chain registry of accurate geospatial data that then other applications can cook in and utilize them useful and that's kind of what I want to be focusing on this talk is how to use the foam API and examples of other applications that people have built the first briefly I'll explain how the actual protocol works and kind of just to take this step back I want to focus on maybe some of the reasons why this is even important because today geolocation is not actually a solved problem there's tons of open source mappers contributing to OpenStreetMap but there's no incentive for them to actually go check that data or return years or months later to see if it's still accurate and so we have centralized companies that take up that role like map box or Facebook that take also vintage map data and try to that package itself back but even that isn't sufficient so we've seen recently a kind of nasty hack where New York was renamed to anti-semitic name a few chocolates and this appeared on like The Weather Channel snapped map shoot easy and even the foam based map for like over 48 hours so that was pretty embarrassing and there's all these different kind of hacks and issues with geospatial data today so we're trying to basically experiment with new means of curation and incentives for participating so really what is this phone app is taking the kind of geospatial encoding standards we developed and combining it with a primitive called a token curated registry and out of that we get this a map of point injuries and the token security registry is a way to kind of generate a list and curate that based on token mechanize mechanics so this is kind of like a metric to see but an infographic of how the mechanism of the foam TCR works and essentially if you want to add a location to the mountain you have to make a deposit in foam tokens so this is kind of an anti-spam mechanism that you essentially believe in the information you're providing to the map but it also serves as a latent bounty for people who want to come check out that point in the future and potentially challenge at our curated so if you're not a pure lie and everybody's happy eventually your point within show up on the map and be considered accurate and verified but if somebody's not happy they can initiate that challenge against you and essentially state against your point and open up the kind of voting period and that would allow anyone to most folk tokens to kind of weigh in and decide should this point stay or should it remain today we have over 10,000 points that have been added to the map and about six percent have been challenged and removed there's some edge cases of may be malicious challenges but for the most part the points that have been challenged and removed from actually been inaccurate so every kind of scheme the system like working today this is an example of up the phone map interface looks like and how you would essentially interact with it on the left you can see where you're going to be filling out information about the point and when you're kind of confirming we need to confirm in amounts this is another example of just the you Mayan puppet looks and here we see this is here in Boston so basically all these green dots that you see your verified points of interest on the phone map that's old city call and so this is a maintenance you can check out and see all the kind of features that works but for the purpose of this talk in workshop I want to kind of like look under the hood and explain how the actual application works and how you can use the API to build your own applications so the visualizer of the phone map is essentially to this architecture we call the spatial index visualizer and this is a way to kind of visualize on tune data in a spatial way for any kind of use case or application so it's not specific to phone and this is kind of the architecture of the phone map to how it works today so it's this end-to-end kind of circular system where we have this front end where we use tools like deck GL from goober for visualization and it's kind of a readout front-end app we use a language called cure script which is a functional programming language that compiles to JavaScript for the front end and from the front end of the Macra able to interact the event amader and equip three calls and then we kind of have a back-end API restful api i've written in haskell running in companies and this essentially indexes all the han-shan data into kind of bigquery databases and geospatial databases and then we have a restful api that essentially sends normal with WebSocket events back to the front-end so for people who want to essentially take the phone map data that's been indexed by our API they can just use like normal web events and have to be fed back to the front end so the architecture of the phone map and the spatial index kind of works in this loop we're from the front end you can interact with web 3 and the back end done kind of indexes that inserts with back to the front end and the result is what you get at this so this is a foam map today that uses that kind of architecture where it's kind of a normal web app to some extent in the way that the data is coming into the app it has that free functionality and so that's the architecture we use for an hour now but anybody can essentially replicate this architecture and utilize it for visualizing geospatial contracts and it doesn't have to be related to the phone TCR you can use this kind of architecture in just as a web data architecture to index data and be able to feed it back to the printer so specifically with how we built our phone map we like I said use a language called pure script which compiles the JavaScript for the front end and we are at phone the authors of the pure script web tree library which we actively maintain and it's open source another tool we use when using the foam app is called clickbait this is a simple docker tool to spin up a test blockchain where you can up reallocate libraries and balances and really get started testing really quickly and we've also utilized something called chantrelle this is written in pure script and it's an alternative to truffle as a way to deploy your contracts and so at foam we kind of have our own aetherium stack that we built ourselves that is foam agnostic so anyone can use it for any period of development and that's kind of game contrast to the traditional theory of stock which is very JavaScript heavy so at foam we are functional programmers and I really rely on my Costello and Pierre script so instead of test RPC we're using this clickbait tool instead of live 3gs we use pure script Winfrey and instead of truffle vu central so all these are actively maintained in open source libraries that you can utilize for any task deployment not specific to phone just to kind of highlight how our app was actually built and with the stack is underneath so you don't need to use any of those tools to still use the phone eight guy you might have a sheet that was in passed around which is that kind of a quick intro of how to use the foam API the URL there will bring you to the foam developer portal and this is where you can essentially get started 35 use the API and seeing different documentation so the easiest way to access our API is that you can use swagger generated Docs on this developer portal and you can simply explore the API by pulling the endpoints in the browser we also post automatically generated client libraries that you can import into your own application so how does I explained with TC are the primary thing being developed are these points of interests that market interesting places like attractions or restaurants and within each of that point when we actually want to look at like what the metadata entails this includes name address description geohash which is a way to hash that long and what addresses the owner and how much state is actually put into that thing this is an example from our developer portal of kind of the swagger documentation and so in browser you can call all these functions and essentially get all the most recent data right there so this is kind of taken from the sheet that if s wrong but it's just a kind of simple example of the kind of data you're gonna get from doing these API calls and kind of the key fields that you may want to look at for different applications is when this point created is it in a certain kind of geofence area and who's the owner and what kind of other points have they done or what kind of other activity that they pursued so also on our developer portal we have recently launched like seven I guess examples the ways to use the API and basically this allows you to take the phone data that already exists on chain from our API and let's put it in a whole different styles so you're not kind of confined to using math about foam dot space with this API you can take the phone data and basically make your own kinds of maps your own visualizations your own tools for whatever you want so some of the examples we have there is this map visualizes the density of points in an area by using an uber tool called deck GL not box and so this shows where points are but on the phone Mount Lapointe Chester ecstatic this is a bar graph representing the amount of tokens people have staked in those points so this is an example of a visualization you can do baseball for a TI where you have this kind of 3d model and you get a sense of like where are really high these state points another interesting example on this page is about bottom flight paths so that you can kind of look up one individual user and get kind of a sense of all the places that they've mapped so you can kind of track the history of America I prefer this specifically is tracking a user who participated in a scatter derivative as a kind of external incentive with the project called LOC Cities region win an NF t by solving clues in mapping areas and we did some post analysis with our API tools kind of seeing where different users map and how they played the game so that's essentially just an overview of what is the phone protocol what is our API and the stack underneath it and a few examples on our developer portal I know we're hitting close to the timeline that I have so I just want to basically go over a few example applications from the recent hackathons to essentially give some ideas about people have built so this is the project that recently won a prize at the two pieces were found both enosis team and it's called map covering and this is essentially an application that will allow you to restore your gnosis safe wallet if you forgot your private key by utilizing the phone protocol and so what it does is that you can pre-commit five points of interests that are secret to you to a contract and then essentially if you lost your private key you would be able to reveal this information by re selecting these points off the map and then you can unlock your key so they built like a pretty advanced application in a two days where they use the phone API to basically pull all the phone points and have a mobile application and when you want to set up this recovery function you basically go around the map and select five points that are secret key and they could be anywhere around the world so you can take the Taj Mahal Washington Monument JFK your mom's house and your elementary school and keep that don't tell anyone those five points and if you lost your password they made this interface where you can go back select all those points and then you basically can unlock your vault and so this is a really amazing example to me because this is an application that then has to for more points so how can you make this more secure to make sure no one could guess your five points we only have 10,000 points today so it might be easy for some intergroup force guessing thoughtful so this is an application that could potentially drive the demand for more points of interest because this is an application that would require on change especially this is a quick example of the phone winner at the East New York hackathon it was called French toasts key so what they did was they allowed you to essentially assign a crypto key D a crypto spatial coordinate which is the foam geo encoding standard and rendered it on the their version of the foam map the use of the foam API to basically render all these points of interest and interestingly in this project they had a chain link integration where crypto key will ask and work on what is the weather outside and then essentially tell you what the weather it is and filtered the points on the map based on the weather so this kind of your cat essentially recommends what points of interest we should go to you based off the weather unchanged so that was a really cool integration they'll be really excited to see and just some other things that people have been building based off of our api's and tools are kind of full-fledged foam specific block explorers we have a platform called foam tools this allows me to claim three box identities so for opti and social reputation that we have a leaderboard as well as kind of advanced tools for the curator class to kind of go in and look the challenges are going on the points of interest see user history really specifically and really get a more advanced experience if you're an active curator on the phone map that you can use this platform and that was kind of one of the first projects really built also Park API and it's quite advanced so you can see that so thank you everyone I'm happy to take the last five minutes out to answer any questions yeah um is it possible to kind of share a location with someone in a secret way you mean if like a park location any location yeah it's possible so this is an overview of what's live today I'm foam which is the foam map the feature of the project we're working on base the real-time location we've got proof of location side of the system of videos and I think and you'd be able to generate a proof of where you are and we're investigating other kinds of cryptography so you could reveal that to a friend and still keep it private or if you want to unlock a Pokemon you could reveal that proof to that app using so that the future thing can't do it now well right now the what's live is the token created registry you could potentially act yeah yeah I know that our team is not the biggest an acidity but when we launched this a year ago it was like the most production really smart contract language of the time [Music] yeah so um that's like an interesting question so I talked with them about this and they like well historically the data is available because it's been published in teen so as long as you come in the next thing service that allows you to like kind of recover past states of home then you're okay for example if like the point gets so essentially when points get removed they're not removed from the blockchain they're removed from their status of being on the registry so even on the math application we have like it's hard to find but you have a filter layer that's like called like click graveyard and then you see like every point that has been removed from the registry but technically it's still on chain and you can still render it on the map but it's state is labeled I guess then you have to track or keep in mind it's fine yeah where you can look like right down the listing house or save it somewhere and then you'll be able to find it but there's something a great framework for year 2000 we had very short term states about some signal nation say okay you see that being a possibility yeah that's definitely what we're working on for this link more dynamic for some locations so they kind of refer to this as static just the things on the map you can participate from York option add things in India but as we kind of move towards this like fault tolerant way to prove location you can have all these really interesting applications like tracking traffic flow and it's like you're managing your fleet you can require week to produce these claims at a certain interval even with the thumb map itself you could say hey you can't vote on a point in Boston unless you can prove you've been there in the last year any other yeah just curious like what drove your sort of thinking around using um a little bit out of my hands my co-founder and CTO Christopher wrote the house Kelley theorem client and 2014 and a lot of our team members worked at block house which is a house built based company and so when they started working here that's a stack they were pretty committed to but then basically why we even made like this chantrelle which just cuz our developer Martin so upset with help out fustrated you both using truffle and you just made it because he was too upset and that's kind of the same thing with this demo we just did it in New York that uses the radios and this tender monopolization we wrote it and go our developers are just so mad about working on it so instead we just gotta grab to reread it now but that kind of comes a lil he's like static type security guarantees and basically we're able to really aerate on the application without breaking it and with a job of things might be easy to make I'm day long but a year later kind of started to fall apart so we're able to like really seamlessly executes updates we haven't had any down timer issues somewhere and so for the fun location work thinking is once we have that SDK an environment we're comfortable in making like iterate faster and yes as the owner you don't like to lose you still own your tokens if the point still there so you're able to like manually remove it and pay the gas but that's like one of the top reasons people challenge points for like nitpicking yeah and they're like oh this is lower case it's really then open to like how the users use it and we've had a lot of interesting edge cases of like people even like lying like challenging like hey I live in Boston this dumpy Donuts across the street with all three and then like

Automatic transcript — names and jargon may be misspelled.