How do programmers access blockchain decentralized application development? The original article has been updated, please go to the original article to read

Some time ago, an Ethereum game application: Fomo3D was extremely popular, attracting tens of thousands of Ethereum coins into the game in just a few days. In the first round of the game, a “hacker” made a very clever use of ethereum rules and became the final winner, taking away more than 10,000 Ethereum prize money.

The value of blockchain applications is fully reflected in this game, Fomo3D games success depends on ethereum to provide a trusted, immutable platform. When the rules of the game are set, everything goes according to the rules and nobody intervenes. Today’s article is about how programmers can get into decentralized application development.

Centralized application

For comparison, let’s take a look at a centralized application, which is essentially an existing Internet application. Why is it a centralized application? Look at its architecture:

Usually, what we contact is the front end of the application (or client), which can be THE HTML5 Web page, small program or APP. The content displayed in the front end usually sends a request to the server, and the server returns the corresponding content to the front end. Actions on the front end also translate requests to the server, which then returns data to the front end. This means that everything we see or do is controlled by a centralized server, hence a centralized application.

Decentralized application DAPP

What’s different about decentralized apps? Take a look at its architecture:

Any node
trading
Request broadcast to the entire network

Getting data state (such as the result of a transaction) from a node is typically done through event callbacks.

How to develop

The two most important parts of developing a centralised application are client-side UI representations, which are connected via HTTP requests to back-end services that run on the server, such as Nginx, Apached and so on.

The most important part of developing a decentralized application is the client UI performance and the smart contract. The smart contract acts like a back-end service program. The smart contract runs on the EVM of the node, and the client calls the smart contract by issuing RPC requests to the node.

Here’s a comparison:

Client UI <=> Client UI HTTP <=> RPC back end server <=> Smart contract Nginx/Apache <=> nodeCopy the code

So for a decentralized application, programmers can approach it in two ways:

One is the application of decentralized client development, familiar with already familiar with the software (such as Web \ APP) development of the students, only need to know about the client with block chain node communication API interface, if it is the most widely used in the current block chain platform application development decentralized etheric fang, so need to know about Web3 this library, Web3 encapsulates jSON-RPC interfaces exposed by nodes. For example, Web3 provides functions such as obtaining node status, obtaining account information, calling contracts, and monitoring contract events.

At present, the mainstream language has Web3 implementation, listing some implementation for your reference:

  • JavaScript Web3.js
  • Python Web3.py
  • Haskell hs-web3
  • Java web3j
  • Scala web3j-scala
  • Purescript purescript-web3
  • PHP web3.php
  • PHP ethereum-php

Another entry point is the development of smart contracts. The recommended language for ethereum is Solidity. For those of you who are a little bit fearful of learning a new language, the syntax of Solidity is simple and for those of you who have a basic knowledge of one or two other languages (development experience) you can learn it in just three or five days. In-depth Solidity of Ethereum’s smart contract language.

Using a Hello contract, see the Solidity syntax:

contract Hello {
      function hello() public returns(string) {
           return "Hello World"; }}Copy the code

If you change the contract keyword above to class, it is the same as defining a class in any other language.

If you are interested, you can further study this DApp development case, Web3 and smart contract interaction.

In the development process of DAPP, some development tools can help us get more results with less effort, such as Truffle development framework and Ganache tool to simulate nodes. This article will teach you step by step to develop and deploy your first decentralized application

supplement

For students who want to get involved in decentralized application development, understanding the operation principle of blockchain will definitely be a plus, especially the understanding of various consensus mechanisms (POW, POS, DPOS, etc.), P2P network, as well as the application of various encryption and Hash algorithms. Some students want to do the underlying development of blockchain, and the principle of blockchain operation is a must.

Welcome to the knowledge planet, where more than 300 blockchain technology enthusiasts have gathered. Blockchain in Simple terms – systematic learning of blockchain to create the best blockchain technology blog.