背景:2008年,国际金融危机下,人们因为金融系统的崩溃,从而失去工作,甚至有人倾家荡产,这时候,有一个网络极客看到这一幕幕人间惨剧,心里暗骂:为什么华尔街这帮家伙造的孽需要全球来买单?我要改变这种情况.
Background: In 2008, in the context of the international financial crisis, when people lost their jobs as a result of the collapse of the financial system and even lost their lives, one of the Internet thugs saw the tragedy of the scene and whispered: Why do these Wall Street guys need a global buyout? I'm going to change it.
于是,这位现代侠客开始了他的计划,他先是在2008年在网络上发布,一场伟大的社会实验就此开始.
So the modern warrior started his plan, first released on the Internet in 2008, and a great social experiment began.
比特币的实质是去中心化的电子记账系统.
The essence of Bitcoin is a centralized electronic accounting system.
通常来讲我们会通过银行进行记账,银行是以国家来为其背书的.所以大家都愿意去相信银行,并且把钱存在里面.
As a rule, we keep accounts through banks, which are endorsed by the State, so we're all willing to trust the bank and keep the money in it.
比特币的设计原理规避了银行这种中心化的架构.
Bitcoin was designed to circumvent the central architecture of banks.
基本原理说明:
Rationale:
比如现在有A\B\C\D四个人,如果互相之间发生交易(如A给B10个比特币,B给C3个比特币,etc.),会把信息公开告诉所有人,然后每个人都要进行记账.那么问题来了:
For example, there are now four people in A\B\C\D, and if there's a deal between them (e.g. A to B10 bitcoins, B to C3 bitcoins, etc.), the information will be made public to everyone, and then everyone will have to record it.
1.ABCD凭什么要记账
Why do ABCD have to be accounted for?
2.最后以谁的账本为准
2. Whose books are the final basis of reference
3.如何防伪
3. Counterfeiting
4.如何防止双重支付
4. How to prevent double payment
5.如何防止篡改
5. How to prevent tampering
接下来一个一个来看中本聪同学是如何解决这些问题的.
The next one is to see how the neutron students solve these problems.
1.ABCD凭什么要记账
Why do ABCD have to be accounted for?
记账有奖励,想让人做某件事情,就是让他有奖励.人性哪.
There's a reward for making people do something. It's a reward for their humanity.
1)记账的人会得到手续费,比如A付给B10块钱,C记的账,C会从中得到一定的手续费.
1) The account keeper will receive a fee, e.g. A pays B10, C will get a fee from C.
2)打包奖励,只能有一个人完成打包,打包会有人得到奖励.完成打包的人会得到50个比特币(BTC)的奖励
2) Packing incentives, only one person can finish packing, one person will get a reward. Those who finish packing will get 50 Bitcoin (BTC) awards.
打包注:中本聪设计账本记录要在10分钟左右完成一个打包,打包的结果我们称为区块(区块内约有4000条交易记录)据以上,可以算出比特币大概有多少个,20*6*24*365*4*1+1/2+(1/2)^2+....)=2100万个
Packet notation: In order to complete a package in 10 minutes or so, we call it a block (about 4,000 transaction records in the block) from which we can calculate how many bitcoins are estimated, 20*6*24*365*4*1+1+1/2+1(1/2)2+...) = 21 million
2.最后以谁的账本为准
2. Whose books are the final basis of reference
工作量证明(Proofofwork)简单理解就是,系统会出一个很难的数学题,如果谁先做出来了,就可以获得奖励.但是这个数学题非常难,难到只能通过穷举法,一个一个试出答案,试答案的过程我们就叫做挖矿.
The simple understanding of Proofofwork is that the system will have a hard math question, and if anyone makes it first, they'll get a reward. But it's a very difficult math question, and it's so difficult to try an answer, one by one, and the process of trying it will be known as mining.
引申:哈希函数sha256("美女")=256位的二进制数
Quote: Hashi function sha256 (#34; beautiful #34;) = 256 binary numbers
这个函数的特点在于,你随便输入什么,都能很快的得到256位的二进制数.
The feature of this function is that you can quickly get a binary number of 256 digits by inputting anything you want.
举个类比的例子说明:对于X^5+LOG2X=Y,如果你输入X=a,Y
Example of an analogy: for X5+LOG2X=Y, if you enter a, Y
快就能算出来,但是给你Y,让你算X,就会难得多.而哈希函数就比这个还要难很多.
It's gonna be a lot harder to figure it out, but it's gonna be a lot harder for you to count X. And Hashi is a lot harder than that.
挖矿原理:
Mining principles:
D-D-D-D-…
以上每个D代表一个区块,每个区块的里面包含的信息:前块头部+账单信息+时间戳+随机数=字符串(先不要管字符串怎么来的)
Each block D above represents the information contained in each block: the front head + bill information + the time stamp + the random number = the string (no matter how the string comes from)
对字符串进行哈希运算HASH=SHA256(字符串)=256位的二级制数
Hashi operation of string HASH = SHA256 (string) = 256-bit secondary number
对256位的二级制数,通常会要求前n位为0(通常设置难度即设置n的大小,调整n的大小来控制出块时间),如果谁先试出来这个结果,就有资格去打包区块.这个幸运儿就能再把一个新的D(区块)接到上面的区块链中.并获得相应奖励.
For 256-digit secondary numbers, the first n is usually required to be zero (usually to set the size of n, adjust the size of n to control block time), and if someone tries this result first, it is qualified to pack blocks. This lucky guy can then put a new D (block) in the chain of blocks above... and be rewarded accordingly.
要怎么算出来这个256位数字.就需要挖矿的人(矿工)不停的进行试以上公式中的随机数.直到试出来.
How do we figure out this 256-digit number?
注意,每个人在计算的时候难度是不一样的,因为每个人记录的账单信息和时间戳及个人信息都不一样.但是一般来讲,谁的算力更强,即试得更快更多,谁挖到的概率就大.
Note that it's not easy for everyone to calculate because everyone records different billing information and time stampes and personal information. But generally, who's better at math, that's to say, try faster, who's more likely to dig.
3.如何防伪
3. Counterfeiting
先从身份认证说起,传统的身份认证方式有签名\指纹\人脸等,但是不够安全,现实中易被伪造
In terms of identification, traditional forms of identification include signatures, fingerprints, faces, etc., but they're not safe enough to be forged in reality.
如何解决这个问题呢
How do we solve this?
电子签名!
Electronic signature!
怎么来的:随机数-->私钥-->公钥-->地址
How: Random numbers -- > private keys -- > public keys -- > address
公钥和地址可以公开,比如你想让人转钱给你,可以把公钥和地址给他.但是私钥要保密,不能给!
Public keys and addresses can be made public, for example, if you want people to transfer money to you, you can give them to him, but private keys must be kept secret, not given!
私钥可以算出公钥,但是公钥算不出来私钥,密码学上这种关系称为非对称加密
Private keys can be counted as public keys, but public keys can't be counted as private keys, and the cryptographic relationship is called asymmetric encryption.
通过实例来理解:
By way of example:
比如A给B转1个比特币,A会对这个信息进行HASH哈希运算得到一个摘要,然后利用私钥对摘要进行加密得到密码.然后A要对全网进行广播这个信息++
For example, A turns a bitcoin to B, A gets a summary of this information for HASHHHASH, then encrypts it with a private key to get a password.
比如C听到广播后,会进行验证这条信息是不是真实发生的.C会对进行哈希得到摘要1,同时用A提供的+得到摘要2,如果摘要1=摘要2,就说明这条信息确实是A用自己的私钥加密出来的.如果不一样,就说明这条信息是伪造的,不是A发起这笔交易的
For example, when C hears the broadcast, it will verify whether the information is real or not. C will get summary 1 for Hashi and summary 2 for A. If summary 1 = summary 2, it means that the information is actually encrypted by A. If it's different, it means that the information is forged, not by A.
4.如何防止双重支付
4. How to prevent double payment
1)首先要理解余额检查-追溯法,比如你要付钱给别人,至少要证明有足够的钱.比如A给B转1个比特币,那么在历史的区块链上就可以看到过往的记录,看是否A在历史上得到过1个比特币.
1) First, understand the balance check-retroactivity method, for example, you have to pay someone, at least prove there's enough money. For example, A to B turns a bitcoin, then you can see past records on the historical block chain, see if A has a bitcoin in history.
2)什么是双重支付,也叫双花,就是同一笔钱你用了两次,比如A同时发出两条消息1-A付钱给B1个BTC,2-A付钱给C1个BTC.网络上接收到这两个消息的人时间不一样.此时比如D先接收到1-A付钱给B1个BTC并且算出了数学题,然后打包区块并接上链.此时1-A付钱给B这条信息会被确认,而2-A付钱给C1个BTC就会被放弃.
2) What is double payment, or double flower, is that the same amount of money you spend twice, e.g. A sends two messages at the same time 1-A pays BTC, 2-A pays C1 BTC. The time for receiving these two messages on the network is different. At this point, D receives 1-A and pays BTC for B1 and calculates mathematical questions, and then packs blocks and links B. The information 1-A pays B will be confirmed, while 2-A pays C1 BTC will be abandoned.
5.如何防止篡改
5. How to prevent tampering
先来理解最长链原则,如果网络中有A和B几乎同时算出了数学题并进行打包上链后怎么办,此时链上会有两个分叉,这个时候我们通过时间来解决,看两条链过一段时间后哪一个最长,最长链的那条会有越来越多的人站位直到最后所有人抛弃那条短的链
Let's first understand the maximum chain principle. If there's a couple of A and B in the network that's got math and wrapping up the chain, then there'll be two splits on the chain, and we'll fix it by time, see which one of the longest, after a period of time, will be more and more people standing until all end up abandoning that short chain.
理解之后我们再来看如何防止篡改
Then we'll see how we can prevent tampering.
比如A之前发生过一笔交易AtoB1个比特币,但是A想对这条记录进行篡改怎么办
Like A had a deal AtoB 1 bitcoin before, but what if A wanted to tamper with the record?
回到我们的链来D1-D2-D3-D4-…
Back to our chain D1-D2-D3-D4--
比如A想篡改的这笔交易发生在D2区块,他需要从D1往后开始篡改,这个工作量会很大,相当于一人对抗全世界.理论上如果A的计算能力超过所有人,他是可以完成篡改的.但是这种概率会很小,首先没有人有如此大的计算能力,至少在可预见的未来没有;其二,如果他有这么大的计算能力,他可以继续挖矿赚钱(除非他是疯子或者科学怪人)否则不会去做分叉.
For example, the deal that A wanted to tamper with occurred in block D2, and he needed to tamper from D1, and the workload would be huge, amounting to one against the world. Theoretically, if A was more able to calculate than everyone, he could do it. But the probability would be small, and no one had that much capacity, at least not for the foreseeable future; and secondly, if he had that much capacity, he would continue to dig for money (unless he was a lunatic or a Frankenstein) and would not do it.
总结,通过以上五个问题的解决,中本聪同学探索出了一条不需要银行等中间商从而实现人人认可的记账方案.这是一个伟大的发明.而且即将对未来的人类社会造成巨大的影响.比特币只是区块链的一个应用,犹如电灯之于电力的发明.实际上底层技术是区块链技术,这个技术会大大降低人与人,点对点的信任成本.从而降低社会运行的成本.
In conclusion, through the resolution of the five above-mentioned issues, China has explored an acceptable bookkeeping programme that does not require intermediaries such as banks... This is a great invention and is about to have a tremendous impact on the future of human society. Bitcoin is only an application in the chain of blocks, like electric power. In fact, bottom-line technology is a block-chain technology that can significantly reduce the cost of trust between people and point-to-point...and thus reduce the cost of social operations.
其实还有很多细节的问题没有提到,感兴趣的同学可以了解拜占庭将军问题-如何解决恶意节点从而保证信息的一致性等.
In fact, there are many details that are not mentioned, and interested students can understand the issue of General Byzantine - how to resolve malicious nodes to ensure consistency of information, etc.
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论