區塊鏈運作機制
If you're interested in technology, there's a good chance you’ve probably heard the terms Bitcoin, Crypto, Ethereum, or even "distributed, decentralized ledgers."
如果您對技術感興趣,那么您很有可能已經聽說過比特幣,加密貨幣,以太坊,甚至“分布式,分散式分類帳”。
You’ve probably heard people talk about cryptocurrency and encryption algorithms, about the end of "intermediaries" and so on.
您可能已經聽說過人們談論加密貨幣和加密算法,有關“中介”的結尾等等。
It's easy to assume that cryptocurrency (eg: Bitcoin, Ripple, Ethereum, Litecoin, etc.) are the same as blockchain. They're not.
很容易假設加密貨幣(例如:比特幣,Ripple,以太坊,Litecoin等)與區塊鏈相同。 他們不是。
Cryptocurrencies are a clever application of a much cleverer technology – the Blockchain.
加密貨幣是更聰明的技術- 區塊鏈的聰明應用。
In this post, I will cover some of the basic concepts of the blockchain so you understand what it is, how it must be conceptualized, and what can be built on top of it.
在本文中,我將介紹區塊鏈的一些基本概念,以便您了解區塊鏈的含義,如何將其概念化以及可以在其之上構建的內容。
But as with all things, they make more sense if you understand why they were invented, before you get into what they do. That context will help you grasp what problem the blockchain was designed to solve.
但是,與所有事物一樣,如果您在了解它們的用途之前了解了它們被發明的原因 ,它們就更有意義。 該上下文將幫助您掌握區塊鏈旨在解決的問題。
為什么要使用區塊鏈? (Why use blockchain?)
Great question. So glad you asked. Let's sit back and do a small thought experiment.
好問題。 很高興你問。 讓我們坐下來做一個小小的思想實驗。
What happens if you and your best friend independently and separately conduct the same petition campaign? Let’s say it’s for the “Free the Hamsters” cause.
如果你和獨立和分開你最好的朋友進行同樣的請愿運動,會發生什么? 假設這是出于“釋放倉鼠”的原因。
Let's say you conduct it in an identical sequence across the same suburb, but come up with different sets of signatures on the petition. Which version of the signed petition is the “source of truth”?
假設您在同一郊區以相同的順序進行操作,但在請愿書上提出了不同的簽名集。 簽署的請愿書的哪個版本是“真理的來源”?
You would need to trace back your separate trails, one signature at a time, to locate the last discrepancy. And then you'd have to work further back to identify the first result that diverged between your signature sheets. Prior to that root divergence, all other signatures on the two lists should match up.
您需要追溯單獨的蹤跡,一次簽名一個,以找到最后一個差異。 然后,您必須進一步進行工作,以找出在簽名表之間出現分歧的第一個結果。 在該根差異之前,兩個列表上的所有其他簽名都應匹配。
You then know that prior to that divergence. Both lists are in accord, so those signatures represent the minimum number of people who signed to support freeing the hamsters.
然后,您會在出現分歧之前知道這一點。 這兩個列表是一致的,所以這些簽名代表支持釋放倉鼠的最少簽名人數。
While that may work well for hamsters and small suburban surveys, it doesn’t work so well in the digital world. Or voting, banking, financial transactions, transferring land title, discharging contractual obligations etc. You need independent and “trusted third parties” to verify a chain of events, and solemnly reassure you that the "chain of custody" was unbroken.
盡管這對于倉鼠和郊區的小型調查可能效果很好,但在數字世界中效果并不理想。 或表決,銀行業務,金融交易,土地所有權轉讓,履行合同義務等。您需要獨立且“受信任的第三方”來驗證一系列事件,并鄭重地向您保證“監管鏈”沒有中斷。
A "chain of custody" can sometimes also be called the "provenance" – they both mean the same thing: ?the sequence of historical events concerning the data in question.
有時也可以將“監管鏈”稱為“出處”-它們都具有相同的含義:有關數據的歷史事件序列。
That’s why you have governments having the final say on your identity, and votes need to be physically counted and recounted by hundreds of volunteers, and clerks in dingy offices maintain ledgers and certificates to confirm whether or not you own your farm/white picket-fenced bungalow. ?
這就是為什么您要讓政府對您的身份擁有最終決定權,并且投票必須由數百名志愿者親自盤點和重新計算,而骯臟的辦公室里的文員則維護著分類帳和證書,以確認您是否擁有自己的農場/白色糾察隊員平房。
That is why you need financial intermediaries to ensure that when you buy your collector's item Darth Vader doll, using a credit card, the money (value) is “removed” from your account and “put into” to the seller’s account.
因此,您需要金融中介機構來確保在使用信用卡購買收藏家的商品達斯·維達娃娃時,錢(值)從您的帳戶中“刪除”并“放入”賣家的帳戶中。
This is technically called the “double spending problem” – how do you ensure that you’re not spending the same money twice? Without someone to do this, you could spend money and at the same time continue to hold on to that money.
從技術上講,這就是“ 雙重支出問題 ” –如何確保您不會兩次花相同的錢? 沒有人這樣做,您可以花錢,同時繼續保留這筆錢。
So it’s a big problem really – modern life requires that we rely on, trust in and pay for “trusted” third party intermediaries to ensure that value (money) does actually digitally “change hands”. That is why Visa and MasterCard exist, and why PayPal and others link with your bank accounts.
因此,這確實是一個大問題–現代生活要求我們依靠,信任并為“受信任的”第三方中介機構付款,以確保價值(金錢)確實以數字方式“易手”。 這就是為什么存在Visa和MasterCard,以及為什么PayPal和其他鏈接到您的銀行帳戶的原因。
At the heart of the blockchain's why is this problem: how do you know a sequence of events has not been tampered with to alter the current state?
區塊鏈的核心問題為何如此:您如何知道一系列事件沒有被篡改以更改當前狀態?
This is where the blockchain fits in. Clear, so far?
這就是區塊鏈適合的地方。
區塊鏈如何運作 (How Blockchain works)
For the sake of communicating a concept with simplicity, I may take liberties with some of the technical, under-the-hood aspects of this technology. My aim is to get you to understand what it is and have a mental model of how it works. For that, I may need to be a little loose with precision in order to improve the odds of comprehension, especially for non-native English speakers.
為了簡單地傳達一個概念,我可能會對此技術的某些技術,內在方面有所保留。 我的目的是使您了解它的含義,并對它的工作方式有一個心理模型。 為此,我可能需要稍微放松一點,以提高理解的機率,尤其是對于非英語母語的人。
It is essential to remember that the blockchain is a technology – mathematically complex software code to be specific. And Bitcoin (or Ethereum or any of the other cryptos on offer) are just applications of that technology.
重要的是要記住,區塊鏈是一項技術–具體而言,數學上復雜的軟件代碼。 比特幣(或以太坊或任何其他提供的加密貨幣)只是該技術的應用。
So the key principles are:
因此,關鍵原則是:
- Blockchains are ‘mined” (produced through the expenditure of effort, like in gold mining) by powerful and resource-hungry computers ?– called nodes, that are on the same network. 區塊鏈是由功能強大且耗費資源的計算機(稱為節點)“挖掘”(通過花費大量精力,例如在金礦中生產的),這些計算機位于同一網絡上。
- Chains of digitally encrypted and timestamped records of transactions are lumped into “blocks”, which are maintained on a “ledger” by each node. As transactions are added to a block, and blocks are linked together linearly and chronologically as "chains". Then the entire record/ledger gets synchronised across the network of nodes such that all the block "chains" on the nodes should tell an identical story of the history of any given transaction. Thus we get "block + chain = blockchain". It's a long, complicated linked list. 帶有數字加密和時間戳記的交易記錄鏈被合并為“塊”,每個節點將這些塊維護在“分類帳”中。 隨著交易被添加到一個區塊,區塊被線性地和按時間順序連接在一起,成為“鏈”。 然后,整個記錄/分類帳將在節點網絡之間進行同步,以使節點上的所有區塊“鏈”都應講述任何給定交易歷史的相同故事。 因此,我們得到“區塊+鏈=區塊鏈”。 這是一個漫長而復雜的鏈表。
Each block in a chain has its own id - a cryptographic hash that is unique and specific to each block. That hash is also stored in the next block in the chain, causing a link. A block can store thousands of transactions and the tiniest change in that block's data would result in a new hash. So if a hash changes but the next block has a different hash, then we know some data in the previous block was tampered with.
鏈中的每個塊都有自己的ID-每個塊唯一且特定的加密哈希。 該哈希也存儲在鏈中的下一個塊中,從而導致鏈接。 一個塊可以存儲數千個事務,并且該塊數據中最微小的變化將導致新的哈希。 因此,如果哈希值發生變化,但是下一個塊具有不同的哈希值,那么我們知道前一個塊中的某些數據已被篡改。
- As hundreds become thousands of nodes (and more are added all the time), each node has to “agree” on the history of the blocks/ledger – this is called "critical consensus". One of the ways in which consensus is achieved is through the cryptographic hash we talked about earlier. 當數百個節點變成數千個節點時(一直在增加),每個節點都必須“同意”區塊/分類賬的歷史記錄-這稱為“關鍵共識”。 達成共識的一種方式是通過我們前面討論的加密哈希。
- Where there are discrepancies in the ledger (for example the hash of a block doesn't match with the next block's reference to the previous block's hash), the ledger with the longest chain of valid transactions embedded will be the “correct” one – the source of truth. Any nodes working on other (shorter versions) of the chain switch to the longer one. This maintains the critical consensus (this bit is hugely oversimplified, but sufficient for now). 如果分類賬中存在差異(例如,某個區塊的哈希值與下一個區塊對前一個區塊的哈希值的引用不匹配),則嵌入有效交易鏈最長的分類賬將是“正確的”分類賬–真理之源。 在其他(較短版本)鏈上工作的任何節點都將切換到較長節點。 這維持了關鍵的共識(這一點被大大簡化了,但目前已經足夠了)。
- Any naughty interception or change to one ledger (again, for example, where a block's hash doesn't tally) would immediately create a discrepancy with all the other versions. It would also have a shorter block “history” to corroborate it, which makes that tampered version a suspicious character in the blockchain network where length matters (ahem). 任何頑皮的攔截或更改為一個分類帳(例如,再次是某個區塊的哈希值不相符的情況),都會立即與所有其他版本產生差異。 它也將具有較短的塊“歷史”來證實它,這使得該篡改版本在長度很重要的區塊鏈網絡中(可惡)成為可疑字符。
Replicating that discrepancy across all the versions of the ledger – the entire blockchain network – is such a huge task that it is computationally impractical, and would only happen if the bad guys suddenly had control over the majority of the nodes mining blockchain and changed them all rather rapidly. This sort of coordinated attack on the majority of the nodes on the network is often called the 51% attack.
復制所有分類賬的差異(整個區塊鏈網絡)是一項巨大的任務,在計算上是不切實際的,并且只有當壞人突然控制了挖礦區塊鏈的大多數節點并全部更改后,這種情況才會發生相當快。 對網絡上大多數節點的這種協同攻擊通常稱為51%攻擊 。
Interestingly, Satoshi Nakamoto says in the original Bitcoin white paper,
有趣的是,中本聰在原始比特幣白皮書中說,
“As such, the verification is reliable as long as honest nodes control the network, but is more vulnerable if the network is overpowered by an attacker.” ?
這樣,只要誠實節點控制網絡,驗證是可靠的,但是如果網絡受到攻擊者的壓制,則驗證將更容易受到攻擊。 ”
However, elsewhere he/she/the organisation (we don't know who "Satoshi" is) calmly points out that to modify past transactions in blocks, across the entire network of nodes, would require the attacker to re-do the chain of custody in those blocks, and all the blocks added after that. Then they'd have to run like mad to catch up with, and surpass, the work of nodes that aren’t under the bad guy’s control (so that they can re-write the ledger, so-to-speak).
但是,在他/她/組織的其他地方(我們不知道“ Satoshi”是誰)冷靜地指出,要在整個節點網絡中按塊修改過去的交易,將要求攻擊者重新執行在這些區塊中保管,然后添加所有區塊。 然后,他們不得不瘋狂追趕跑,不斷超越,是不是壞人的控制節點的工作(使他們能夠重新寫賬,所以來講話)。
And because of this, the “probability of a slower attacker catching up diminishes exponentially as subsequent blocks are added”.
因此,“ 隨著添加后續塊,較慢的攻擊者追趕的概率呈指數下降 ”。
The sheer programmatic complexity, pace and volume of nodal activities make it hard for counterfeiters/attackers to catch up with, let alone outrun, the new blocks mined constantly.
程序的復雜性,節點活動的速度和數量龐大,使得造假者/攻擊者難以趕上(不斷增長)不斷開采的新區塊,更不用說超越了。
That does make sense. It’s like the lie you tell one family member about why you couldn’t attend their kid’s flute recital. And then you have to madly chase everyone else in the family and ensure you’ve told them all the same lie so that when the original person you’ve lied to brings it up, everyone is aware of this lie and plays along. Sounds exhausting.
確實有道理。 就像您向一位家庭成員講謊言,為什么您不能參加他們孩子的長笛演奏會一樣。 然后,您必須瘋狂地追逐家庭中的其他所有人,并確保已將他們所有的謊言都告訴了他們,以便當您撒謊的原始人提出這個謊言時,每個人都意識到了這種謊言并一直在玩耍。 聽起來很累。
To wrap up, the defining characteristic of a blockchain is that it is a distributed ledger across many, many nodes and it is extremely computationally intensive (expensive) to add nodes to that network.
總結起來,區塊鏈的定義特征是它是跨許多節點的分布式分類帳,并且向該網絡添加節點的計算量很大(昂貴)。
Thus each ledger must be "aware" of all the transactions, and must have an agreed version (which will have the longest “chain of custody” behind it) across the entire network to which the next transaction will be added.
因此,每個分類賬都必須“意識到”所有交易,并且必須在整個網絡中擁有一個同意的版本(該版本背后將擁有最長的“監管鏈”),下一個交易將被添加到該整個網絡中。
As Satoshi Nakamoto declares in the original Bitcoin white paper, “ The only way to confirm the absence of a transaction is to be aware of all transactions.”
正如中本聰(Satoshi Nakamoto)在原始比特幣白皮書中宣稱的那樣:“ 確認不存在交易的唯一方法是了解所有交易。 ”
Importantly, the blockchain "dis-intermediates" trust – so we don’t need to pay “trusted third parties” transaction fees for being trustworthy and keeping us, and the counter-parties we deal with, honest. The blockchain programmatically ensures truth (provenance) of the history of transaction in it.
重要的是,區塊鏈“ 消除了中介 ”的信任-因此,我們無需為“可信賴的第三方”而支付“可信賴的第三方”交易費用,以保持我們以及與我們交易的對手的誠實。 區塊鏈以編程方式確保其中交易歷史的真實性(來源)。
那么,為什么我們要關心呢? (So why should we care?)
Well, by getting rid of the need for “trusted intermediaries” any intermediary that charges a modest fee for giving us the gift of certainty needs to find a new job. And that impact banks who traditionally offer such assurance services. ?
好吧,通過擺脫對“可信中介人”的需求,任何收取適度費用以給我們確定性禮物的中介人都需要找到新工作。 這對傳統上提供此類保證服務的銀行產生了影響。
It also means that we can program “smart contracts” between promisor and promisee that automatically recognise (digitally) whether that promise has been delivered or not.
這也意味著我們可以在承諾者和被承諾者之間編寫“ 智能合約 ”,以自動(數字)識別該承諾是否已交付。
This has enabled a truly tech savvy artist like Imogen Heap to sell her music directly to her listening public, and collect her dues directly from them rather than losing the bulk of earnings to record labels, managers and other “trusted intermediaries”. ?
這使像Imogen Heap這樣真正精通技術的藝術家能夠將音樂直接出售給聽眾,并直接從他們那里收取應得的稅款,而不是將大部分收入損失給唱片公司,經理和其他“受信任的中介”。
It will likely change the way Intellectual Property is protected, accessed, shared, distributed, and developed on the internet.
這很可能會改變知識產權在互聯網上受到保護,訪問,共享,分發和開發的方式。
It could even mean that Uber’s fleet of drivers transact directly with people who want a ride rather than rely on Uber to coordinate and control the flow of information and money.
這甚至可能意味著,Uber的駕駛員隊伍直接與想要乘車的人進行交易,而不是依靠Uber來協調和控制信息和資金流。
It may mean that I could directly send you small amounts of money for virtually no fees (micro-transactions). It could mean that the millions of unbanked people in the world who have smartphones can start to transact well beyond their traditional physical-world boundaries.
這可能意味著我可以直接向您發送少量資金,而幾乎不收取任何費用(微交易)。 這可能意味著世界上數百萬擁有智能手機的無銀行賬戶的人可以開始超越傳統的自然世界范圍進行交易。
Wonderfully enough, governments are looking beyond just cryptocurrency when it comes to deploying this technology – to record land ownership, for example.
不足為奇的是,政府在部署此技術時不僅考慮使用加密貨幣, 例如 記錄土地所有權 。
In effect, we could create a world of true peer-to-peer digital transactions for the transfer of value that is distributed, horizontal, removes the need to rely on trust, and above all requires extraordinary computational power to tamper with. These transactions could be between people, machines and devices.
實際上,我們可以創建一個真正的點對點數字交易世界,以實現水平分布的價值轉移,從而消除了對信任的依賴,最重要的是,它需要非凡的計算能力來進行篡改。 這些交易可能發生在人,機器和設備之間。
It could therefore offer a new security paradigm for the protection of data collected by and transferred through the “internet of things”.
因此,它可以為保護“物聯網”收集和傳輸的數據提供一種新的安全范式。
I personally believe that the complexity of the modern world is obscured behind intuitive touchscreens. Blockchain technology will quickly become embedded in our technological universe without us being fully aware of it – just like we have been using yeast recombinant DNA for synthetic insulin production since the 1970s.
我個人認為,直觀觸摸屏背后掩蓋了現代世界的復雜性。 就像我們從1970年代以來就一直在使用酵母重組DNA生產合成胰島素一樣,區塊鏈技術將很快被嵌入我們的技術領域。
The changes and cost savings will be sweepingly referred to as technological changes, like that "interweby thing” or some other vague, all-inclusive phrase.
這種變化和成本節省將被統稱為技術變化,例如“網絡事物”或其他模糊,包羅萬象的短語。
One catch: it'll work as long as we can trust that a "trust-less system" that is coded and engineered by humans (whom we trust?) will further the cause of trust-less-ness in an untrusting and untrustworthy world. You may need to read that sentence several times.
一個陷阱:只要我們可以相信,由人類(我們信任誰?)編碼和設計的“無信任系統”將在不信任和不信任的世界中進一步促進不信任的根源。 您可能需要多次閱讀該句子。
結語 (Wrapping up)
OK – you should now be reasonably aware of the basics of blockchain. But there is a lot more to learn if you're interested.
好的–您現在應該合理地了解區塊鏈的基礎知識。 但是,如果您有興趣,還有很多東西要學習。
You can debate whether blockchain is useful or over-hyped, revolutionary or boring. But it's hard to ignore that it is pretty cool as a concept.
您可以爭論區塊鏈是有用的還是過度炒作的,革命性的還是無聊的。 但是,很難忽略它作為一個概念非常酷。
Here is a really fantastic video by Anders Brownworth that explains the whole thing with a mockup blockchain. I strongly recommend you watch it.
這是安德斯·布朗沃思(Anders Brownworth)制作的一段非常棒的視頻,它用一個模型區塊鏈解釋了整個過程。 我強烈建議您觀看。
And as a learning exercise, you can build your own blockchain right in your browser or your command line. Here's a quick tutorial for how to build your own blockchain.
作為學習練習,您可以直接在瀏覽器或命令行中構建自己的區塊鏈。 這是有關如何構建自己的區塊鏈的快速教程 。
If you have any comments about this article or think I could have explained parts of this better, Tweet at me at @ZubinPratap
如果您對本文有任何意見,或者認為我可以更好地解釋本文的某些部分,請通過@ZubinPratap在我身上鳴叫
Also, I believe your most precious resources are your time, effort and money. Of these, the single most important resource is time, because the other two can be renewed and recovered. So if you’re going to spend time on something make sure it gets you closer to this goal.
另外,我相信您最寶貴的資源是您的時間,精力和金錢。 其中,最重要的資源是時間,因為其他兩個資源可以更新和恢復。 因此,如果您要花時間在某些事情上,請確保它使您更接近此目標。
With that in mind, if you want to invest 3 hours with me to find your shortest path to learning to code (especially if you’re a career changer, like me), then head to my own personal course site and type in "Udemy" in the comment box, and leave your email.
考慮到這一點,如果您想花3個小時與我一起尋找最短的學習編碼的途徑(尤其是像我這樣的職業轉變者),那么請前往我自己的個人課程網站,然后輸入“ Udemy ”,然后留下您的電子郵件。
Also if you would like to learn more about my journey into code, check out ?episode 53 of the ?freeCodeCamp podcast, where Quincy (founder of FreeCodeCamp) and I share our experiences as career changers that may help you on your journey. You can also access the podcast on iTunes, Stitcher, and Spotify.
另外,如果您想了解有關我的代碼之旅的更多信息,請查看freeCodeCamp播客的 第53集 ,其中Quincy(FreeCodeCamp的創始人)和我分享了我們的職業轉變經驗,這些經驗可能對您的旅程有所幫助。 您還可以在iTunes , Stitcher和Spotify上訪問播客。
翻譯自: https://www.freecodecamp.org/news/what-is-blockchain-and-how-does-it-work/
區塊鏈運作機制