web1.0
静态页面,内容只能供用户去阅读,类似于在网络上读报纸或者看书。
Static page xff0c; content can only be read by users xff0c; it is similar to reading newspapers or books online.
web2.0
动态互联网,实现用户之间的互动,比如twitter,facebook,titok等。
Dynamic Internet & #xff0c; achieves interaction between users & #xff0c; e.g. twitter,facebook, titok etc.
web2.0中厂商用免费或极低的成本吸引用户,通过获取到用户的信息来推流广告从而获得利润。
The free or very low commercial cost of the web 2.0 plant attracts users & #xff0c; profites by gaining access to user information to push advertising.
打个比方就是 厂商在一片地上种了很多草,吸引羊来吃,趁着羊吃草的功夫把羊身上的毛薅下来拿去卖钱,而羊自己并不在意这些毛,可以说是一种双向互利的方式。
For example, the manufacturer grows a lot of grass #xff0c on a piece of land; attracts sheep to eat xff0c; xff0c , , , ,
web3.0
web3.0是一个很模糊的概念,随着区块链技术的发展,基于区块链的web3.0诞生。
Web3.0 is a vague concept & #xff0c; as block chain technology develops & #xff0c; web3.0 based on block chain was born.
接着用上面的例子来说,随着web2.0的发展壮大,稀缺的不再是草,而是羊毛,也就是用户身上的数据。那么羊毛的重要性愈加突出,所以提出web3.0的概念,也就是拥有自己的一片空间,别人无论如何都无法修改,也就是将羊毛(数据)存放在了一个非常安全的地方中,相比于web2.0,不但实现了动态的交互,也实现了数据的“拥有”。
Then, in the example above, xff0c; growing xff0c as web 2.0 develops; scarce xff0c; scarce xff0c; scarce xff0c; but wool xff0c; i.e. data on users. Then wool is more important xff0c; so the concept of xff0c is proposed xff0c; xff0c; others are unable to modify xff0c; xff08; data xff09; stored in a very safe place xff0c; compared to web2.0xff0c; not only have dynamic interactions #xff0c; and “possession” of data is also achieved.
web3的概念非常模糊,可以说是一个大方向,按照我个人的理解可以说是在互联网创造了一个虚拟的世界,这个虚拟的世界拥有和现实世界一样的货币交易系统以及其他体系,能够自主维持运转的这样一个“虚拟生态系统”,而这个生态系统的生存法则就是“去中心化”。
The concept of web3 is very vague xff0c; it can be said to be a big direction xff0c; it is my personal understanding that it creates a virtual world on the Internet xff0c; it has the same monetary trading system as the real world xff0c and other systems xff0c; it is an autonomously functioning “virtual ecosystem” xff0c; and the ecosystem's survival method is “decentralization”.
什么是去中心化?
what's decentralizing #xff1f;
比如现在市面上的app都由一个厂家负责,厂商可以随意删除控制用户数据,形成了以厂商为中心的服务体系,去中心化就是没有中心厂商作为核心,而是所有用户形成一个能够自力更生的体系。
For example, applications on the market are now run by a single manufacturer xff0c; manufacturers are free to delete control user data xff0c; there is a manufacturer-centred service system xff0c; decentralization is the absence of a central manufacturer as a core xff0c; and all users form a self-reliant system.
随着web2.0发展,数字货币使用越来越多,而在区块链技术的支持下,数字货币也出现了全新的存在形式,去中心化的密码货币,世界上第一种密码货币就是比特币。像纸币有防伪印一样,密码货币通过密码学的散列计算出的hash值并且和智能合约进行绑定,密码货币基于去中心化的机制,与依赖中心监管体系的银行金融系统相对。之后出现的数种密码货币被创造,它们通常被称为altcoins。
As web 2.0 develops xff0c; digital currency is increasingly used xff0c; supported by block chain technology xff0c; digital currency has also emerged in a completely new form of existence xff0c; decentralized cryptographic currency xff0c; the world’s first cryptographic currency is Bitcoin. xff0c, like banknotes with anti-pseudoprints xff0c; code currency has been calculated and bound to smart contracts xff0c, which is commonly referred to as altcoins.
区块链的防篡改机制
一个区块中储存了三样东西:数据,前一个区块的hash值,自身的hash值(由数据和前一区块的哈希值共同决定),如果要更改某一区块的内容,那么该区块(a区块)的hash值就会改变,下一区块(b区块)储存的a区块的hash值无法对应a区块当前哈希值,那么这两个区块间的链接就会断开。
The tamper-proofing mechanism of the
contains three items xff1a; data xff0c; the hash value of the previous block xff0c; its own hash value xff08; the co-decision xff09; xff0c; if the content of a block is changed xff0c; then the link between the blocks xff08; a block xff09; the hash value xff0c; the next block xff08; b block #ff09; the stored hash value of a block cannot correspond to the current Hash value of a block xff0c; the link between the two blocks is broken.
如果想要篡改某一区块的数据,我们就要将这一区块以及后续所有区块的hash值进行重算,比如一条区块链里面有abcde五个区块,当我们篡改了b区块的数据,那么我们就要带着b区块的新hash值和c区块的数据重新计算出c区块的新hash值,然后再带着c区块的新hash值和d区块的数据重新计算d区块的新hash值,再带着d区块的新hash值和e区块的数据重新计算e区块的hash值……………………其实在重新计算某一区块的hash值的过程也就相当于创造了一个新的区块,因此篡改一个区块以及后续区块所需的时间取决于创造一个区块所需要的时间。
If we want to tamper with the data of a block xff0c; if we want to recalculate the xff0c for this block and for all subsequent blocks xff0c; if we have five blocks xff0c in a block chain; when we have tampered with the data of block b xff0c; if we want to recalculate the new hash value of block c xff0c; then we have to recalculate the new hash value of block d xff0c with the new hash value of block c and the data of block d xff0c; and if we have recalculated the hash value of block e with the new hash value of block d and the data of block e, then the process of recalculating the hash value of a block is tantamount to the creation of a new block xff0c; therefore, the time taken to alter a block and the subsequent block depends on the time needed to create a block.
这个看起来对算力要求似乎非常庞大,但是现代计算机其实是可以做到这一点的,如果我们有一台超大算力的计算机,那么是不是轻松就可以改变区块链的内容了?为了防止这种情况的出现,区块链加入了工作量证明机制(proof of work)简称 pow
This seems to require a very large amount of arithmetic xff0c; but modern computers actually do this xff0c; if we have a superb computer xff0c; if it's easy to change the content of the block chain xff1f; to prevent this from happening xff0c; to add a workload certification mechanism xff08; proof of workxff09; pow
我们用游戏举例说明一下pow,我们刚才说到用超大算力计算机来篡改区块链,这就好比你拿着满级神装在新手村乱杀,区块链是不允许这种情况出现的,因此它会上调怪物属性,也就是会增加创造一个区块所需的难度,使每一新区块被创造时都保持在十分钟左右(当然这个时间是可以更改的),因此即使是一台超高算力的计算机想要篡改一个区块所需的时间仍然是
Let's use the game as an example of the pow & #xff0c; we just talked about using super arithmetic computers to tamper with block chains & #xff0c; it's as if you had a full-fledged god in a new-hand village killing #xff0c; the block chain is not allowed to occur #xff0c; so it changes monster properties xff0c; that is, it increases the difficulty of creating a block #xff0c; keeps every new block created for about ten minutes xff08; of course this time can be changed xff09; #xff0c; so even a super-calc computer will still take the time to tamper with a block.
。
那我们所说的挖矿是什么呢?上面提到的情况是想要篡改区块中的数据,那么我没有恶意,我只是单纯的创造区块去给自己或者他人使用,这个创造区块的过程牺牲了我电脑的算力和一些其他资源,所以作为补偿,创建区块的人会得到密码货币的奖励,这就是我们所说的挖矿。
So what we are talking about is mining xff1f; what is mentioned above is trying to tamper with the data in the blocks xff0c; then I am not mean xff0c; I am simply creating blocks to use xff0c for myself or for others; the process of creating the blocks is at the expense of my computer computing and some other resources xff0c; so as compensation xff0c; those who create the blocks will be rewarded with code currency xff0c; that is what we call mining.
区块链的点对点网络结构
Point-to-point network structure of the
在传统的web服务中,传统的链接对象基本都是客户端和服务端,众多客户端访问一个服务端来进行交互,而在区块链的点对点网络结构(peer to peer)中,不再有客户端与服务端的概念,每一个节点间相互平等,并且包含完整的区块链数据存储,也就是说每一个节点中都储存了整个区块链网络中的所有信息,这样即使一个节点出现故障,其他所有节点也在帮他记录信息,这些记录了所有节点区块链的节点叫做全节点,当然也有只储存了自己信息的轻节点,比如区块链用来储存转账记录,那么每一节点都储存了所有节点之间的转账记录,每一节点储存的内容也是相同的,如果某一节点与其他节点出现差异,那么该节点或许就有被篡改过的可能了,但是被篡改几乎是不可能发生的,原因看下面。
In the traditional web service xff0c; traditional link objects are basically client and service end xff0c; many clients visit a service end for interactive xff0c; while the point-to-point network structure of the block chain xff08;peer to peer) xff0c; there is no longer a client-to-service concept xff0c; each node is equal between nodes xff0c; and there is probably only one small point xff0c in each node to store their own information xff0c; even if one node fails xff0c; all other nodes are helping him to record information xff0c; these nodes of all nodes of the node are called full node xff point; there may be no other nodes x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
点对点网络结构下的所有节点拥有判断区块是否被篡改的能力,当一个新区块想要加入某一节点的区块链时,该节点会向其他所有节点进行广播,所有的节点进行判断,如果50%以上的节点都认为该区块没有被篡改,那么这个区块就可以成功的加入区块链当中,反言之如果想要篡改某一区块的数据,你首先要将这一区块后的所有哈希重新计算,并且还要更改超过百分之五十节点的这一区块后的所有区块的哈希,那么就要拥有超过全网50%以上的算力才可以,这付出的代价是相当高的,这就是区块链网络系统的少数服从多数原则。
The point has the ability to judge whether a block has been tampered with at all nodes under the network structure xff0c; xff0c when a new block wants to join the chain of blocks at a particular node xff0c; xff0c when all nodes are judged at all; xff0c if more than 50% of the nodes believe that the block has not been tampered with xff0c; xff0c if the node is successfully joined to the node xff0c; xff0c if the node wants to alter the data of a node xff0c; xff0c if you want to recalculate all xff0c after this node; and xff0c if this is a minority of the network system that is subject to most principles.
Dapp 是什么?
APP (Application) 指的是手机里的应用程序,像是微信、微博、抖音…等都是日常生活中常会使用到的 App。
APP (Application) refers to applications in mobile phones & #xff0c; e.g., micro-mail, microblogging, shivering... are often used as App in everyday life.
而 Dapp 的全名为去中心化应用程序(Decentralized Application),是建立在区块链系统网络上,所提供的服务都具有公开透明、不可篡改的特性。
【----帮助网安学习,以下所有学习资料免费领!加@v~:yj009991,备注“ csdn ”获取!】
① 网安学习成长路径思维导图
② 60+网安经典常用工具包
③ 100+SRC漏洞分析报告
④ 150+网安攻防实战技术电子书
⑤ 最权威CISSP 认证考试指南+题库
⑥ 超1800页CTF实战技巧手册
⑦ 最新网安大厂面试题合集(含答案)
⑧ APP客户端安全检测指南(安卓+IOS)
On the other hand, the full name of Dapp is decentralised application xff08; Decentralized Application) xff0c; it is based on a network of block chain systems xff0c; the services provided are transparent and non-alterable.
[ - help with web-based learning xff0c]; all learning materials are free of charge xff01; plus 64; vxff1a; yj009991xff0c; note “csdn” to xff01;
1 web-based learning growth path management chart
243; classic tool kit
3,100#43; SRC bug analysis report
4 150#43; web-based electronic version of anti-war technology ; most authoritative version of & CISSP <
#43; #0kStbrff #08/Std 08 Stdf6Std
以下是 Dapp 所具有的要素:
The following are the elements of Dapp & #xff1a;
- 代码开源:程序代码皆公开透明,任何人都可以查阅及审核,避免项目方说到没做到。
- 分布式帐本:降低数据遗失的风险,且没有任何其他第三方有权能够窜改数据。
- 数据所有权:除本人(私钥持有者)外,任何人皆无法动用该帐号的数据。
为什么 Dapp 会崛起?
事实上,App 都是中心化的应用服务,用户所使用的数据都会存储在单一服务器系统里,代表公司能掌控用户的所有数据,但相关问题也随之浮出水面。
In fact, xff0c; App is a centralized application service xff0c; the data used by users are stored in a single server system xff0c; representing the company has control over all of the user's data xff0c; but the related issues also surfaced.
数据所有权归属问题
用户在 App 上的个人资料、搜索浏览纪录等信息都会存储在中心化系统的服务器里,这也意味着软件公司能够借由这些数据来营利。
The user's personal data on App, search browsing records, etc. are stored on a centralised system server xff0c; this also means that software companies can profit from these data.
也导致像是微博、抖音等企业,能透过搜集的用户数据来投放广告,并借此获利。等于企业能用你的信息来赚钱,但你却分不到任何好处,甚至还可能受到影响(例如被疯狂投放广告、或个人资料被平台外泄)。
It also results in companies such as microblogging, tremors, etc. & #xff0c; they can put ads & #xff0c through collected user data; and they can profit from it. It is equal to the fact that companies can use your information to make money & #xff0c; but you do not have any benefit #xff0c; you may even be affected xff08; for example, they are distraught by adverts, or personal information is leaked to the platform #xff09;
另外,传统手游的游戏道具、帐号数据也都属于公司所有,一旦宣布停止营运,这些资产也会随着官方服务器关闭而消失。
Also xff0c; traditional hand-walking games and account numbers are all company-owned xff0c; once declared closed xff0c; these assets also disappear as official servers close.
但在 Dapp 中,你的游戏道具、帐号都会以 NFT 形式储存在链上,因此只要区块链不倒,你就能持续拥有这些资产。换句话说,Dapp 能够让数据的所有权回归到用户身上。额外提醒,虽然你仍拥有这些资产,但可能会因为游戏已经关闭,导致这些资产的现值趋近于零,你能保有的仍以回忆居多。
But in Dapp & #xff0c; your game props, accounts, are stored on the chain & #xff0c; so you can keep these assets as long as the block chain does not fall & #xff0c. In other words & #xff0c; Dapp can return ownership of the data to the user. Additional reminder & #xff0c; although you still have these assets xff0c; it may be that the game has closed xff0c; it brings the present value of these assets closer to zeroxff0c; you can still hold more memories.
过度中心化
App 是由中心化服务器来进行管理,因此企业有时可以专断独行,但用户却没有任何反制的手段:例如可以随意植入广告,或是删除用户的内容、帐号。
App is managed by a centralised server & #xff0c; thus enterprises can sometimes monopolize & #xff0c; but users do not have any countermeasure & #xff1a; for example, they can insert ads & #xff0c; or delete user content, account numbers.
而 Dapp 的数据都存在区块链上,因此项目方没办法任意删除用户资料,目前也没有任何广告植入的问题(但不确定未来是否会有项目开始植入广告)。
The Dapp data, on the block chain & #xff0c; therefore, the project party is unable to delete user data at will & #xff0c; there is currently no problem with advertising & #xff08; however, it is not certain that a project will start implanting & #xff09 in the future.
由于上述几点原因,也让许多人开始对传统的 App 感到不满,于是就有人打算通过区块链“去中心化”的特性来研发能解决上述问题的 App,于是 Dapp 就此诞生。
For a number of reasons, xff0c; it also caused many people to become displeasure with the traditional App xff0c; it was then the intention to develop Appxff0c that would solve the problem through the “decentralization” character of the block chain; and it was the birth of Dapp.
不过同时也要注意,不是每个 Dapp 都一定符合公开、去中心化的规范,例如 Opensea 就能下架用户的 NFT 和限制用户登陆。
However, attention should also be paid to #xff0c; not every Dapp must meet the public, decentralised norms & #xff0c; for example, Opensea can access NFTs from the next user and limit user access.
Dapp 与 App 的差异
App 的应用服务是使用中心化服务器,代表软件公司必须要承担存储用户的数据量的营运成本,否则将无法持续地运行。
The App application service is the use of a centralised server xff0c; on behalf of the software company, it has to bear the operating costs of storing user data volumes xff0c; otherwise, it will not be sustainable.
例如抖音服务器的成本就百万以上,因此必须想办法创造各种营收管道来支持各项支出,像是通过大数据将广告推广到潜在用户面前,借此吸引更多广告商进驻。
For example, a vibrating server costs more than a million xff0c; there is a need to find ways to create revenue lines to support expenditures xff0c; for example, to extend advertising to potential users through big data xff0c; thereby attracting more advertisers.
而 Dapp 是建立在区块链上,用户在链上进行交易、换币等行为时,是需要自行负担手续费(Gas 费)的,也就代表开发商的运营成本会比传统 App 来得更低(不过有些开发商为了吸引用户,会帮用户负担使用时的手续费)。
Dapp, on the other hand, is based on the block chain xff0c; xff0c when users conduct transactions, currency swaps, etc. on the chain; xff08; xff09; ff0c, which requires self-financing; xff08; xff08, which also represents developers with lower operating costs xff08 than traditional Apps; however, there are developers who are interested in attracting users xff0c; and xff09, which will help users to cover their user fees.
Dapp | App | |
---|---|---|
服务器 | 去中心化 | 中心化 |
隐私性 | 有(区块链匿名性) | 无(还可能被外泄) |
营运成本 | 用户共同负担(或开发商负担) | 开发商负担 |
平台获利来源 | 智能合约(链上手续费) | 广告商或用户消费 |
数据所有权 | 用户 | 开发商 |
平台控制权 | 开发商或是 DAO 治理 | 开发商 |
系统 | 区块链 | Android、iOS |
代码是否开源 | 代码皆公开,可供人参考 | 代码为公司机密,擅用者可能会吃上官司 |
智能合约,是一段写在区块链上的代码,一旦某个事件触发合约中的条款,代码即自动执行。也就是说,满足条件就执行,不需要人为操控,类似于传统web的后端代码。
A smart contract & #xff0c; a code written on a block chain & #xff0c; the code is automatically executed once an event triggers a contract & #xff0c. That is, xff0c; the condition is met to execute xff0c; no artificial manipulation is required xff0c; a backend code similar to the traditional web.
我们用Javascript来手写一个建议的区块链出来,其实和写一个链表很像:
We use Javascript to hand-write a proposed block chain out of #xff0c; in fact, a chain table is similar to #xff1a;
接下来我们用代码实现一下简易的POW:
Next, we'll use the code to get a simple Pow:
实现防篡改机制:
Implementation of anti-fouling mechanisms #xff1a;
将完整的POW整合到区块链当中并实现挖矿功能,最终实现的完整区块链:
Integration of the complete Pow into the block chain and realization of the mining function xff0c; eventual completion of the complete block chain xff1a;
首先我们要新建一个Transaction类来进行转账记录:
First, we're going to create a new Transaction class to record transfers & #xff1a;
更改区块中data的含义,此时要记录的是转账信息transaction,并且由于transaction是一个对象,因此在参与计算哈希时要转为字符串(这里将时间改为了Date.now,这样在区块创造时就记录了这笔转账记录的时间):
Change the meaning of data & #xff0c in blocks; at this point it is recorded as transfer information transposition & #xff0c; and since transfer is an object & #xff0c; therefore it is changed to a string & #xff08 when participating in the calculation of Hashi; here the time is changed to date.now #xff0c; thus the time of the transfer record is recorded at the time the block was created xff09; #xff1a;
上面说到奖励货币的发放是通过转账的方式实现的,所以我们在链上实现逻辑:
xff0c; so we're doing logic on the chain xff1a;
之前我们是在外部传入一个区块,在整个货币系统的实现后区块应该是在挖矿时在区块链内部产生的,修改代码:
Previously, we were sending an external block xff0c; once the entire monetary system is realized, the block should be xff0c within the block chain at the time of mining; change code xff1a;
整个写好的数字代币:
#xff1a;
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论