Dapp On Ethereum Public Blockchain

BeovolyticsAdmin
beovolytics

--

Decentralized applications (dApps) are applications that run on a P2P network of computers rather than a single computer. dApps, have existed since the advent of P2P networks. They are a type of software program designed to exist on the Internet in a way that is not controlled by any single entity.

  • Decentralized applications don’t necessarily need to run on top of a blockchain network. BitTorrent, Popcorn Time, BitMessage, Tor, are all traditional dApps that run on a P2P network, but not on a Blockchain (which is a specific kind of P2P network).
  • As opposed to simple smart contracts, in the classic sense of Bitcoin, that sends money from A to B, dApps have an unlimited number of participants on all sides of the market.

Note: These definitions are not set in stone and there are different views on this subject.

Difference between dApps & Smart Contracts

dApps are a ‘blockchain enabled’ website, where the Smart Contract is what allows it to connect to the blockchain. The easiest way to understand this is to understand how traditional websites operate.

  • The traditional web application uses HTML, CSS and Javascript to render a page. It will also need to grab details from a database utilizing an API. When you go onto Facebook, the page will call an API to grab your personal data and display them on the page. Traditional websites: Front End → API → Database
  • dApps are similar to a conventional web application. The front end uses the exact same technology to render the page. The one critical difference is that instead of an API connecting to a Database, you have a Smart Contract connecting to a blockchain. dApp enabled website: Front End → Smart Contract → Blockchain

As opposed to traditional, centralized applications, where the backend code is running on centralized servers, dApps have their backend code running on a decentralized P2P network. Decentralized applications consist of the whole package, from backend to frontend. The smart contract is only one part of the dApp:

  • Frontend (what you can see), and
  • Backend (the logic in the background).

dApp development process

  • Whitepaper & Prototype
    A whitepaper is published describing the dApp and its features. This whitepaper can outline the idea for dApp development but also entail a working prototype.
  • Token Sale
    Initial tokens sale is set up
  • ICO — Initial Coin Offering
    The ownership stake of the dApp is spread
  • Implementation & Launch
    Funds are invested into building the dApp and deploying it.

Dependence :
curl https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash
nvm use 8.9.4
npm

truffle — smart contract framework

http://blog.bradlucas.com/posts/2017-07-18-ethereum-installing-geth-on-centos/
sudo yum install golang
$ sudo yum install gmp-devel
$ git clone https://github.com/ethereum/go-ethereum
$ cd go-ethereum/
$ make geth
$ ls -al build/bin/geth
cp build/bin/geth /usr/local/bin/.

npm install -g truffle@4.1.7 — unsafe-perm=true

ganache — local inmemory blockchain for dev
npm install -g ganache-cli

ganache-cli -p 5545

truffle :
truffle compile
truffle migrate
truffle test

geth — rinkeby — rpc — rpcport 9945 — wsport 9946 rpcapi=”db,eth,net,web3,personal”

geth attach ipc:/root/.ethereum/rinkeby/geth.ipc

eth.syncing

geth — rinkeby account new

Rinkeby: Authenticated Faucet
This Ether faucet is running on the Rinkeby network. To prevent malicious actors from exhausting all available funds or…faucet.rinkeby.io

geth attach ipc:/root/.ethereum/rinkeby/geth.ipc
eth.getBalance(eth.accounts[0])

personal.unlockAccount(eth.accounts[0],null,1200)

eth.syncing

beovolytics/Beovo-Dapp
Building our own coin using Ethereum & Soliditiy Framework — beovolytics/Beovo-Dappgithub.com

truffle migrate — reset — compile-all — network rinkeby

var admin=eth.accounts[1]

var tokensAvailable=750000
var tokenSaleAddress= ‘0x7f28c97944e7517b3ba68e01dc1fa715175a1de1’
var tokenAddress=’0xc3c5568f35568e383f93a5e411c8a2bb0bd78885'

var abi=[{“constant”:true,”inputs”:[],”name”:”name”,”outputs”:[{“name”:””,”type”:”string”}],”payable”:false,”stateMutability”:”view”,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”totalSupply”,”outputs”:[{“name”:””,”type”:”uint256"}],”payable”:false,”stateMutability”:”view”,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”decimals”,”outputs”:[{“name”:””,”type”:”uint8"}],”payable”:false,”stateMutability”:”view”,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”standard”,”outputs”:[{“name”:””,”type”:”string”}],”payable”:false,”stateMutability”:”view”,”type”:”function”},{“constant”:true,”inputs”:[{“name”:””,”type”:”address”}],”name”:”balanceOf”,”outputs”:[{“name”:””,”type”:”uint256"}],”payable”:false,”stateMutability”:”view”,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”symbol”,”outputs”:[{“name”:””,”type”:”string”}],”payable”:false,”stateMutability”:”view”,”type”:”function”},{“constant”:true,”inputs”:[{“name”:””,”type”:”address”},{“name”:””,”type”:”address”}],”name”:”allowance”,”outputs”:[{“name”:””,”type”:”uint256"}],”payable”:false,”stateMutability”:”view”,”type”:”function”},{“inputs”:[{“name”:”_initialSupply”,”type”:”uint256"}],”payable”:false,”stateMutability”:”nonpayable”,”type”:”constructor”},{“anonymous”:false,”inputs”:[{“indexed”:true,”name”:”_from”,”type”:”address”},{“indexed”:true,”name”:”_to”,”type”:”address”},{“indexed”:false,”name”:”_value”,”type”:”uint256"}],”name”:”Transfer”,”type”:”event”},{“anonymous”:false,”inputs”:[{“indexed”:true,”name”:”_owner”,”type”:”address”},{“indexed”:true,”name”:”_spender”,”type”:”address”},{“indexed”:false,”name”:”_value”,”type”:”uint256"}],”name”:”Approval”,”type”:”event”},{“constant”:false,”inputs”:[{“name”:”_to”,”type”:”address”},{“name”:”_value”,”type”:”uint256"}],”name”:”transfer”,”outputs”:[{“name”:”success”,”type”:”bool”}],”payable”:false,”stateMutability”:”nonpayable”,”type”:”function”},{“constant”:false,”inputs”:[{“name”:”_spender”,”type”:”address”},{“name”:”_value”,”type”:”uint256"}],”name”:”approve”,”outputs”:[{“name”:”success”,”type”:”bool”}],”payable”:false,”stateMutability”:”nonpayable”,”type”:”function”},{“constant”:false,”inputs”:[{“name”:”_from”,”type”:”address”},{“name”:”_to”,”type”:”address”},{“name”:”_value”,”type”:”uint256"}],”name”:”transferFrom”,”outputs”:[{“name”:”success”,”type”:”bool”}],”payable”:false,”stateMutability”:”nonpayable”,”type”:”function”}]
var TokenContract=web3.eth.contract(abi)

var tokenInstance=TokenContract.at(tokenAddress)
tokenInstance.transfer(tokenSaleAddress,tokensAvailable,{from: admin})

tokenInstance.balanceOf(admin)
tokenInstance.balanceOf(tokenSaleAddress)

tokenInstance.balanceOf(admin)

truffle migrate — reset — compile-all — network rinkeby

Running migration: 1_initial_migration.js
Replacing Migrations…
… 0x7a8e7edff8e92ae6a3cb02a7e9b0d9b101846d28c18b51dc954235b93a56aa1a
Migrations: 0xb7f29de9e1c82cfc8c365cc9024228285a6699cb
Saving successful migration to network…
… 0x35c1d1038d2964d70804e2f32346566f70a9c30e5b49be27dcaffbc455f229ff
Saving artifacts…
Running migration: 2_deploy_contracts.js
Replacing DappToken…
… 0x0511af90d424cfd50d9c962ab627bb9bc0b89bb567f452ef3e7751dd97f4eb03
DappToken: 0x8a1909930bb9f1230a606408f51ce8e8b0b54d3b
Replacing DappTokenSale…
… 0x9d3014b4bae7eecd468ff3d59deee4da6871f71791088d4b43fbb8038975fce8
DappTokenSale: 0xf1df89875ab397e257e0921be2954e958ab7a3d6
Saving successful migration to network…
… 0xadf64e18946a0c0e0e7296b4fad234f001ca9835ce5d9b338d77933e5ee7e1b9

https://rinkeby.etherscan.io

--

--