Ethereum has played an important role in driving wider adoption of 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 by 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.
Enroll Now: Ethereum Development Fundamentals Course
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:
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 the 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:
5. Code smart contracts:
A developer coding smart contracts must follow the following broad guidelines for effectiveness:
- 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.
Also Read: How Does Decentralized Finance Work?
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:
- Transfer to another address as a value;
- Call a contract function which will update the state of the network, and spend the Ether to pay the fees to the miner;
- 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:
- To learn Ethereum: Ethereum development tutorial, Ethereum whitepaper, and Ethereum yellow paper.
- GitHub material for Testrpc.
- GitHub material for web3.js.
- Online course for Solidity.
- GitHub material for Truffle tool suite.
- GitHub material for ABI library.
- GitHub material for eth-lightwallet.
Want to know the real difference between Decentralized and Centralized Finance? Check out our detailed comparison guide on Decentralized Vs. Centralized now!
Additionally, ‘dapps for beginners’ is a good website for a new developer to get guidance. In case you are not sureyet, here are 5 reasons why you should learn blockchain development. Still Looking for some inspiration here is top 10 dapps to follow in 2018.
Would love to hear your experience of your first dapp development. Share your experience in the comment section below.