Dapp with Firebase

こんにちは私はグウェン([https://twitter.com/gwenskiesHere](https://twitter.com/gwenskiesHere))です。今日我々はERC223とfirebaseにvueと統合する予定です。

##Firebaseとは
![firebase.png](https://qiita-image-store.s3.amazonaws.com/0/300937/879f6726-1e58-1900-19fa-a98886fd4b2d.png)

**Firebase** is a Backend-as-a-Service(BaaS) not just for web but for mobile development also. Firebase serves as a server, API and datastore, where it is written generically so you can modify it depends on your needs. 
###Firebaseでやるべきこと
####Realtime Database
Connecting your app or dapp in firebase is not connecting through a normal HTTP but by WebSocket. Your data syncs automatically on a single socket as fast as your clients network can carry.

####File Storage
Firebase Storage provides a simple way to save binary files to Google Cloud Storage directly from the client.

Firebase Storage has it’s own system of security rules to protect your GCloud bucket from the masses, while granting detailed write privileges to your authenticated clients.

####Authentication
Firebase auth has a built in email/password authentication system. It also supports OAuth2 for Google, Facebook, Twitter and GitHub. Firebase’s OAuth2 system is well-documented and mostly copy/paste. 

Firebase Auth integrates directly into Firebase Database, so you can use it to control access to your data.

####Hosting
Firebase includes an easy-to-use hosting service for all of your static files. It serves them from a global CDN with HTTP/2.

Firebaseはたくさん特徴があります。その他の機能は次のとおりです。
- Remote Config
- Crashlytics
- Notifications
- Dynamic Links
- Test Lab
- AdMob

[Firebase](https://firebase.google.com/docs/)の詳細についてはリンクをクリックしてください。

##Firebaseインテグレーションのサンプルdapp
このdappはFirebaseのAuthentication特徴を使いました。サインアップしてサインインするとき、データはfirebaseに保存されます。
![signup.PNG](https://qiita-image-store.s3.amazonaws.com/0/300937/5374058f-0ac2-6b14-9a61-30d1d59eaa60.png)
This is the sign-up screen. The data created in this screen was being stored in Firebase.
![firebase-console.PNG](https://qiita-image-store.s3.amazonaws.com/0/300937/d6453a9d-c26c-0b1c-2de1-81f9177e5809.png)
This is the FIrebase console, where you can manage the data. For this dapp, since I only use Authentication I can only manage the data in Authentication page.

![signin.PNG](https://qiita-image-store.s3.amazonaws.com/0/300937/1a29c6d9-c4c6-13a1-decc-bdac00d97be7.png)
Once you sign-in the data was being checked in the Firebase.

##Firebaseを統合する方法
私はdappを作りました。dappのコードは[Github](https://github.com/gwendanielle/vue-firebase-web3)でチェックしてください。
このdappにFirebaseを統合する方法を学べました。ERC223を使って、[ERC223](https://qiita.com/gwenmerida/items/9b440d61264d118dae66)についてとERC223のimplementationのコードはリンクをクリックしてください。

##Firebaseを使用するDapp
####Ginco
![ginco.png](https://qiita-image-store.s3.amazonaws.com/0/300937/4765d64d-e32f-e3e4-d7ff-720e85beb312.png)
**Ginco**, Inc. is a Tokyo based cryptocurrency startup. The next generation crypto wallet, which allows you to easily save, send, and exchange your assets.
Ginco is supporting Bitcoin, Ethereum, BitcoinCash, XRP, Litecoin, and major ERC20 tokens.
Ginco uses Cloud Firestore as a database for user data and Cloud Function as serverless application backend.

[Ginco](https://speakerdeck.com/tomokazukozuma/backend-of-cryptocurrency-wallet-and-ginco-integrated-with-dex-kybernetwork?slide=12)のバックエンドについてリンクをクリックしてください。

##まとめ
Firebase is can be use in a lot of things, like as a database, authentication, hosting, file storage and many more. It can be use not only thru web but also mobile applications. 


##Sources:
https://howtofirebase.com/what-is-firebase-fcb8614ba442