Firebase Docs

SIMBA Chat

Note

You may need to use the blaze plan on firebase for this application to work

Using SIMBA Chain


Here is a playlist on the SIMBA Chain Youtube channel to get you up to speed on using the dashboard.

Smart Contract

pragma solidity ^0.4.24;

 

contract Application {

      function Application() public {} enum Assets {

           chatRoom, message

 

} Assets _message = Assets.chatRoom; Assets _createRoom = Assets.chatRoom; Assets _sendMessage = Assets.message;

function message (
      string assetId) /* parameter needed for linking assets and transactions */

 

public {}

 
function createRoom (
        string assetId, /* parameter needed for linking assets and transactions / string name,                     / optional parameter / string createdBy) / optional parameter */

 

public {}

function sendMessage (
        string assetId, /* parameter needed for linking assets and transactions / string message,                / optional parameter / string sentBy, / optional parameter / string chatRoom, / optional               parameter / string _bundleHash) / optional parameter */

 

public {}

}

Creating an app on the SIMBA Dashboard

Before starting make sure you have an account on the Simba Dashboard and an Ethereum wallet with Ether in it on the Circle of life network

  • Create The Smart Contract
  • Create The Application
  • Configure The Application(Ethereum Blockchain, Circle of Life, IPFS Filesystem, Permission disabled)
  • Generate API Key(This is not the API name)

_images/APIKey.png

Converting the SimbaChat example to your app

  • Setting the Env Variables
    • To set the signing key: firebase functions:config:set signing.key=“[YOUR PRIVATE KEY WITHOUT THE 0x]”
    • To set the API key: firebase functions:config:set simba.key=“[YOUR API KEY]”
  • Setting the Webhooks
    • Go to app.simbachain.com
    • Go to Notifcation then Register Notification
    • Select your application from the drop-down menu
    • Select WEBHOOK as type.
    • Paste the webhook URL from Firebase Console -> Functions -> Dashboard
    • Create the webhook
  • Setting the public address
    • At line 41: const from = “[YOUR PUBLIC ETHEREUM KEY]”;
  • Changing the URL
    • At line 44: const baseUrl = “[YOUR URL TO SIMBACHAIN API(example:https://api.simbachain.com/v1/simbaChatz)]”;
  • Deploying the application

Github Repo https://github.com/SIMBAChain/SimbaChat 

SimbaChat https://chat.simbachain.com

 


© Copyright 2019 Revision 9d5c08cd.

Built with Sphinx using a theme provided by Read the Docs.