PetFriendResolver, making a PoC of Snowflake Resolver - Part I

I’m a follower of Hydrogen Platform from the beginning, and I was there in the one&only airdrop made to developers. Since then, I want to contribute with the Hydro community. This Poc is about making a Snowflake Resolver, the different steps you must do in the process, and all the problems and odds you can experiment on the way.

First, you must know what Snowflake is: one of the projects made around Hydrogen platform, based on Hydro token. Please, read the next document to have more information about it.

Snowflake is focused on user identification, privacy, and verification. Actually the project is developing a dashboard where everybody can deploy their own resolvers, as Dapps, that make use of the snowflake contract.

What are the benefits of using this DApps? I recommend you to google and read the docs about snowflake, and I’ll try explain in a few lines:

  • Any crypto user can have a lot of crypto wallets, making the use of them very confusing, dealing with diferent adresses, etc.
  • Driving with the different private keys of every wallet, the thing is going worse. It becomes a security problem dealing with all your accounts an private keys.
  • What about to have an unique account that can include all of your crypto wallets, with an easy to remember ID? No need to remember addresses (do not try!), only your ID. That’s we call Snowflake ID.
  • With Snowflake, you can create an unique ID, with the identification you want (not previously created by other). Then you can attach one or more ethereum addresses to this ID. After that, you can use your unique ID in lot of use cases, including: transferring funds to other snowflakes, pay for services, subscribe to content providers, etc.

In these articles, I’m going to explain the process followed to make a Snowflake Resolver: a Dapp built to be used with snowflake IDs, and aims to give an example (that we can call PoC or Proof of Concept) of What You can do, and What use cases can make use of this functionality.

Introducing PetFriendResolver

As a pet owner, I have my two cats correctly identified with a microchip. Pet owners must have their pets identified, because it simplifies the process of finding the pet owner in case of loss of the pet, or any incidence related to the pet.

There are many of internet web pages where you can register and report when your pet is lost, and let the community to help you finding it.

This PoC try to make a pet owner’s community, when you can register all your pets, including information to identify them, like the microchip ID, a photo, and description data.

Let’s talk about the requisites! Starting with an ER diagram (as a good programmer):

REQ 1: Other users can contact an owner, but be careful what contact info you publish, this is public data! Give a public email, Telegram or Facebook id can be correct.

REQ 2: an owner can have one or more pets. Pet owners can see and edit the information of their pets.

REQ 3: an owner can report the loss of an owned pet. In the report, is important to give information about the scene and location where you last see your pet. You can put a reward for helping you to find your pet. This reward is only symbolic and try to help the community collaboration. In addition, the reward acts as a good use case to see pay transaction between diferent Snowflake accounts.

REQ4: anyone registered can see a list of lost pets at the moment. The app shows the photo of the lost pet, description, lost scene and location, and offered reward. Also you can see the microchip ID, proof of identity of the pet. If you found a pet and it matches any of lost pets, you can Claim the found of the pet. Then you can contact pet owner.

REQ5: pet owner must confirm the found of the pet, closing the report and making the payment of the reward to the claimer. This is a transaction between owner’s snowflake and claimer’s snowflake.

REQ6: pet owner can cancel a previous lost report before it is claimed (for example, the owner found its pet by himself); this remove the report from list of lost pets.

And that’s all!

This DApp acts as a registry of pets (for a closed community, like a small town or a neighborhood). When a pet owner get registered in the App, he belongs to a pet friend community, when he can help others to find lost pets (getting a little reward in the process), and can be helped to find his own pets in case of lost. Isn’t it marvelous? Don’t worry boy, this is only a PoC!

Introducing developing ecosystem

Let’s talk about the developing ecosystem; I’m using these tools:

  • Remix — Solidity IDE, for writing and deploy contract to ethereum network. Go to page.
  • Node.js + snowflake dashboard fork to start development.
  • Front end: React.js, web3j, javascript skills.
  • Ethereum contract: solidity skills, and knowledge of snowflake contract and dapps.
My metamask plugin showing connected network (Rinkeby) and current active account (Account 1 starting with 0x422ee…)
  • Metamask plugin for chrome: this is an interface from browser to ethereum blockchain, allowing the creation and administration of several ethereum accounts.

First, you must fork and deploy a local snowflake dashboard (can be found here). This process was very hard at the beginning, because building and running a local environment with node.js and the compiled dashboard was not easy at all. Following deploy instructions, I found problems compiling project dependencies, and at last, I had to install python binaries, and Visual Studio Community Edition 2015 only to compile dependencies (C classes!) needed to deploy. Finally I made “npm install” run correctly to compile and deploy the dashboard; I hope you don’t have same problems deploying your local dashboard.

Here you can see my running dashboard:

It runs in the url localhost:3000/dapp-store after the execution of “npm start” in the folder where the dashboard app is deployed (and compiled).

In the screen capture you can see my snowflake Id (jzafra2), my hydro balance (19990) and the available Dapps, as a list of resolvers. Every resolver has an image, the big “S” is the Status resolver, example of Dapp in the dashboard, made by Hydro team as an example. You can see the source code on Github.

Next resolvers have an animal image, they are my petFriend resolvers that I’m developing.

Here you see my first prototype results:

This is the registered pet (at the moment only one, but developing for N pets)

And this is the list of lost pets (of any pet owner). I’m working with two snowflake Ids (jzafra2, jzafra3), to see the results. As you can see, the lost pet is from another snowflake Id, jzafra3.

Interactions are made with Dialogs (a basic React,js component); for example, this dialog is for editing pet details:

In next articles, i will explain the process of developing the resolver, dot a dot:

  • Making the resolver contract and deploying to Rinkeby network
  • Make dapp interface with React.js
  • Development cycle of improving interface, improving contract, testing functionality, once and another…Until app is done!

I had to deal with React.js and javascript to make frontend; and with solidity at backend. I didnt’ work with react.js nor solidity before (but I’m an experienced programmer in Java and C#), and I had to learn basic skills to made all this stuff. If this is your case, I hope you can learn of my experience.

Thanks to @NoahHydro and all the team of hydro at discord in, who are helping me to do this, at last It will be done, I hope!

Thanks for read! Please, go to part 2 of this article here:

Profesional developer, very interested in blockchain and crypto world.