Block Chain : Use case application

In this part we will develop a dapp. In previous posts we already covered all the essentials part to develop the dapp. 
Please visit my previous post and revise your concept
1. Set up ethereum
2 write smart contract
3. set up private block chain network

Use Case

You are on vacation in Europe
Need urgent cash to come back to India ( book flight , purchase etc)
You ask to your friend to send money
Possible option are — Western union ( deposit cash) OR deposit in any bank account ( if not holiday)
It is time consuming and high transfer charges ( Forex , processing)

Solution

Imagine XXX coin as currency acceptable just like Bit coin.
Pay by mobile app
Nominal charges as no intermediary
Instant processing time
Zero down time as millions of nodes working as server

Implementation

A peer to peer based network ( 2 Miners , 4 Nodes )
A smart contract ( XXX coin — Logic to transfer money)
Miner to execute the transactions and making blocks

Architecture

Smart Contract

pragma solidity ^0.4.2;
contract XXXCoin {
// tetsing
uint money;
string minter;
mapping (string => uint) wallet;
mapping (uint => string) users;
event Log(string text);
uint no ;
/* Constructor function to initize the amount in wallet*/
function XXXCoin(){
//TODO
}
/**
Mint function to mint the money to user
TODO — For admin purpose , business logic will be implemented latter
Constructor function to initize the amount in wallet
*/
function mint(string name,uint amount) returns (bool status){
Log(“Minting”);
wallet[name] += amount;
return true;
}
/**
Pay function to pay the user
TODO — business logic as well error handling will be implemneted latter
*/
function pay(string from , string to , uint amount){
Log(“Paying “);
if(wallet[from] >= amount){
wallet[from] -= amount;
wallet[to] += amount;
}
}
function getUserName(uint n) returns(string) {
return users[n];
}
/**
Get user balance function to get the balance of user
TODO — Business logic as per requirement
*/
function getUserbalance(string name ) returns (uint){
return wallet[name];
}
/**
Get no of users
TODO — Business logic as per requirement
*/
function getNoUsers() returns (uint) {
return no;
}
}

Code

Code is available on Github