{"id":18325,"date":"2026-03-15T22:10:34","date_gmt":"2026-03-15T22:10:34","guid":{"rendered":"https:\/\/cryptoted.net\/index.php\/2026\/03\/15\/the-1-x-files-a-primer-for-the-witness-specification\/"},"modified":"2026-03-15T22:10:34","modified_gmt":"2026-03-15T22:10:34","slug":"the-1-x-files-a-primer-for-the-witness-specification","status":"publish","type":"post","link":"https:\/\/cryptoted.net\/index.php\/2026\/03\/15\/the-1-x-files-a-primer-for-the-witness-specification\/","title":{"rendered":"The 1.x Files: A Primer for the Witness Specification"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div id=\"\">\n<p class=\"chakra-text css-gi02ar\">Since a lot of us have a bit more time on our hands, I thought now might be a good opportunity to proceed with something perhaps a little bit boring and tedious, but nevertheless quite fundamental to the Stateless Ethereum effort: understanding the formal Witness Specification.<\/p>\n<p class=\"chakra-text css-gi02ar\">Like the captain of the Battleship in StarCraft, we&#8217;re going to take it slow. The witness spec is not a particularly <strong>complicated<\/strong> concept, but it is very <strong>deep<\/strong>. That depth is a little daunting, but is well worth exploring, because it&#8217;ll provide insights that, perhaps to your nerdy delight, extend well beyond the world of blockchains, or even software!<\/p>\n<p class=\"chakra-text css-gi02ar\">By the end of this primer, you should have at least minimum-viable-confidence in your ability to understand what the formal Stateless Ethereum <a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"https:\/\/github.com\/ethereum\/stateless-ethereum-specs\/blob\/master\/witness.md\">Witness Specification<\/a> is all about. I&#8217;ll try to make it a little more <em class=\"chakra-text css-0\">fun<\/em>, too.<\/p>\n<h2 class=\"chakra-heading group css-1kpzc4q\" id=\"recap-what-you-need-to-know-about-state\" data-group=\"true\"><a class=\"chakra-link css-128fqrf\" aria-label=\"recap what you need to know about state permalink\" href=\"#recap-what-you-need-to-know-about-state\"><svg viewbox=\"0 0 24 24\" focusable=\"false\" class=\"chakra-icon css-173jpr1\"><g fill=\"currentColor\"><path d=\"M10.458,18.374,7.721,21.11a2.853,2.853,0,0,1-3.942,0l-.892-.891a2.787,2.787,0,0,1,0-3.941l5.8-5.8a2.789,2.789,0,0,1,3.942,0l.893.892A1,1,0,0,0,14.94,9.952l-.893-.892a4.791,4.791,0,0,0-6.771,0l-5.8,5.8a4.787,4.787,0,0,0,0,6.77l.892.891a4.785,4.785,0,0,0,6.771,0l2.736-2.735a1,1,0,1,0-1.414-1.415Z\"\/><path d=\"M22.526,2.363l-.892-.892a4.8,4.8,0,0,0-6.77,0l-2.905,2.9a1,1,0,0,0,1.414,1.414l2.9-2.9a2.79,2.79,0,0,1,3.941,0l.893.893a2.786,2.786,0,0,1,0,3.942l-5.8,5.8a2.769,2.769,0,0,1-1.971.817h0a2.766,2.766,0,0,1-1.969-.816,1,1,0,1,0-1.415,1.412,4.751,4.751,0,0,0,3.384,1.4h0a4.752,4.752,0,0,0,3.385-1.4l5.8-5.8a4.786,4.786,0,0,0,0-6.771Z\"\/><\/g><\/svg><\/a>Recap: What you need to know about State<\/h2>\n<p class=\"chakra-text css-gi02ar\">Stateless Ethereum is, of course, a bit of a misnomer, because the state is really what this whole effort is about. Specifically, finding a way to make keeping a copy of the whole Ethereum state an <strong>optional<\/strong> thing. If you haven&#8217;t been following this series, it might be worth having a look at <a class=\"chakra-link css-vezwxf\" href=\"https:\/\/blog.ethereum.org\/2019\/12\/30\/eth1x-files-state-of-stateless-ethereum\">my earlier primer<\/a> on the state of stateless Ethereum. I&#8217;ll give a short TL;DR here though. Feel free to skim if you feel like you&#8217;ve already got a good handle on this topic.<\/p>\n<blockquote class=\"chakra-code css-gk0tva\">\n<p class=\"chakra-text css-gi02ar\">The complete \u2018state\u2019 of Ethereum describes the current status of all accounts and balances, as well as the collective memories of all smart contracts deployed and running in the EVM. Every finalized block in the chain has one and only one state, which is agreed upon by all participants in the network. That state is changed and updated with each new block that is added to the chain.<\/p>\n<\/blockquote>\n<p class=\"chakra-text css-gi02ar\">The Ethereum State is represented <em class=\"chakra-text css-0\">in silico<\/em> as a <strong>Merkle-Patricia Trie<\/strong>: a hashed data structure that organizes each individual piece of information (e.g. an account balance) into one massive connected unit that can be verified for uniqueness. The complete state trie is too massive to visualize, but here&#8217;s a &#8216;toy version&#8217; that will be helpful when we get to witnesses:<\/p>\n<p class=\"chakra-text css-gi02ar\"><img decoding=\"async\" alt=\"toy state trie\" src=\"https:\/\/blog.ethereum.org\/images\/posts\/State_example.png\" class=\"chakra-image css-hw6q2r\"\/><\/p>\n<p class=\"chakra-text css-gi02ar\">Like magical cryptographic caterpillars, the accounts and code of smart contracts live in the leaves and branches of this tree, which through successive hashing eventually leads to a single <strong>root hash<\/strong>. If you want to know that two copies of a state trie are the same, you can simply compare the root hashes. Maintaining relatively secure and indisputable consensus over one &#8216;canonical&#8217; state is the essence of what a blockchain is designed to do.<\/p>\n<p class=\"chakra-text css-gi02ar\">In order to submit a transaction to be included in the next block, or to validate that a particular change is consistent with the last included block, Ethereum nodes must keep a complete copy of the state, and re-compute the root hash (over and over again). Stateless Ethereum is a set of changes that will remove this requirement, by adding what&#8217;s known as a &#8216;witness&#8217;.<\/p>\n<h2 class=\"chakra-heading group css-1kpzc4q\" id=\"a-witness-sketch\" data-group=\"true\"><a class=\"chakra-link css-128fqrf\" aria-label=\"a witness sketch permalink\" href=\"#a-witness-sketch\"><svg viewbox=\"0 0 24 24\" focusable=\"false\" class=\"chakra-icon css-173jpr1\"><g fill=\"currentColor\"><path d=\"M10.458,18.374,7.721,21.11a2.853,2.853,0,0,1-3.942,0l-.892-.891a2.787,2.787,0,0,1,0-3.941l5.8-5.8a2.789,2.789,0,0,1,3.942,0l.893.892A1,1,0,0,0,14.94,9.952l-.893-.892a4.791,4.791,0,0,0-6.771,0l-5.8,5.8a4.787,4.787,0,0,0,0,6.77l.892.891a4.785,4.785,0,0,0,6.771,0l2.736-2.735a1,1,0,1,0-1.414-1.415Z\"\/><path d=\"M22.526,2.363l-.892-.892a4.8,4.8,0,0,0-6.77,0l-2.905,2.9a1,1,0,0,0,1.414,1.414l2.9-2.9a2.79,2.79,0,0,1,3.941,0l.893.893a2.786,2.786,0,0,1,0,3.942l-5.8,5.8a2.769,2.769,0,0,1-1.971.817h0a2.766,2.766,0,0,1-1.969-.816,1,1,0,1,0-1.415,1.412,4.751,4.751,0,0,0,3.384,1.4h0a4.752,4.752,0,0,0,3.385-1.4l5.8-5.8a4.786,4.786,0,0,0,0-6.771Z\"\/><\/g><\/svg><\/a>A Witness Sketch<\/h2>\n<p class=\"chakra-text css-gi02ar\">Before we dive into the witness specification, it&#8217;ll be helpful to have an intuitive sense of what a witness is. Again, there is a more thorough explanation in the post on the Ethereum state linked above.<\/p>\n<p class=\"chakra-text css-gi02ar\">A witness is a bit like a cheat sheet for an oblivious (stateless) student (client). It&#8217;s just the minimum amount of information need to pass the exam (submit a valid change of state for inclusion in the next block). Instead of reading the whole textbook (keeping a copy of the current state), the oblivious student (stateless client) asks a friend (full node) for a crib sheet to submit their answers.<\/p>\n<blockquote class=\"chakra-code css-gk0tva\">\n<p class=\"chakra-text css-gi02ar\">In very abstract terms, a witness provides all of the needed hashes in a state trie, combined with some \u2018structural\u2019 information about where in the trie those hashes belong. This allows an \u2018oblivious\u2019 node to include new transaction in its state, and to compute a new root hash locally \u2013 without requiring them to download an entire copy of the state trie.<\/p>\n<\/blockquote>\n<p class=\"chakra-text css-gi02ar\">Let&#8217;s move away from the cartoonish idea and towards a more concrete representation. Here is a &#8220;real&#8221; visualization of a witness:<\/p>\n<p class=\"chakra-text css-gi02ar\"><img decoding=\"async\" alt=\"witness-hex\" src=\"https:\/\/raw.githubusercontent.com\/ledgerwatch\/ledgerwatch.github.io\/master\/state_hex_5790928.dot.png\" class=\"chakra-image css-hw6q2r\"\/><\/p>\n<p class=\"chakra-text css-gi02ar\">I recommend opening this image in a new tab so that you can zoom in and really appreciate it. This witness was selected because it&#8217;s relatively small and easy to pick out features. Each little square in this image represents a single &#8216;nibble&#8217;, or half of a byte, and you can verify that yourself by counting the number of squares that you have to &#8216;pass through&#8217;, starting at the root and ending at an Ether balance (you should count 64). While we&#8217;re looking at this image, notice the huge chunk of code within one of the transactions that must be included for a contract call &#8212; code makes up a relatively large part of the witness, and could be reduced by code merkleization (which we&#8217;ll explore another day).<\/p>\n<h2 class=\"chakra-heading group css-1kpzc4q\" id=\"some-formalities\" data-group=\"true\"><a class=\"chakra-link css-128fqrf\" aria-label=\"some formalities permalink\" href=\"#some-formalities\"><svg viewbox=\"0 0 24 24\" focusable=\"false\" class=\"chakra-icon css-173jpr1\"><g fill=\"currentColor\"><path d=\"M10.458,18.374,7.721,21.11a2.853,2.853,0,0,1-3.942,0l-.892-.891a2.787,2.787,0,0,1,0-3.941l5.8-5.8a2.789,2.789,0,0,1,3.942,0l.893.892A1,1,0,0,0,14.94,9.952l-.893-.892a4.791,4.791,0,0,0-6.771,0l-5.8,5.8a4.787,4.787,0,0,0,0,6.77l.892.891a4.785,4.785,0,0,0,6.771,0l2.736-2.735a1,1,0,1,0-1.414-1.415Z\"\/><path d=\"M22.526,2.363l-.892-.892a4.8,4.8,0,0,0-6.77,0l-2.905,2.9a1,1,0,0,0,1.414,1.414l2.9-2.9a2.79,2.79,0,0,1,3.941,0l.893.893a2.786,2.786,0,0,1,0,3.942l-5.8,5.8a2.769,2.769,0,0,1-1.971.817h0a2.766,2.766,0,0,1-1.969-.816,1,1,0,1,0-1.415,1.412,4.751,4.751,0,0,0,3.384,1.4h0a4.752,4.752,0,0,0,3.385-1.4l5.8-5.8a4.786,4.786,0,0,0,0-6.771Z\"\/><\/g><\/svg><\/a>Some Formalities<\/h2>\n<p class=\"chakra-text css-gi02ar\">One of the fundamental distinguishing features of Ethereum as a protocol is its <em class=\"chakra-text css-0\">independence<\/em> from a particular implementation. This is why, rather than just one <em class=\"chakra-text css-0\">official<\/em> client as we see in Bitcoin, Ethereum has several completely different versions of client. These clients, written in various programming languages, must adhere to <a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"https:\/\/ethereum.github.io\/yellowpaper\/paper.pdf\">The Ethereum Yellow Paper<\/a>, which explains in much more formal terms how <em class=\"chakra-text css-0\">any<\/em> client should behave in order to participate in the Ethereum protocol. That way, a developer writing a client for Ethereum doesn&#8217;t have to deal with any ambiguity in the system.<\/p>\n<p class=\"chakra-text css-gi02ar\">The Witness Specification has this exact goal: to provide an <strong>unambiguous<\/strong> description of what a witness is, which will make implementing it straightforward in any language, for all clients. If and when Stateless Ethereum becomes &#8216;a thing&#8217;, the witness specification can be inserted into the Yellow Paper as an appendix.<\/p>\n<p class=\"chakra-text css-gi02ar\">When we say <strong>unambiguous<\/strong> in this context, it means something stronger than what you might mean in ordinary speech. It&#8217;s not that the formal specification is just a really, really, really, detailed description of what a witness is and how it behaves. It means that, ideally, there is <strong>literally one and only one way<\/strong> describe a particular witness. That is to say, if you adhere to the formal specification, it&#8217;d be <strong>impossible<\/strong> for you to write an implementation for Stateless Ethereum that generates witnesses different than any other implementation also following the rules. This is key, because the witness is going to (hopefully) become a new cornerstone of the Ethereum protocol; It needs to be correct by construction.<\/p>\n<h2 class=\"chakra-heading group css-1kpzc4q\" id=\"a-matter-of-semantics-and-syntax\" data-group=\"true\"><a class=\"chakra-link css-128fqrf\" aria-label=\"a matter of semantics and syntax permalink\" href=\"#a-matter-of-semantics-and-syntax\"><svg viewbox=\"0 0 24 24\" focusable=\"false\" class=\"chakra-icon css-173jpr1\"><g fill=\"currentColor\"><path d=\"M10.458,18.374,7.721,21.11a2.853,2.853,0,0,1-3.942,0l-.892-.891a2.787,2.787,0,0,1,0-3.941l5.8-5.8a2.789,2.789,0,0,1,3.942,0l.893.892A1,1,0,0,0,14.94,9.952l-.893-.892a4.791,4.791,0,0,0-6.771,0l-5.8,5.8a4.787,4.787,0,0,0,0,6.77l.892.891a4.785,4.785,0,0,0,6.771,0l2.736-2.735a1,1,0,1,0-1.414-1.415Z\"\/><path d=\"M22.526,2.363l-.892-.892a4.8,4.8,0,0,0-6.77,0l-2.905,2.9a1,1,0,0,0,1.414,1.414l2.9-2.9a2.79,2.79,0,0,1,3.941,0l.893.893a2.786,2.786,0,0,1,0,3.942l-5.8,5.8a2.769,2.769,0,0,1-1.971.817h0a2.766,2.766,0,0,1-1.969-.816,1,1,0,1,0-1.415,1.412,4.751,4.751,0,0,0,3.384,1.4h0a4.752,4.752,0,0,0,3.385-1.4l5.8-5.8a4.786,4.786,0,0,0,0-6.771Z\"\/><\/g><\/svg><\/a>A Matter of Semantics (and Syntax)<\/h2>\n<p class=\"chakra-text css-gi02ar\">Although &#8216;blockchain development&#8217; usually implies something new and exciting, it must be said that a lot of it is grounded in much older and wiser traditions of computer programming, cryptography, and formal logic. This really comes out in the Witness Specification! In order to understand how it works, we need to feel comfortable with some of the technical terms, and to do that we&#8217;re going to have to take a little detour into linguistics and formal language theory.<\/p>\n<p class=\"chakra-text css-gi02ar\">Read aloud the following two sentences, and pay particular attention to your intonation and cadence:<\/p>\n<ul role=\"list\" class=\"css-1ars4k6\">\n<li class=\"css-0\"><em class=\"chakra-text css-0\">furiously sleep ideas green colorless<\/em><\/li>\n<li class=\"css-0\"><em class=\"chakra-text css-0\">colorless green ideas sleep furiously<\/em><\/li>\n<\/ul>\n<p class=\"chakra-text css-gi02ar\">I bet the first sentence came out a bit robotic, with a flat emphasis and pause after each word. By contrast, the second sentence probably felt natural, if a bit silly. Even though it didn&#8217;t really <em class=\"chakra-text css-0\">mean anything<\/em>, the second sentence <em class=\"chakra-text css-0\">made sense<\/em> in a way that the first one didn&#8217;t. This is a little intuition pump to draw attention to the distinction between <strong>Syntax<\/strong> and <strong>Semantics<\/strong>. If you&#8217;re an English speaker you have an understanding of what the words <em class=\"chakra-text css-0\">represent<\/em> (their semantic content), but that was largely irrelevant here; what you noticed was a difference between valid and invalid grammar (their syntax).<\/p>\n<p class=\"chakra-text css-gi02ar\">This example sentence is from <a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"https:\/\/chomsky.info\/wp-content\/uploads\/195609-.pdf\">a 1956 paper<\/a> by one Noam Chomsky, which is a name you might recognize. Although he is now known as an influential political and social thinker, Chomsky&#8217;s first contributions as an academic were in the field of logic and linguistics, and in this paper, he created one of the most useful classification systems for formal languages.<\/p>\n<p class=\"chakra-text css-gi02ar\">Chomsky was concerned with the mathematical description of grammar, how one can categorize languages based on their grammar rules, and what properties those categories have. One such property that is relevant to us is <em class=\"chakra-text css-0\">syntactic ambiguity<\/em>.<\/p>\n<h2 class=\"chakra-heading group css-1kpzc4q\" id=\"ambiguous-buffalo\" data-group=\"true\"><a class=\"chakra-link css-128fqrf\" aria-label=\"ambiguous buffalo permalink\" href=\"#ambiguous-buffalo\"><svg viewbox=\"0 0 24 24\" focusable=\"false\" class=\"chakra-icon css-173jpr1\"><g fill=\"currentColor\"><path d=\"M10.458,18.374,7.721,21.11a2.853,2.853,0,0,1-3.942,0l-.892-.891a2.787,2.787,0,0,1,0-3.941l5.8-5.8a2.789,2.789,0,0,1,3.942,0l.893.892A1,1,0,0,0,14.94,9.952l-.893-.892a4.791,4.791,0,0,0-6.771,0l-5.8,5.8a4.787,4.787,0,0,0,0,6.77l.892.891a4.785,4.785,0,0,0,6.771,0l2.736-2.735a1,1,0,1,0-1.414-1.415Z\"\/><path d=\"M22.526,2.363l-.892-.892a4.8,4.8,0,0,0-6.77,0l-2.905,2.9a1,1,0,0,0,1.414,1.414l2.9-2.9a2.79,2.79,0,0,1,3.941,0l.893.893a2.786,2.786,0,0,1,0,3.942l-5.8,5.8a2.769,2.769,0,0,1-1.971.817h0a2.766,2.766,0,0,1-1.969-.816,1,1,0,1,0-1.415,1.412,4.751,4.751,0,0,0,3.384,1.4h0a4.752,4.752,0,0,0,3.385-1.4l5.8-5.8a4.786,4.786,0,0,0,0-6.771Z\"\/><\/g><\/svg><\/a>Ambiguous Buffalo<\/h2>\n<p class=\"chakra-text css-gi02ar\">Consider the grammatically correct sentence &#8220;<em class=\"chakra-text css-0\">Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.<\/em>&#8221; &#8212; this is a classic example that illustrates just how ambiguous English syntax rules can be. If you understand that, depending on the context, the word &#8216;buffalo&#8217; can be used as a verb (to intimidate), an adjective (being from Buffalo, NY), or a noun (a bison), you can parse the sentence based on where each word belongs.<\/p>\n<p class=\"chakra-text css-gi02ar\">We could also use entirely different words, and multiple sentences: &#8220;You know those NY bison that other NY bison intimidate? Well, they intimidate, too. They intimidate NY bison, to be exact.&#8221;<\/p>\n<p class=\"chakra-text css-gi02ar\">But what if we want to remove the ambiguity, but still restrict our words to use only &#8216;buffalo&#8217;, and keep it all as a single sentence? It&#8217;s possible, but we need to modify the rules of English a bit. Our new &#8220;language&#8221; is going to be a little more exact. One way to do that would be to mark each word to indicate its part of speech, like so:<\/p>\n<p class=\"chakra-text css-gi02ar\"><span class=\"chakra-text css-ons8vw\">Buffalo{pn} buffalo{n} Buffalo{pn} buffalo{n} buffalo{v} buffalo{v} Buffalo{pn} buffalo{n}<\/span><\/p>\n<p class=\"chakra-text css-gi02ar\">Perhaps that&#8217;s still not super clear for a reader. To make it even more exact, let&#8217;s try using a bit of <em class=\"chakra-text css-0\">substitution<\/em> to help us herd some of these &#8220;buffalo&#8221; into groups. Any bison from Buffalo, NY is really just one special version of what we would call a &#8220;noun phrase&#8221;, or <span class=\"chakra-text css-ons8vw\"><np\/><\/span>. We can substitute <span class=\"chakra-text css-ons8vw\"><np\/><\/span> into the sentence whenever we encounter the string <span class=\"chakra-text css-ons8vw\">Buffalo{pn} buffalo{n}<\/span>. Since we&#8217;re getting a bit more formal, we might decide to use a shorthand notation for this and other future substitution rules, by writing:<\/p>\n<p class=\"chakra-text css-gi02ar\"><span class=\"chakra-text css-ons8vw\"><np> ::= Buffalo{pn} buffalo{n}<\/np><\/span><\/p>\n<p class=\"chakra-text css-gi02ar\">where <span class=\"chakra-text css-ons8vw\">::=<\/span> means &#8220;What&#8217;s on the left side can be replaced by what&#8217;s on the right side&#8221;. Importantly, we don&#8217;t want this relationship to go the other way; imagine how mad the Boulder buffalo would get!<\/p>\n<p class=\"chakra-text css-gi02ar\">Applying our substitution rule to the full sentence, it would change to:<\/p>\n<p class=\"chakra-text css-gi02ar\"><span class=\"chakra-text css-ons8vw\"><np> <np> buffalo{v} buffalo{v} <np\/><\/np><\/np><\/span><\/p>\n<p class=\"chakra-text css-gi02ar\">Now, this is still a bit confusing, because in this sentence there is a sneaky relative clause, which can be seen a lot more clearly by inserting the word &#8216;that&#8217; into the first part our sentence, i.e. <span class=\"chakra-text css-ons8vw\"><np> *that* <np> buffalo{v}&#8230;<\/np><\/np><\/span>.<\/p>\n<p class=\"chakra-text css-gi02ar\">So let&#8217;s make a substitution rule that groups the relative clause into <span class=\"chakra-text css-ons8vw\"><rc\/><\/span>, and say:<\/p>\n<p class=\"chakra-text css-gi02ar\"><span class=\"chakra-text css-ons8vw\"><rc> ::= <np> buffalo{v}<\/np><\/rc><\/span><\/p>\n<p class=\"chakra-text css-gi02ar\">Additionally, since a relative clause really just makes a clarification about a noun phrase, the two taken together are equivalent to just another noun phrase:<\/p>\n<p class=\"chakra-text css-gi02ar\"><span class=\"chakra-text css-ons8vw\"><np> ::= <np><rc\/><\/np><\/np><\/span><\/p>\n<p class=\"chakra-text css-gi02ar\">With these rules defined and applied, we can write the sentence as:<\/p>\n<p class=\"chakra-text css-gi02ar\"><span class=\"chakra-text css-ons8vw\"><np> buffalo{v} <np\/><\/np><\/span><\/p>\n<p class=\"chakra-text css-gi02ar\">That seems pretty good, and really gets at the core relationship this silly sentence expresses: One particular group of bison intimidating another group of bison.<\/p>\n<p class=\"chakra-text css-gi02ar\">We&#8217;ve taken it this far, so why not go all the way? Whenever &#8216;buffalo&#8217; as a verb precedes a noun, we could call that a verb phrase, or <span class=\"chakra-text css-ons8vw\"><vp\/><\/span>, and define a rule:<\/p>\n<p class=\"chakra-text css-gi02ar\"><span class=\"chakra-text css-ons8vw\"><vp> ::= buffalo{v}<np\/><\/vp><\/span><\/p>\n<p class=\"chakra-text css-gi02ar\">And with that, we have our single complete valid sentence, which we could call <span class=\"chakra-text css-ons8vw\">S<\/span>:<\/p>\n<p class=\"chakra-text css-gi02ar\"><span class=\"chakra-text css-ons8vw\">S ::= <np><vp\/><\/np><\/span><\/p>\n<p class=\"chakra-text css-gi02ar\">What we&#8217;ve done here might be better represented visually:<\/p>\n<p class=\"chakra-text css-gi02ar\"><img decoding=\"async\" alt=\"buffalo\" src=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/thumb\/2\/2c\/Buffalo_sentence_1_parse_tree.svg\/2880px-Buffalo_sentence_1_parse_tree.svg.png\" class=\"chakra-image css-hw6q2r\"\/><\/p>\n<p class=\"chakra-text css-gi02ar\">That structure looks curiously familiar, doesn&#8217;t it?<\/p>\n<p class=\"chakra-text css-gi02ar\">The buffalo example is a bit silly and not very rigorous, but it&#8217;s close enough to demonstrate what&#8217;s going on with the weird mathematical language of the Witness Specification, which I have very sneakily introduced in my rant about buffalo. It&#8217;s called <a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"https:\/\/en.wikipedia.org\/wiki\/Backus%E2%80%93Naur_form\">Backus-Naur form<\/a> notation, and it&#8217;s often used in formal specifications like this, in a variety of real-world scenarios.<\/p>\n<p class=\"chakra-text css-gi02ar\">The &#8216;substitution rules&#8217; we defined for our restricted English language helped to make sure that, given a herd of &#8220;buffalo&#8221;, we could construct a &#8216;valid&#8217; sentence without needing to know anything <em class=\"chakra-text css-0\">about what the word buffalo means in the real world<\/em>. In the classification first elucidated by Chomsky, a language that has exact enough rules of grammar that allow you to do this is called a <em class=\"chakra-text css-0\">context-free<\/em> language.<\/p>\n<p class=\"chakra-text css-gi02ar\">More importantly, the rules ensure that for every <em class=\"chakra-text css-0\">possible<\/em> sentence comprised of the word(s) <span class=\"chakra-text css-ons8vw\">buffalo{np|n|v}<\/span>, there is one and only one way to construct the data structure illustrated in the tree diagram above. Un-ambiguity FTW!<\/p>\n<h2 class=\"chakra-heading group css-1kpzc4q\" id=\"go-forth-and-read-the-spec\" data-group=\"true\"><a class=\"chakra-link css-128fqrf\" aria-label=\"go forth and read the spec permalink\" href=\"#go-forth-and-read-the-spec\"><svg viewbox=\"0 0 24 24\" focusable=\"false\" class=\"chakra-icon css-173jpr1\"><g fill=\"currentColor\"><path d=\"M10.458,18.374,7.721,21.11a2.853,2.853,0,0,1-3.942,0l-.892-.891a2.787,2.787,0,0,1,0-3.941l5.8-5.8a2.789,2.789,0,0,1,3.942,0l.893.892A1,1,0,0,0,14.94,9.952l-.893-.892a4.791,4.791,0,0,0-6.771,0l-5.8,5.8a4.787,4.787,0,0,0,0,6.77l.892.891a4.785,4.785,0,0,0,6.771,0l2.736-2.735a1,1,0,1,0-1.414-1.415Z\"\/><path d=\"M22.526,2.363l-.892-.892a4.8,4.8,0,0,0-6.77,0l-2.905,2.9a1,1,0,0,0,1.414,1.414l2.9-2.9a2.79,2.79,0,0,1,3.941,0l.893.893a2.786,2.786,0,0,1,0,3.942l-5.8,5.8a2.769,2.769,0,0,1-1.971.817h0a2.766,2.766,0,0,1-1.969-.816,1,1,0,1,0-1.415,1.412,4.751,4.751,0,0,0,3.384,1.4h0a4.752,4.752,0,0,0,3.385-1.4l5.8-5.8a4.786,4.786,0,0,0,0-6.771Z\"\/><\/g><\/svg><\/a>Go Forth and Read the Spec<\/h2>\n<p class=\"chakra-text css-gi02ar\">Witnesses are at their core just a single large object, encoded into a byte array. From the (anthropomorphic) perspective of a stateless client, that array of bytes might look a bit like a long sentence comprised of very similar looking words. So long as all clients follow the same set of rules, the array of bytes should convert into one and only one hashed data structure, regardless of how the implementation chooses to represent it in memory or on disk.<\/p>\n<p class=\"chakra-text css-gi02ar\">The production rules, written out in section 3.2, are a bit more complex and far less intuitive than the ones we used for our toy example, but the spirit is very much the same: To be <strong>unambiguous<\/strong> guidelines for a stateless client (or a developer writing a client) to follow and be <em class=\"chakra-text css-0\">certain<\/em> they&#8217;re getting it right.<\/p>\n<p class=\"chakra-text css-gi02ar\">I&#8217;ve glossed over quite a lot in this exposition, and the rabbit hole of formal languages goes far deeper, to be sure. My aim here was to just provide enough of an introduction and foundation to overcome that first hurdle of understanding. Now that you have cleared that hurdle, it&#8217;s time pop open wikipedia and tackle the rest yourself!<\/p>\n<p class=\"chakra-text css-gi02ar\">As always, if you have feedback, questions, or requests for topics, please @gichiba or @JHancock on twitter.<\/p>\n<\/div>\n<p><br \/>\n<br \/><a href=\"https:\/\/blog.ethereum.org\/en\/2020\/05\/04\/eth1x-witness-primer\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since a lot of us have a bit more time on our hands, I thought now might be a good opportunity to proceed with something perhaps a little bit boring and tedious, but nevertheless quite fundamental to the Stateless Ethereum effort: understanding the formal Witness Specification. Like the captain of the Battleship in StarCraft, we&#8217;re [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":18222,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"tdm_status":"","tdm_grid_status":"","footnotes":""},"categories":[24],"tags":[],"kronos_expire_date":[],"class_list":["post-18325","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ethereum"],"_links":{"self":[{"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/posts\/18325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/comments?post=18325"}],"version-history":[{"count":0,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/posts\/18325\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/media\/18222"}],"wp:attachment":[{"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/media?parent=18325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/categories?post=18325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/tags?post=18325"},{"taxonomy":"kronos_expire_date","embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/kronos_expire_date?post=18325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}