Beginner’s Guide to DApp Development

0

Ethereum has played an important role in driving wider adoption of the blockchain technology, with their Ethereum Virtual Machine (EVM) and smart contracts.  It’s a platform that allows developers to create and launch distributed apps (DApps), and the developers have responded with building over 1,500 DApps so far! Are you a developer interested in building DApps? This DApp development guide at a high-level can help you get started.

DApps development isn’t a simple plug-n-play project, and it requires serious programming. This DApp development guide doesn’t intend to cover details of it, rather it provides a high-level overview of the steps. It also provides a ‘resources’ section in the later part of the article, indicating where you can learn more about a particular step.

DApp development: the steps one needs to undertake

Here’s a high-level overview of what a developer needs to do, step-by-step, to create and launch an Ethereum DApp:

Blockchain Certification Course

1. Learn Ethereum:

A DApp needs to follow a specific conceptual framework and the only way to understand that is to learn Ethereum.

For e.g., a DApp must be open-source and it must operate autonomously without any entity controlling majority of the crypto tokens. Changes to a DApp must follow a consensus in the community. The backend code must comprise smart contracts and must run on a decentralized blockchain. The DApp must use a crypto token generated using a standard cryptographic algorithm, and the data must be stored in a blockchain while following cryptographic standards.

Learning decentralized consensus-based Ethereum blockchain platform is the first non-negotiable step for the developer to undertake.

2. Get your blockchain:

While there are many clients the developer can choose from, we recommend ‘testrpc’ for a new DApp developer. This tool is now part of Truffle suite of tools, it’s easy to use, and easy to start using a command line interface (CLI).

The tool doesn’t mine blocks by default, but for the development purpose, block interval can be specified using the CLI.

3. Communicate with the blockchain:

The easiest and most common tool to communicate with the blockchain is ‘web3.js’. Installing it is easy, and there are specific instructions to configure the necessary parameters, for e.g.:

  • Configuring the acongig.js file;
  • Configuring the web3 API functions, for communicating with the blockchain.

4. Learn Solidity:

Solidity is the proprietary language of Ethereum to write smart contracts. It’s a feature-rich language specifically designed for this purpose, and this high-level programming language was inspired by C++, Java, Python, and JavaScript. A DApp can have its frontend code in any language, but the backend code must comprise smart contracts, hence this learning is also non-negotiable for a new DApp developer.

5. Code smart contracts:

A developer coding smart contracts must follow the following broad guidelines for effectiveness:

Blockchain Certification Course
  • Keep the computing logic and storage requirements minimal, because executing smart contracts require ‘gas’, i.e. a measure of computing power. It isn’t free, ‘gas price’, i.e. a certain number of crypto tokens must be paid. That means Ether (ETH), i.e. native cryptocurrency of Ethereum needs to be spent on executing a smart contract. Simple computing logic requires less gas.
  • The code must avoid complexity, because the more complex the code is, the higher is the likelihood of errors. The outcome of a smart contract is irreversible, hence coding simple error-free smart contracts is imperative.

6. Deploy the smart contracts:

The tool suite recommended for this is ‘Truffle’. It has the following advantages:

  • A directory allows the developer to maintain all her smart contracts;
  • The tool can easily blend into the testing framework because the scripts can deploy the contracts in the test environment, run the ‘truffle test’, and run regular tests.
  • Deployment using this tool suite is easy, and the required parameters can be easily set in the config.js file. Testrpc must be running in a separate window the deployment to work.

7. Invoke the smart contract:

Calls to the smart contracts must be in hexadecimal strings, however, there are Ethereum contract ‘application binary interface’ (ABI) libraries to help with that.

8. Set up an Ethereum account:

To execute the smart contracts the developer needs to spend Ether, and she needs to create Ethereum account for that. The ‘eth-lightwallet’ is recommended because generating public and private key pair and managing it are easy with this. The developer needs to update the config.js file with the key details. The developer can go back to the truffle test and see Ether moving between accounts.

Improtant Remark: The developer must not share her private key with anyone, or publicize it in any online forum.

9. Transact with the smart contract:

After buying some Ether and storing it in her account, the developer needs to take the last step in the DApp development, which is to transact using the Ether. There are 3 options:

  1. Transfer to another address as a value;
  2. Call a contract function which will update the state of the network, and spend the Ether to pay the fees to the miner;
  3. Involve a contract that updates the state of the network and accepts Ether as payment. The developer also needs to pay the fees to the miner.

10. DApp development: useful resources

For an overview of the DApp development steps, the developer can read this comprehensive Hackernoon article. Following are the resources for the individual steps:

  1. To learn Ethereum: Ethereum development tutorial, Ethereum whitepaper, and Ethereum yellow paper.
  2. GitHub material for Testrpc.
  3. GitHub material for web3.js.
  4. Online course for Solidity.
  5. GitHub material for Truffle tool suite.
  6. GitHub material for ABI library.
  7. GitHub material for eth-lightwallet.

Additionally, ‘dappsforbeginners’ is a good website for a new developer to get guidance. In case you are not sureyet,  here is 5 reasons why you should learn blockchain development.  Still Looking for some inspiration here is top 10 dapps to follow in 2018.

Whould love your hear your experience of your first dapp development experience in the comment section below.


About Author

Anujit has been a developer, project manager and consultant in the IT industry for over 2 decades. He keenly watches how new technologies put the power in the hands of the people and democratizes the society. Outside of his working hours, Anujit plays, sings, draws, writes, and reads.

Leave A Reply