O'Reilly logo

Blockchain for Enterprise by Narayan Prusty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building the DApp

Let's write the smart contracts for digitalizing fiat currency and storing cell phone numbers linked to bank accounts. Here is the smart contract for digitalizing fiat currency:

pragma solidity ^0.4.18;contract USD {    address centralBank;        mapping (address => uint256) balances;    uint256 totalDestroyed;    uint256 totalIssued;        event usdIssued(uint256 amount, address to);    event usdDestroyed(uint256 amount, address from);    event usdTransferred(uint256 amount, address from, address to,      string description);        function USD() {        centralBank = msg.sender;    }        function issueUSD(uint256 amount, address to) {        if(msg.sender == centralBank) {            balances[to] += amount;             totalIssued += amount;            usdIssued(amount, to);        }    }     function destroyUSD(uint256 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required