enappd loader

How to develop a blockchain application

The blockchain is an ingenious invention promising to make the digital world more secure and decentralized. By allowing digital information to be distributed but not copied, blockchain technology created the backbone of a new type of internet. Originally devised for the digital currency, Bitcoin,  (Buy Bitcoin) the tech community is now finding other potential uses for the technology. In very near future, we are going to see blockchain being used in daily transactions of all kinds, be it a banking transaction, or a purchase made on e-commerce websites or even a tinder swipe. 

Every person in the technology world understands or has at least heard of blockchain. But a minuscule number of developers actually know how to develop a blockchain token or application, or where to start from. Let us take a slightly detailed look at the development process of a blockchain application.

Introduction to Blockchain development

At this point, I am assuming you are aware of blockchain basics i.e. what blockchain is, where it originated and where it can be used. If you want to know basics of blockchain, this blog is a good starting point. 

As every other development process, blockchain application or token development also requires us to delineate the scope and purpose of the application. It can be simply a coin like Bitcoin, a smart contract for real estate or something else. Let us take a look at these steps that are precursor to the actual development

  1. Develop the idea 

    The very first step is to decide - What is it that I want to use Blockchain for? If you want to use the blockchain to store user profiles for a homemade hobby app, you are probably on the wrong path there. Even if you are looking to secure a moderate sized app with blockchain, you need to weight the profit vs cost of blockchain. You need to identify use-cases for your application and ensure if your idea requires blockchain or not. It is important to note that blockchain is a way of encrypting data and validating transactions, and if incorrectly implemented, it does not guarantee an additional security on transactions.

    Once you have concluded that Blockchain is essential to your project, you need to realize that blockchain development is COSTLY. There are several ways a blockchain application can be developed in, which are discussed in the next point, which vary in costs and functionality.

    As a valid example of blockchain usage, if you are a real-estate agent  and looking to build a blockchain-based supply chain application that keeps a ledger of each property you sell, you should understand the multiple use-cases of the application and how it is going to benefit your business and the consumer.

  2. Identify the suitable blockchain platform

    Once you have concluded that your business needs to be blockchain-based, you need to identify the suitable platform or technology to use. There are two basic ways you can go about

    a. Create new blockchain - You can opt to create your own blockchain framework, where everything from the algorithms to the transaction validation, from the tech stack to the token transaction fee is decided by you. This is the most comprehensive way of blockchain development, but also the most costly. You are essentially thinking about creating another Bitcoin, or Ethereum, which, although sounds lucrative, can cost you north of hundreds of thousands of dollars. You would generally opt this option only if you are creating your own crypto-currency

    b. Clone popular blockchain platforms - The other, more efficient, way of developing a blockchain based application is to develop it using a popular blockchain platform. These platforms are open-source, so you can fork their repositories and deploy the code on your own servers. The main question to ask is - why would the world adopt a blockchain created by you. Remember, a blockchain platform is as successful as the number of nodes in the network which can validate the transactions.

    Few popular platforms are Ethereum, Hyperledger Fabric and Hyperledger SawTooth. Each one has certain characteristics which can help you make the decision. You can read more about these platforms here
    Most popular blockchain platform is Ethereum, which can hold your coins as well as tokens (read next point). Few points regarding Ethereum  -

    Ethereum is an open-source and public blockchain-based distributed computing platform, featuring the functionality of smart contracts.

    Ethereum uses a proof-of-work algorithm, called “Ethash” which requires more memory to make it difficult to mine .

    Smart contracts in Ethereum are written in Solidity programming language, which is a subset of Javascript. 

    c. Use tokens on existing blockchain platforms - This is a little different from the previous point. In the last point, we were cloning the whole blockchain platform and deploying it on our own servers, assuming we'll have enough number of network nodes which will validate the transactions by "mining".

    But we can also "just create tokens" and deploy it on an existing running blockchain like Ethereum. These platforms offer ready-to-use APIs, algorithms and mining strategies to easily implement blockchain in your application (Blockchain as a Service ) . You won't need to create a separate waller for your tokens /transactions because Ethereum tokens are accepted by a variety of existing wallets. 

    This is something similar to creating your own e-commerce store on Shopify. Shopify has all e-commerce features ready-to-use on its platform, and users only fill in the required data to create their own store on Shopify. Similarly, you can just code your own tokens in Solidity language, and deploy it on Etherreum (or use different language for different blockchain platform). The existing platform will offer you readymade services which you can use to transact using your tokens. Remember, tokens can be coins, as well as just smart contracts.

  3. Proto development 

    Given that Blockchain development is very costly, it is advisable to first develop a proto application to make sure everything works as intended, before deploying it on a live server or existing blockchain platform like Ethereum.

    During proto development, you should also decide what part of the application will be "on-chain" and what part "off-chain". In simple words, since you are creating a web-app or mobile app that uses blockchain, there can be normal functionalities that can run on general cloud hosting, and do not require a blockchain. Then there will be the transaction part of the application, which you would probably put on blockchain platform.

    You should also decide whether your application (or parts of it) will be built in Permissioned network, or Permissionless network.

    Permissionless networks. Here everyone can join and starts verifying. Most known examples are Bitcoin and Ethereum networks
    Permissioned network. In this case the network owner decides who can join the network and only few members are allowed to verify blocks. The consensus mechanisms can be the same as in permissionless network or can be completely uniquely designed (e.g. authority based).

    Try to keep your on-chain APIs separate from off-chain APIs, because they will be hosted at different places. Decide upon the consensus algorithms and transaction strategy for your application. If you are using an existing blockchain platform, this phase will be easier as lots of things are already efficiently implemented in these platforms.

  4. Technology involved

    - web3.js - Ethereum JavaScript API (Documentation)
    - Dapp browsers - Desktop Mist, Parity and Metamask and mobile ones are Toshi, Cipher and Trust
    - Solidity for smart contracts (Documentation)
    - Open Zepplin - smart contract development (Documentation)
    - Embark - Framework for serverless Decentralized Applications using Ethereum, IPFS and other platforms 
    - Truffle - The most popular Ethereum development and testing framework 

    - Metamask - To run Ethereum dApps right in your browser without running a full Ethereum node (https://metamask.io/)
    - Parity - Most advanced Ethereum deployment client (https://paritytech.io/)
    - Etherscan - Block explorer on Ethereum, for monitoring (https://etherscan.io/

    Other than the above, regular frameworks can be used for app/server development like react.js, nodejs and native technologies for mobile apps.

  5. Development

    This is the core element of blockchain application development. For sake of simplicity, we'll go through the process described in point 2c. above i.e. using tokens on existing blockchain platforms. It is important to understand the transaction mechanism first.

    Token is essentially a long alphanumeric string which acts as a unique identifier for your coin/smart contract. Each user on a blockchain wallet has unique public and private keys (similar to long passwords). These keys are used to identify the users to credit / debit money, or to point the smart contract to. This is very similar, but much more secure, compared to adding a new beneficiary in your bank account using their bank account number etc.

    You can create your own smart contract / token in Solidity language for Ethereum. You should first create a test token and verify your functionality before deploying it on real blockchain. Follow this official guide to create your first Ethereum token and this blog post to understand the nuances of creating your own token. Once you create the contract / token, you put it "on the chain", essentially meaning similar to deploying your code on a server.

    A transaction starts with one user sending out an intention to send out token, which is confirmed by network as valid (if you own the token and haven't sent it to anyone). Then your token information is combined with your private key, which then spits out a digital code, which is then confirmed by the network using the sender's public key. This is possible because a contract signed with private key can be validated with public key, but no correlation between public and private key can be found out, so everything remains secure.

    In summary, the whole process is similar to encryption and decryption. The decentralization of info and the inclusion of block's history into encryption makes it secure and tamper proof.

    In addition, you'll be building APIs for
    - Performing auditing functions.
    - Storing and retrieval of data.
    - Generating pairs of keys and mapping them to the specific addresses.
    - Performing data authentication with the help of hashes and digital signatures.
    - Managing and triggering of smart contracts to run the business capabilities of an application.

    This blog is a first step in building a blockchain application. There are huge complexities involved in making smart contracts "smarter", making sure your coins are un-hackable, or at least extremely difficult to hack into, etc. Following the above steps, you can make a minimum viable product for your application based on blockchain. From there, everything is uphill, pun intended ! 




Abhijeet Rathore

Blockchain developer