2017 © Pedro Peláez
 

project mobius-dapp-quickstart

Ready-to-run example Mobius DApp

image

zulucrypto/mobius-dapp-quickstart

Ready-to-run example Mobius DApp

  • Wednesday, November 15, 2017
  • by zulucrypto
  • Repository
  • 0 Watchers
  • 0 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Mobius DApp Quickstart

A ready-to-run Mobius DApp that can be hooked up to the app store. Just bring your Mobius developer account!, (*1)

This example lets users flip a coin. If they win, they keep their MOBI. If they lose, it goes to the application. This probably won't catch on as a popular application, so it's up to you to write a better one!, (*2)

Requirements

  • PHP with SQLite installed
  • Mobius Developer account (sign up here!)

Features

  • Working DApp right out of the box
  • Includes webhook handler that automatically creates users and syncs their balances
  • Helpful commands for testing

Setup

Install with composer:, (*3)

composer create-project zulucrypto/mobius-dapp-quickstart

Enter your API key and App UID when prompted., (*4)

Start a web server:, (*5)

cd mobius-dapp-quickstart
bin/console server:run

Go to the URL given in the output from the previous command., (*6)

For example: http://localhost:8000/, (*7)

Then, enter the email address you used when signing up for the DApp store. After clicking "Simulate Login" you'll see your credit balance., (*8)

Development

App Store Service, (*9)

The DApp store API is available as a service:, (*10)

// In a controller
$numCredits = $this->getContainer()
    ->get('mobius.app_store')
    ->getBalance('user@example.com');

Helpful Commands, (*11)

To check a user's balance:, (*12)

$ bin/console mobius:app-store:balance
User   : user@example.com
Balance: 100.0

To test the webhook that gets called when a user makes a deposit:, (*13)

$ bin/console mobius:simulator:app-store-deposit user@example.com 100
Simulated webhook: user@example.com now has 100 credits.

Example Code, (*14)

See src/AppBundle/Controller/CoinFlipController.php for the code that implements this DApp, (*15)

The Versions