【系列】Sharding - Ethereum擴容方案簡介

in cn •  7 years ago 

關於以太坊現在面臨的問題討論,我們在前一篇文章Plasma - Ethereum擴容方案簡介裡面已經討論過了,我們現在就廢話不多說,來介紹第二種擴容方式,也是大家應該最常聽到的Sharding - 分片技術。

(圖片來源: https://www.ethnews.com)

Sharding

Sharding的中文翻譯是「分片」,比起Plasma,我覺得非常的貼近它的本質(就是聽起來不太帥...)。如果你有碰過資料庫的經驗,那麼Sharding這個詞對你應該不陌生:分片是個在資料庫中還滿常使用的技術,簡單的說就是將一個大的資料表分成許多小片,存在不同的節點上,這麼一來可以減少每個節點的負擔、有效的進行互相備份、也可以大幅減少搜尋時間。著名的資料庫ElasticSearch就是有使用這種Sharding的技術。

那麼在區塊鍊上的「分片」是什麼意思呢?

如果你認真思考過現在Ethereum PoW的運作方式,其實是非常沒有效率的。儘管全世界的電腦都可以拿出來當礦工,這整個網路也會因為礦工的增加而提昇安全性,但是整體的運作效率卻無法因為礦工增加而提昇!這正是因為全世界的礦工,都試圖在做一模一樣的任務:認證同樣的交易。

仔細想想,雖然重複的工作是去中心化的核心,但全世界的電腦都在做一樣的工作,或許真有點太蠢了;如果我們能夠稍微動點手腳,讓大家工作重複性不要這麼高,不是很好嗎?

其實分片在做的事情叫好像是分組一樣:我們把全世界的電腦分成3組,分別驗證三群的交易,那麼我們的整體速度就可以提昇三倍了哪!

(圖片來源:https://btcmanager.com/)

在Vitalik自己的介紹中,他把Sharding比域成小島:想像現在ETH的交易世界是由無數的小島組成,同個小島上的居民(就是同一個Shard中的帳號)可以輕鬆的互相交易,而如果有需要小島間的交易,則需要用到另外的Protocal。

新的區塊架構

在這樣新的藍圖之下,區塊鍊的架構也必須有所改變。
我們多了一個叫做transaction group的單位,而這一個transaction group紀錄了自己屬於哪個shard(分片),以及發生這些交易的前後的分片狀態,如下圖所示:

更上一層的區塊鍊不再直接紀錄transactions,而是多筆transaction groups。

  • State root 紀錄了所有的shard的狀態
  • Transaction group root則負責紀錄所有的transaction group

並不是太複雜吧!

Cross Shard Transactions

細心的朋友可能會發現上面圖示中有個沒有用到的收據(Receipt)。在每一筆交易完成時,他除了會變動自己所屬shard的狀態(state)之外,也會產生一個收據。這個收據是其他shard有辦法讀取但是無法更改的,因此可以透過傳遞收據ID的方式來進行溝通:這樣別的shard上就可以驗證我的帳戶信息。收據就好像是一個有力的證明,別的shard可以信任這個收據的有效性。

小小結

Sharding的實踐最困難的點,不是在於一個小島上的驗證,而是在於不同小島如何取得共識。記得:區塊鍊就是個互不信任的節點網路。在這樣一個世界裡「分組」這件事毫無疑問的是為大家增加一個麻煩:要如何才能有效的分組、或是驗證各個節點的sharding身份呢?因此有人認為,Ethereum需要先有POS的共識機制,才能達成這樣的前提。

要知道,Ethereum雖然目標遠大,但是對於超越VISA這樣遠大的理想,Vitalik可是畫了5年的road map。這讓我們知道儘管這些概念看似簡單易懂,真正要實踐可是一番真工夫呢!

個人還是十分看好ETH的未來,畢竟開發團隊太強,小神童太神。如果你想要贊助我一點eth也可以打賞到我的新ENS位址:antontw.eth喔!
(也可以參考我的ENS介紹文章自己申請ENS喔)

(再次跪拜小神童 )

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

You have received a @GrumpyCat flag because you or someone else sent money to buy votes from an irresponsible non-GrumpyCompliant service.

Some bots are acting irresponsibly by selling votes on posts very close to final payout. These votes are sneaky, not promotion and are most of the time placed on low value content.

Sending money to these bots is also financially supporting for-profit only posters (spammers).

To know what voting bot to use, refer to https://steembottracker.com/ and use those that have 3.5 day or less in the "Max Age" column.

@sneaky-ninja (by @michaeldavid) is reporting 6 day but is actually selling votes up until 6.4 days.

Important warning, since @sneaky-ninja has made no effort to comply in 3 months, it's vote will still be countered even should he improve his Max Age setting.

Learn more ...

@grumpycat now I get your idea...
Sorry that I somehow support this kind of voting bot, @sneaky-ninja, but I'm not using it for last minute up-votes. I used the bot to promote this post right after I published it, and I still get and big downvote from you, I don't think I deserve that.
Now I get it and I promise that I will switch to other bots in the future when I need them. Could you please remove the downvote? That will mean a lot to me as a creator on Steemit.
Thanks and have a great day!

  ·  7 years ago 

恭喜你!您的这篇文章入选 @justyy 今日 (2018-04-09) 榜单 【优秀被错过的文章】, 回复本条评论24小时内领赏,点赞本评论将支持 @dailychina 并增加将来您的奖赏。

Congratulations! This post has been selected by @justyy as today's (2018-04-09) 【Good Posts You May Miss】, Steem On! Reply to this message in 24 hours to get rewards. Upvote this comment to support the @dailychina and increase your future rewards! ^_^

謝謝支持!我會再接再厲!

Ethereum desperately needs development to maintain its dominance amongst the other platform coins.

agree, now EOS and NEO are also on fire... But I think ETH still have one big advantage: it's the only blockchain that has been widely used and tested.

You got a 3.13% upvote from @upmewhale courtesy of @antonsteemit!

Earn 100% earning payout by delegating SP to @upmewhale. Visit http://www.upmewhale.com for details!

sneaky-ninja-sword-xs.jpg

Sneaky Ninja Attack! You have just been defended with a 25.79% upvote!
I was summoned by @antonsteemit. I have done their bidding and now I will vanish...


woosh

A portion of the proceeds from your bid was used in support of youarehope and tarc.


Abuse Policy
Rules
How to use Sneaky Ninja
How it works
Victim of grumpycat?

  ·  7 years ago Reveal Comment

好奇你有沒有其他平台發步資訊啊?

中文STEEMIT還沒有太強大社群力量....?

什麼意思?
是問我有沒有在其他地方寫文章嗎?

Cardano will rule.