黑基网 首页 资讯 互联网 查看内容

入门区块链必读的宝典

2018-1-9 17:55| 投稿: xiaotiger |来自: 互联网

摘要: 区块链(blockchain)是眼下的大热门,新闻媒体大量报道,宣称它将创造未来。其实区块链也不是很难的东西,下面是一份最易懂的区块链教程。看完这篇文章,您会对区块链有很大的理解,明白什么是挖矿、以及挖矿越来越 ...

区块链(blockchain)是眼下的大热门,新闻媒体大量报道,宣称它将创造未来。

其实区块链也不是很难的东西,下面是一份最易懂的区块链教程。看完这篇文章,您会对区块链有很大的理解,明白什么是挖矿、以及挖矿越来越难等问题。

区块链的本质

区块链的本质是一种特殊的分布式数据库。它的主要作用是储存信息。任何需要保存的信息,都可以写入区块链,也可以从里面读取。

其次,任何人都可以架设服务器,加入区块链网络,成为一个节点。区块链的世界里面,没有中心节点,每个节点都是平等的,都保存着整个数据库。你可以向任何一个节点,写入/读取数据,因为所有节点最后都会同步,保证区块链一致。

区块链的最大特点

区块链没有管理员,它是彻底无中心的。如果有人想对区块链添加审核,也实现不了,因为它的设计目标就是防止出现居于中心地位的管理当局。

正是因为无法管理,区块链才能做到无法被控制。否则一旦大公司大集团控制了管理权,他们就会控制整个平台,其他使用者就都必须听命于他们了。

但是,没有了管理员,人人都可以往里面写入数据,怎么才能保证数据是可信的呢?被坏人改了怎么办?请接着往下读,这就是区块链奇妙的地方。

区块

区块链由一个个区块(block)组成。区块很像数据库的记录,每次写入数据,就是创建一个区块。

每个区块包含两个部分。

  • 区块头(Head):记录当前区块的元信息

  • 区块体(Body):实际数据

区块头包含了当前区块的多项元信息。

  • 生成时间

  • 实际数据(即区块体)的 Hash

  • 上一个区块的 Hash

  • ...

理解Hash很重要,这样才能很好的理解区块链

计算机可以对任意内容,计算出一个长度相同的特征值。而区块链的 Hash 长度是256位,这就是说,不管原始内容是什么,最后都会计算出一个256位的二进制数字。而且可以保证,只要原始内容不同,对应的 Hash 一定是不同的。

Hash 的不可修改性

区块与 Hash 是一一对应的,每个区块的 Hash 都是针对"区块头"(Head)计算的。

Hash = SHA256(区块头)

上面就是区块 Hash 的计算公式,Hash 由区块头唯一决定,SHA256是区块链的 Hash 算法。如果当前区块的内容变了,或者上一个区块的 Hash 变了,一定会引起当前区块的 Hash 改变。

如果有人修改了一个区块,该区块的 Hash 就变了。为了让后面的区块还能链到它,该人必须同时修改后面所有的区块,否则被改掉的区块就脱离区块链了。由于后面要提到的原因,Hash 的计算很耗时,同时修改多个区块几乎不可能发生,除非有人掌握了全网51%以上的计算能力。

正是通过这种联动机制,区块链保证了自身的可靠性,数据一旦写入,就无法被篡改。这就像历史一样,发生了就是发生了,从此再无法改变。

每个区块都连着上一个区块,这也是"区块链"这个名字的由来。

采矿

由于必须保证节点之间的同步,所以新区块的添加速度不能太快。因为每个区块的后面,只能跟着一个区块,你永远只能在最新区块的后面,生成下一个区块。所以,你别无选择,一听到信号,就必须立刻同步。

区块链的发明者中本聪,故意让添加新区块,变得很困难。他的设计是,平均每10分钟,全网才能生成一个新区块,一小时也就六个。

这种产出速度是设置了海量的计算。只有通过极其大量的计算,才能得到当前区块的有效 Hash,从而把新区块添加到区块链。计算量太大,所以快不起来。

这个过程就叫做采矿。计算 Hash 的机器就叫做矿机,操作矿机的人就叫做矿工。

难度系数

读到这里,你可能会有一个疑问,人们都说采矿很难,可是采矿其实就是用计算机算出一个 Hash,但不是任意一个 Hash 都可以,只有满足条件的 Hash 才会被区块链接受。

因为其条件苛刻,绝大部分 Hash 反复重算,所以增加了难度系数。区块头包含一个难度系数,这个值决定了计算 Hash 的难度。

区块链协议规定,目标值难度系数越大,目标值就越小,导致了采矿越来越难。由于目标值非常小,Hash 小于该值的机会极其渺茫,可能计算10亿次,才算中一次。这就是采矿如此之慢的根本原因。

总结:

区块链作为分布式数据库,从2009年开始已经运行了8年,至今被越来越多的社会群体所接受,并且展开应用,国家政府也纷纷出台扶持政策,区块链的应用和发展前景不可限量。

, groupId: 6508563579803795982, itemId: 6508563579803795982, type: 2, subInfo: { isOriginal: false, source: 财客网, time: 2018-01-08 14:30:48 }, tagInfo: { tags: [], groupId: 6508563579803795982, itemId: 6508563579803795982, repin: 0, }, has_extern_link: 0 }, commentInfo: { groupId: 6508563579803795982, itemId: 6508563579803795982, comments_count: 20, ban_comment: 0 }, mediaInfo: { uid: 77032683155, name: 财客网, avatar: //p3.pstatp.com/large/470300011a876f4714cf, openUrl: /c/user/77032683155/, follow: false }, pgcInfo: {"media_info":{"open_url":"/c/user/77032683155/","avatar_url":"https://p3.pstatp.com/large/470300011a876f4714cf","media_id":1584843005054990,"name":"财客网","user_verified":false},"articles":[{"item_id":"6508962198314811912","url":"/item/6508962198314811912","title":"比特币得道,狗币升天!"},{"item_id":"6508563579803795982","url":"/item/6508563579803795982","title":"入门区块链必读的宝典"},{"item_id":"6507493539918643726","url":"/item/6507493539918643726","title":"加密货币命运大猜想,比特币的命运走向又将如何?"},{"item_id":"6504892412232466957","url":"/item/6504892412232466957","title":"区块链狄仁杰浅谈代投行业"}]}, feedInfo: { url: /api/pc/feed/, category: __all__, initList: [{"comments_count":0,"media_avatar_url":"//p3.pstatp.com/large/97d00042919126d5b8a","is_feed_ad":false,"is_diversion_page":false,"title":"达人店:全国首个“去中心化”新零售体系","single_mode":true,"gallary_image_count":3,"middle_mode":false,"has_video":false,"video_duration_str":null,"source_url":"/group/6508870630698385933/","source":"商业与观察","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p1.pstatp.com/list/190x124/56840005e479f01f0906","group_id":"6508870630698385933","is_related":true,"media_url":"/c/user/3401888149/"},{"comments_count":46,"media_avatar_url":"//p3.pstatp.com/large/43590000df56be50c60a","is_feed_ad":false,"is_diversion_page":false,"title":"挺进区块链 WBTC生态化应用成最大看点","single_mode":true,"gallary_image_count":1,"middle_mode":true,"has_video":false,"video_duration_str":null,"source_url":"/group/6508876290114732548/","source":"创投经济者","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p3.pstatp.com/list/190x124/568a0000544413220901","group_id":"6508876290114732548","is_related":true,"media_url":"/c/user/74191323270/"},{"comments_count":5,"media_avatar_url":"//p3.pstatp.com/large/216b00255cbb7c23dd1d","is_feed_ad":false,"is_diversion_page":false,"title":"分布式与集群,程序员必经之路","single_mode":true,"gallary_image_count":1,"middle_mode":true,"has_video":false,"video_duration_str":null,"source_url":"/group/6508673968034021902/","source":"顽皮的coder","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p9.pstatp.com/list/190x124/56870002808142a0b833","group_id":"6508673968034021902","is_related":true,"media_url":"/c/user/60903843646/"},{"comments_count":0,"is_related":true,"is_feed_ad":false,"is_diversion_page":false,"title":"Excel表格里,在单价和总计不变的前提下,怎么调整工程量使它计算出来的总计一致?","single_mode":true,"gallary_image_count":3,"middle_mode":false,"has_video":false,"video_duration_str":null,"source_url":"/group/6508854309755552013/","source":"悟空问答","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p1.pstatp.com/list/190x124/50ed00068f8305666319","group_id":"6508854309755552013"},{"comments_count":7,"media_avatar_url":"//p3.pstatp.com/large/2c640002496a93effe6f","is_feed_ad":false,"is_diversion_page":false,"title":"Flask是Python web最火热三大框架之一!给我两小时带你完全入门","single_mode":true,"gallary_image_count":38,"middle_mode":true,"has_video":false,"video_duration_str":null,"source_url":"/group/6508573221195874829/","source":"sun菜菜","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p9.pstatp.com/list/190x124/56830003b3e4f2055090","group_id":"6508573221195874829","is_related":true,"media_url":"/c/user/5838461924/"},{"comments_count":130,"media_avatar_url":"//p2.pstatp.com/large/4aff00006ee9a4a99768","is_feed_ad":false,"is_diversion_page":false,"title":"新手看完Python实现微信跳一跳自动运行,再忍不住了","single_mode":true,"gallary_image_count":13,"middle_mode":false,"has_video":false,"video_duration_str":null,"source_url":"/group/6507053196077171214/","source":"菜鸟学Python","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":2,"image_url":"//p3.pstatp.com/list/190x124/53fc0002cb4fa6d3e342","group_id":"6507053196077171214","is_related":true,"media_url":"/c/user/58539886296/"},{"comments_count":5,"media_avatar_url":"//p1.pstatp.com/large/3b0c0000ad960c3ab925","is_feed_ad":false,"is_diversion_page":false,"title":"非常重要的一些SQL语句(一)","single_mode":true,"gallary_image_count":1,"middle_mode":true,"has_video":false,"video_duration_str":null,"source_url":"/group/6508507184408560131/","source":"简单印象","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p3.pstatp.com/list/190x124/56840002667c8b1e725b","group_id":"6508507184408560131","is_related":true,"media_url":"/c/user/69762622880/"},{"comments_count":20,"media_avatar_url":"//p3.pstatp.com/large/46f00001ebd8deeac8a9","is_feed_ad":false,"is_diversion_page":false,"title":"95%的人都不会的VLOOKUP“新”用法","single_mode":true,"gallary_image_count":5,"middle_mode":false,"has_video":false,"video_duration_str":null,"source_url":"/group/6506677552784867847/","source":"石山庄","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p9.pstatp.com/list/190x124/53f6000560a24539ab94","group_id":"6506677552784867847","is_related":true,"media_url":"/c/user/62976031134/"},{"comments_count":0,"media_avatar_url":"//p3.pstatp.com/large/2bd40004789d6c314fd7","is_feed_ad":false,"is_diversion_page":false,"title":"SpringCloud分布式之SpringBoot架构设计——标准API","single_mode":true,"gallary_image_count":1,"middle_mode":true,"has_video":false,"video_duration_str":null,"source_url":"/group/6508678161394303492/","source":"爆发的羔羊","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p3.pstatp.com/list/190x124/53ea00000a28949b046b","group_id":"6508678161394303492","is_related":true,"media_url":"/c/user/56543059117/"},{"comments_count":27,"media_avatar_url":"//p1.pstatp.com/large/4b0100026274e1b075d9","is_feed_ad":false,"is_diversion_page":false,"title":"十分钟学会Redis,就这么简单","single_mode":true,"gallary_image_count":81,"middle_mode":false,"has_video":false,"video_duration_str":null,"source_url":"/group/6507370633981067780/","source":"我是一只燃烧的火鸟","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p3.pstatp.com/list/190x124/56780003fae790f8bd22","group_id":"6507370633981067780","is_related":true,"media_url":"/c/user/5544662271/"},{"comments_count":2,"media_avatar_url":"//p9.pstatp.com/large/4e640004ef82401cdd63","is_feed_ad":false,"is_diversion_page":false,"title":"MySQL服务器CPU跑满100%的情况分析","single_mode":true,"gallary_image_count":1,"middle_mode":true,"has_video":false,"video_duration_str":null,"source_url":"/group/6508607936648970766/","source":"IT小明","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p3.pstatp.com/list/190x124/56860002556fcfc75b7d","group_id":"6508607936648970766","is_related":true,"media_url":"/c/user/74887486145/"},{"comments_count":39,"media_avatar_url":"//p1.pstatp.com/large/46c6001a98d7e0e58dc0","is_feed_ad":false,"is_diversion_page":false,"title":"让你的C盘更清净","single_mode":true,"gallary_image_count":1,"middle_mode":true,"has_video":false,"video_duration_str":null,"source_url":"/group/6507392039024329224/","source":"梦齐丸","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p3.pstatp.com/list/190x124/53fd0006d5808950298c","group_id":"6507392039024329224","is_related":true,"media_url":"/c/user/77483532894/"},{"comments_count":26,"media_avatar_url":"//p1.pstatp.com/large/97d001bd69ee3114fb7","is_feed_ad":false,"is_diversion_page":false,"title":"这 10 款 iOS 通知中心小部件,可以极大提升 iPhone 使用幸福感","single_mode":true,"gallary_image_count":10,"middle_mode":true,"has_video":false,"video_duration_str":null,"source_url":"/group/6508503770165412356/","source":"少数派","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":1,"image_url":"//p3.pstatp.com/list/190x124/5685000239d84136f879","group_id":"6508503770165412356","is_related":true,"media_url":"/c/user/3285451712/"},{"comments_count":161,"media_avatar_url":"//p1.pstatp.com/large/1a6c001d36e992163b8d","is_feed_ad":false,"is_diversion_page":false,"title":"这13个Excel技巧不会,就别怪天天加班了","single_mode":true,"gallary_image_count":17,"middle_mode":true,"has_video":false,"video_duration_str":null,"source_url":"/group/6507726495652250116/","source":"Excel之家","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p3.pstatp.com/list/190x124/567b0005da450bec39d1","group_id":"6507726495652250116","is_related":true,"media_url":"/c/user/58984762722/"},{"comments_count":192,"media_avatar_url":"//p9.pstatp.com/large/216c0018161d6915a232","is_feed_ad":false,"is_diversion_page":false,"title":"键盘上的每个键能背下来你的电脑就不用求人了!","single_mode":true,"gallary_image_count":1,"middle_mode":true,"has_video":false,"video_duration_str":null,"source_url":"/group/6506459942315098631/","source":"吉祥空间","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p9.pstatp.com/list/190x124/53f60003fa8f75dd8156","group_id":"6506459942315098631","is_related":true,"media_url":"/c/user/59022864750/"},{"comments_count":42,"media_avatar_url":"//p3.pstatp.com/large/2c640002496a93effe6f","is_feed_ad":false,"is_diversion_page":false,"title":"神级程序员为了带实习生入门Python花25天整理最全面向对象教程!","single_mode":true,"gallary_image_count":66,"middle_mode":true,"has_video":false,"video_duration_str":null,"source_url":"/group/6507558921849274893/","source":"sun菜菜","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p1.pstatp.com/list/190x124/567d0003b93993a385c6","group_id":"6507558921849274893","is_related":true,"media_url":"/c/user/5838461924/"},{"comments_count":17,"media_avatar_url":"//p2.pstatp.com/large/4d001e50f700c399f8","is_feed_ad":false,"is_diversion_page":false,"title":"老外做的Excel图表,为什么这么漂亮?","single_mode":true,"gallary_image_count":11,"middle_mode":true,"has_video":false,"video_duration_str":null,"source_url":"/group/6507369718020571662/","source":"标杆精益","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p3.pstatp.com/list/190x124/567900036a86c32a5265","group_id":"6507369718020571662","is_related":true,"media_url":"/c/user/6033002661/"},{"comments_count":11,"media_avatar_url":"//p3.pstatp.com/large/4719000084e185e23e84","is_feed_ad":false,"is_diversion_page":false,"title":"36个绝对不能错过的Excel技巧,速度收了!","single_mode":true,"gallary_image_count":9,"middle_mode":false,"has_video":false,"video_duration_str":null,"source_url":"/group/6507459790044660228/","source":"office技巧分享","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p3.pstatp.com/list/190x124/567d000201bb663811ff","group_id":"6507459790044660228","is_related":true,"media_url":"/c/user/77371300393/"},{"comments_count":4,"media_avatar_url":"//p1.pstatp.com/large/4ae20003d0bd8f0dd7bd","is_feed_ad":false,"is_diversion_page":false,"title":"机器学习实战:用胶囊网络识别交通标志","single_mode":true,"gallary_image_count":5,"middle_mode":true,"has_video":false,"video_duration_str":null,"source_url":"/group/6508733042087952900/","source":"新缸中之脑","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p3.pstatp.com/list/190x124/56870002efaa781fcca9","group_id":"6508733042087952900","is_related":true,"media_url":"/c/user/3306411550/"},{"comments_count":0,"media_avatar_url":"//p9.pstatp.com/large/4e640004ef82401cdd63","is_feed_ad":false,"is_diversion_page":false,"title":"MySQL使用explain分析sql效率","single_mode":true,"gallary_image_count":3,"middle_mode":true,"has_video":false,"video_duration_str":null,"source_url":"/group/6508606600268218883/","source":"IT小明","more_mode":null,"article_genre":"article","has_gallery":false,"video_play_count":0,"image_url":"//p9.pstatp.com/list/190x124/56830004642820e95e25","group_id":"6508606600268218883","is_related":true,"media_url":"/c/user/74887486145/"}] }, shareInfo: { shareUrl: https://m.toutiao.com/item/6508563579803795982/, abstract: 区块链(blockchain)是眼下的大热门,新闻媒体大量报道,宣称它将创造未来。其实区块链也不是很难的东西,下面是一份最易懂的区块链教程。看完这篇文章,您会对区块链有很大的理解,明白什么是挖矿、以及挖矿越来越难等问题。区块链的本质区块链的本质是一种特殊的分布式数据库。
小编推荐:欲学习电脑技术、系统维护、网络管理、编程开发和安全攻防等高端IT技术,请 点击这里 注册黑基账号,公开课频道价值万元IT培训教程免费学,让您少走弯路、事半功倍,好工作升职加薪!



免责声明:本文由投稿者转载自互联网,版权归原作者所有,文中所述不代表本站观点,若有侵权或转载等不当之处请联系我们处理,让我们一起为维护良好的互联网秩序而努力!联系方式见网站首页右下角。


鲜花

握手

雷人

路过

鸡蛋

相关阅读

最新评论


新出炉

返回顶部