写在前面
It's in the front.
本篇文章将带领你从零学会一个Dapp开发,笔者从最初的不了解区块链概念到如今精通Dapp、智能合约开发,中间踩过无数的坑,经历过无数困难!
This article will lead you from a Dapp to xff0c; from an initial lack of understanding of the block chain concept to a current mastery of Dapp, smart contract development xff0c; numerous pits xff0c in the middle; numerous difficulties xff01;
去中心化应用(decentralized application),或简称DApp,通常与区块链平台例如以太坊相联系,是一个在分布式点对点网络上运行的应用程序,而不是在一台中央计算机上。这样做的主要好处是,网络的用户不依赖于中央计算机来发送和接收信息。
Decentralizing applications xff08; decentralized application) xff0c; or Dapp, usually linked to block chain platforms such as the Tailing Room xff0c; an application running on a distributed point-to-point network xff0c; rather than on a central computer. The main benefits of doing so are xff0c; network users do not rely on a central computer to send and receive information.
为了充分理解去中心化应用程序与中心化应用程序之间的区别,我们可以看一下中心化应用程序的一些例子,如Facebook、微博和YouTube。这些都是中心化式应用程序的示例,因为为了使用它们,用户依赖于由中央实体拥有和操作的服务器和网络。这与去中心化应用相反,在去中心化应用中,用户不依赖于中央实体来发送和接收信息。
In order to fully understand the difference between decentralized applications and centralized applications xff0c; we can look at some examples of centralized applications xff0c; e.g. Facebook, Weibo and YouTube. These are examples of centralized applications xff0c; because users rely on servers and networks owned and operated by central entities for their use. This is contrary to decentralized applications xff0c; in decentralized applications xff0c; users do not rely on central entities to send and receive information.
即使DApp不一定需要区块链,大多数DApps都利用区块链技术的强大功能,例如智能合同。智能合同是旨在执行协议条款的自动执行合同。例如,如果您想购买房子,此过程将涉及多个第三方,如房地产代理和律师,他们将为您解决购买问题。然而,在使用智能合同的情况下,这一过程只需要买方和卖方参与。一旦满足所有条件,智能合同将独立于任何第三方执行。
Even if DApp does not necessarily need a block chain & #xff0c; most DApps use the powerful function of block chain technology & #xff0c; e.g. smart contracts are automatic execution contracts designed to enforce the terms of the agreement. For example, xff0c; if you want to buy a house xff0c; this process will involve multiple third parties xff0c; e.g. real estate agent and lawyer xff0c; they will solve the purchase problems for you. xff0c; xff0c in the case of smart contracts; this process only requires the involvement of buyers and sellers.
DApps依赖智能合同来访问区块链并运行,这与中心化应用程序依赖中心化服务器运行的方式非常相似。如果你不完全确定什么是区块链,那么看看后面的解释。
Dapps relies on smart contracts to access block chains and run xff0c; this is very similar to the way a centralised application relies on a centralised server. If you are not entirely sure what a block chain is xff0c; then look at the explanation that follows.
以下是应用程序在真正被视为去中心化之前的一些常见要求:
The following are some of the common requirements of applications before they are really considered to be decentralised:
- 应用程序必须是开源的
- 应用程序的数据必须存储在去中心化的区块链上
- 应用程序必须使用加密令牌也叫通证(例如比特币,以太币)或应用程序固有的令牌
- 应用程序必须通过密码算法生成令牌,例如工作量证明
去中心化应用对比中心化应用区别:
(a) The difference between the application of decentralised application comparison and the application of #xff1a;
项目 | 中心化应用 | 去中心化应用 |
代码开源 | 闭源 | 完全开源 |
数据存放 | 中心化存储 | 存放在智能合约,公平公开化 |
公平性 | 不透明化,暗箱操作 | 公平公正 |
运行效率 | 取决于服务器配置,效率较高 | 运行效率取决于公链节点,不可控 |
手续费 | 用户无需手续费,体验好 | 需要手续费,手续费多少取决于代码量 |
1. 需要知道自己用什么公链?
Need to know what public chain you use #xff1f;
这一步需要准备:
This step requires preparation #xff1a;
公链的节点rpc接口(公用节点或者自建节点)
Node rpc interface & #xff08; public node or self-building node & #xff09;
公链钱包
Public chain wallet.
公链gas对应的代币
The public chain gas corresponds to the token.
2. 需要学习熟悉公链接口访问形式
2. Need to learn to be familiar with the form of access to the public link
例如,使用js Java 等语言时候需要学习对应的工具包(web3.js web3j)
e.g. xff0c; toolkit for learning when using js Java and other languages xff08; web3.js web3j)
3. 需要准备好dapp浏览器,或者钱包插件
3. Need to prepare dapp browser & #xff0c; or wallet plugins
这个可以使用开源APP或者开源钱包插件安装在浏览器
This can be installed in a browser using an open source APP or an open source wallet plugin.
1. 第一步开发智能合约
1. First step in the development of smart contracts
一般选择以太坊合约、bsc合约、tron合约 建议采用solidity语言?
Do you have any idea what it would be like to use the Taiyo contract, the bsc contract, the tron contract, to recommend the use of the language of solidity?
2. 第二步部署智能合约
2. Step 2 deployment of smart contracts
可以先在测试网部署智能合约,需要到测试网对应的水龙头申请测试币
The smart contract can be deployed first on the test network xff0c; test currency will be applied for for taps to match the test network
部署一般使用remix工具部署
Deployment of generic remix deployment
3. 第三步开发dapp前端
3. Step 3 development dapp frontend
一般采用vue框架开发前端。前端涉及钱包连接,合约调用,数据查询,一般dapp需要有后端支撑
A vue frame development frontend is generally used. The front end involves wallet connections & #xff0c; contract calls & #xff0c; data queries & #xff0c; general dapp needs backend support
4. 第四步后端开发
4. Development of the fourth step back end
一般dapp需要后端作为辅助,为了提高用户体验。也可以不开发后端,纯前端与合约交互
Usually dapp requires backends as support & #xff0c; to improve user experience. You can also not develop backends & #xff0c; pure front ends interact with contracts
1. web3(web3j web3.js等)
1. web3 (web3j web3.js, etc.)
2. vue 前端框架
2. vue frontend framework
3. metamask插件
3. Metamask Plugin
本人已开放区块链专栏,欢迎大家订阅,有任何问题欢迎咨询!
区块链零基础到实战教程-专栏https://blog.csdn.net/qq_28505809/category_10635007.html
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论