Skip to content

Latest commit

 

History

History
260 lines (171 loc) · 12.4 KB

dapps.asciidoc

File metadata and controls

260 lines (171 loc) · 12.4 KB

Decentralized Applications (DApps)

The peer-to-peer movement has enabled millions of Internet users to connect together. USENET, a distributed messaging system that is described as the first peer-to-peer architecture was established in 1979 as the successor of the first 'Internet', ARPANET. ARPANET was a client-server network where participants ran nodes requesting and serving content but as it lacked the ability to provide any means for context beyond simple address-based routing, USENET emerged promising to enforce a decentralized model of control which was a client-server model from the user or client perspective that offered a self-organizing approach to newsgroup servers. However, news servers communicate with one another as peers to propagate USENET news articles over the entire group of network servers (like SMTP email in which the core e-mail-relaying network of mail transfer agents has a peer-to-peer character, and not like the periphery of e-mail clients and their direct connections which is strictly a client-server relationship).

In 1999 the famous music and file-sharing application called Napster arose. Napster was the beginning of the peer-to-peer networks movement evolving into BitTorrent where participating users established a virtual network, entirely independent from the physical network and without having to obey any administrative authorities or restrictions.

As peer-to-Peer mechanisms can be used to access any kind of distributed resources, they play a central role in decentralized applications.

What is a DApp?

Unlike a traditional application, a Decentralized Application (DApp) does not belong only to one single provider or server, but the whole stack would be deployed and operated in a distributed fashion on a peer-to-peer network.

A typical DApp stack would consist of Front-end, Back-end and Data Storage. There are many advantages to creating a DApp that a typical centralized architecture could not provide:

1) Resiliency: Having the business-logic written on a smart contract means that a DApp backend will be fully distributed and managed on the Blockchain. Unlike deploying an application on a centralized server, a DApp will have no downtime and will continue to persist as long as the Blockchain is still operating.

2) Transparency: The open source nature of a DApp allows anyone to fork the code and have the same application running on the Blockchain. On the same note, any interaction with the Blockchain will be stored forever and anyone with a copy of the Blockchain can gain access to it. It’s worth noting that it may not be possible to de-compile the bytecodes into the source and fully understand the contract’s code. Developers who seek to offer full transparency about the contract behavior must publish the source code for users to read, compile and verify.

3) Censorship Resistance: As long as a user has access to an Ethereum node, the user will always be able to interact with a DApp without interference from a centralized control. No service provider, or even the owner of the smart contract, could alter the code once it is deployed on the network.

Components of a DApp

Blockchain (Smart Contracts)

The smart contract is used to store the business logic, the state and the computation of your decentralized application; think of a smart contract as a server-side component in a regular application.

One advantage of deploying server-side logic on Ethereum smart contracts is that you could build a more complex architecture in which a smart contract could read and write data off one another. After deploying your smart contract, your business logic could well be used by many other developers in the future, without ever requiring you to manage and maintain the code.

One major problem of running smart contract as core business logic functionality is the inability to change the code once it is deployed. Furthermore, a really large monolithic smart contract may cost a lot of gas to deploy and function. Therefore some applications may choose to have off chain computation and external data source. Keep in mind, however that having core business logic of the DApp be dependent on external data or server would mean your users will have to trust these externalities.

Front end (Web User Interface (UI))

Unlike the business logic of the DApp that requires a developer to understand EVM and new languages such as Solidity, the client side interface of a DApp uses basic web front end technologies (HTML, CSS, JavaScript). This allows a traditional web developer to utilize the tools, libraries and frameworks they are familiar with using on a regular basis. Interactions with the DApp such as signing messages, sending transactions and key management are often conducted through the browser itself using tools such as Mist browser or the Metamask browser extension.

Although it is possible to create a mobile DApp as well, currently there are no best practices to create mobile DApp front-ends due to the lack of mobile clients that can serve as a light client with key management functionality.

Data storage

Due to high gas costs, smart contracts are currently not suited to store large amounts of data. Hence, most DApps will utilize decentralized storages such as IPFS or Swarm for storing and distributing large static assets such as images, videos, and client side application (HTML, CSS, JavaScript).

The hashes of the content are often stored as bytes within the smart contract, using key value mapping. The asset would then be retrieved through your front end applications calling on the smart contract for urls of each asset.

On chain vs. off chain
IPFS
Swarm

Swarm developer’s onboarding guide; https://github.com/ethersphere/swarm/wiki/swarm

Similarities/differences between Ethereum’s Swarm and IPFS; https://github.com/ethersphere/go-ethereum/wiki/IPFS-&-SWARM

Centralized db

Centralized databases is data storage on a server characterized and associate by its description. They use client-server network architecture, this allows clients or users to modify the data that is stored on the centralized server. Control of the database remains with a designated administrator, which authenticates the credentials of the client before providing access to the database. If the security of the administrator is compromised, the data can be altered or even deleted as the administrator is the only one responsible for the administration of the database.

Oracle

DApp frameworks

There are many different Development frameworks and libraries written in many languages which allows for a better developer experience in creating and deploying a DApp.

Truffle

Truffle is a popular choice and provides a manageable development environment, testing framework and asset pipeline for Ethereum.

With Truffle, you get:

  • Built-in smart contract compilation, linking, deployment and binary management.

  • Automated contract testing with Mocha and Chai.

  • Configurable build pipeline with support for custom build processes.

  • Scriptable deployment & migrations framework.

  • Network management for deploying to many public & private networks.

  • Interactive console for direct contract communication.

  • Instant rebuilding of assets during development.

  • External script runner that executes scripts within a Truffle environment.

Getting started & documentation; http://truffleframework.com/docs

Embark

The Embark Framework focuses on serverless Decentralized Applications using Ethereum, IPFS and other platforms. Embark currently integrates with EVM blockchains (Ethereum), Decentralized Storages (IPFS), and Decentralized communication platforms (Whisper and Orbit).

With Embark you can:

  • Blockchain (Ethereum)

    • Automatically deploy contracts and make them available in your JS code. Embark watches for changes, and if you update a contract, Embark will automatically redeploy the contracts (if needed) and the DApp.

    • Contracts are available in JS with Promises.

    • Do Test Driven Development with Contracts using Javascript.

    • Keep track of deployed contracts; deploy only when truly needed.

    • Manage different chains (e.g testnet, private net, livenet)

    • Easily manage complex systems of interdependent contracts.

  • Decentralized storage (IPFS)

    • Easily store & retrieve data on the DApp through EmbarkJS, including uploading and retrieving files.

    • Deploy the full application to IPFS or Swarm.

  • Decentralized Communication (Whisper, Orbit)

    • Easily send/receive messages through channels in P2P through Whisper or Orbit.

  • Web Technologies

    • Integrate with any web technology including React, Foundation, etc.

    • Use any build pipeline or tool you wish, including grunt, gulp and webpack.

Getting started & documentation; https://embark.readthedocs.io

Emerald

Emerald Platform is a framework and set of tools to simplify development of a Dapps and integration of existing services with Ethereum based blockchain.

Emerald provides:

  • Javascript library and React components to build a Dapp

  • SVG icons common for blockchain projects

  • Rust library to manage private keys, including hardware wallets, and sign transactions

  • Ready to use components/services that can be integrated into existing app thought command line or JSON RPC API

  • Accompanied with SputnikVM, a standalone EVM implementation that can be used for development and testing

It’s platform agnostic and provides tools for various targets:

  • Desktop app bundled with Electron

  • Mobile apps

  • Web apps

  • Command line apps and scripting tools

Getting started & documentation; https://docs.etcdevteam.com

[[dapp_develotment_tool_sec] ==== DApp (development tool) DApp is a simple command line tool for smart contract development. It supports these common use cases:

  • Package management

  • Source code building

  • Unit testing

  • Simple contract deployments

Getting started & documentation; https://dapp.readthedocs.io/en/latest/

Populous

Live DApps

Here are listed different live DApps on the Ethereum network:

EthPM

A project aimed at bringing package management to the Ethereum ecosystem.

Website link; https://www.ethpm.com/

Radar Relay

DEX (Decentralized Exchange) focused on trading ethereum-tokens directly from wallet to wallet.

Website link; https://radarrelay.com/

CryptoKitties

A game deployed on Ethereum that allows players to purchase, collect, breed and sell various types of virtual cats It represents one of the earliest attempts to deploy blockchain technology for recreational and leisurely purposes.

Ethlance

Ethlance is a platform for connecting freelancers and developers, both paying and receiving ether.

Website link; https://ethlance.com/

Decentraland

Decentraland is a virtual reality platform powered by the Ethereum blockchain. Users can create, experience, and monetize content and applications.