(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Wolfram 15.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       154,          7]
NotebookDataLength[     49180,       1289]
NotebookOptionsPosition[     39333,       1109]
NotebookOutlinePosition[     41764,       1163]
CellTagsIndexPosition[     41686,       1158]
WindowTitle->SegWitAddressDecode
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[GridBox[{
   {GridBox[{
      {
       ItemBox[Cell[BoxData[
         RowBox[{
          TemplateBox[{12},
           "Spacer1"], Cell[
          "WOLFRAM INSTITUTE/ PUZZLES SYMBOL", "PacletNameCell",
           TextAlignment->Center,ExpressionUUID->
           "dd4ddc17-bb7e-4578-a972-a1ce07f998c5"], 
          TemplateBox[{8},
           "Spacer1"]}]],
         TextAlignment->Center,ExpressionUUID->
         "42f45c6d-43a3-4978-8c0d-b3a119c8b158"],
        Background->LightDarkSwitched[
          RGBColor[0.490196, 0.576471, 0.690196]],
        ItemSize->Full], ""}
     },
     GridBoxAlignment->{"Rows" -> {{Center}}},
     GridBoxItemSize->{"Columns" -> {Full, 
         Scaled[0.02]}, "Rows" -> {{2.5}}}], Cell[TextData[{
     Cell[BoxData[
      TagBox[
       ActionMenuBox[
        FrameBox[Cell[TextData[{
          "See Also",
          " ",
          Cell[BoxData[
           GraphicsBox[
            {GrayLevel[0.66667], Thickness[0.13], 
             LineBox[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]},
            AspectRatio->1,
            ImageSize->20,
            PlotRange->{{-3, 4}, {-1, 1}}]],ExpressionUUID->
           "bc834fe9-bde4-45ec-b922-5232d3187a8a"]
         }],ExpressionUUID->"4912dc19-ef75-45e7-ac9d-85080d5d1594"],
         StripOnInput->False],{
        StyleBox[
          "\"SegWitAddressEncode\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/SegWitAddressEncode"], 
         StyleBox[
          "\"SegWitAddressQ\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/SegWitAddressQ"], 
         StyleBox[
          "\"Bech32Decode\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/Bech32Decode"], 
         StyleBox["\"BitRegroup\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/BitRegroup"], 
         StyleBox[
          "\"Base58CheckDecode\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/Base58CheckDecode"]},
        Appearance->None,
        MenuAppearance->Automatic,
        MenuStyle->"SeeAlso"],
       MouseAppearanceTag["LinkHand"]]],
      LineSpacing->{1.4, 0},ExpressionUUID->
      "d9782a6d-b39b-4cc0-b3c3-addec05353a7"],
     "\[ThickSpace]\[ThickSpace]\[ThickSpace]\[ThickSpace]\[ThickSpace]\
\[ThickSpace]",
     Cell[BoxData[
      TagBox[
       ActionMenuBox[
        FrameBox[Cell[TextData[{
          "Related Guides",
          " ",
          Cell[BoxData[
           GraphicsBox[
            {GrayLevel[0.66667], Thickness[0.13], 
             LineBox[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]},
            AspectRatio->1,
            ImageSize->20,
            PlotRange->{{-3, 4}, {-1, 1}}]],ExpressionUUID->
           "d1bb0c9b-4913-40dd-8d0a-8cfb86b969aa"]
         }],ExpressionUUID->"e3c791b0-55df-432f-9307-37e21201e22b"],
         StripOnInput->False],{
        "\"Encodings\"" :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/guide/Encodings"]},
        Appearance->None,
        MenuAppearance->Automatic,
        MenuStyle->"MoreAbout"],
       MouseAppearanceTag["LinkHand"]]],
      LineSpacing->{1.4, 0},ExpressionUUID->
      "23f6b1cf-b1c4-4c31-afaf-84d328bae4de"],
     "\[ThickSpace]\[ThickSpace]\[ThickSpace]\[ThickSpace]\[ThickSpace]\
\[ThickSpace]",
     Cell[BoxData[
      TagBox[
       ActionMenuBox[
        FrameBox[Cell[TextData[{
          "URL",
          " ",
          Cell[BoxData[
           GraphicsBox[
            {GrayLevel[0.66667], Thickness[0.13], 
             LineBox[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]},
            AspectRatio->1,
            ImageSize->20,
            PlotRange->{{-3, 4}, {-1, 1}}]],ExpressionUUID->
           "9a4be0a1-37d3-445a-92fa-39abd91306ea"]
         }],ExpressionUUID->"563dfa65-d79f-4808-af12-50270d93a2a1"],
         StripOnInput->False],{
        "\"WolframInstitute/Puzzles/ref/SegWitAddressDecode\"" :> None, 
         "\"Copy Wolfram Documentation Center URL\"" :> 
         CopyToClipboard["WolframInstitute/Puzzles/ref/SegWitAddressDecode"], 
         Delimiter, "\"Copy web URL\"" :> 
         Module[{DocumentationSearch`Private`nb$}, 
           DocumentationSearch`Private`nb$ = 
            NotebookPut[
             Notebook[{
               Cell[BoxData[
                 MakeBoxes[
                  Hyperlink[
                   "http://reference.wolfram.com/language/WolframInstitute/\
Puzzles/ref/SegWitAddressDecode.html"], StandardForm]], "Input", 
                 TextClipboardType -> "PlainText"]}, Visible -> False]]; 
           SelectionMove[DocumentationSearch`Private`nb$, All, Notebook]; 
           FrontEndTokenExecute[DocumentationSearch`Private`nb$, "Copy"]; 
           NotebookClose[DocumentationSearch`Private`nb$]; Null], 
         "\"Go to web URL\"" :> 
         FrontEndExecute[{
           NotebookLocate[{
             URL[If[TrueQ[False], 
                 "http://reference.wolfram.com/system-modeler/", 
                 "http://reference.wolfram.com/language/"] <> 
               "WolframInstitute/Puzzles/ref/SegWitAddressDecode" <> ".html"],
               None}]}]},
        Appearance->None,
        MenuAppearance->Automatic,
        MenuStyle->"URLMenu"],
       MouseAppearanceTag["LinkHand"]]],
      LineSpacing->{1.4, 0},ExpressionUUID->
      "8518ee02-41e6-423e-a93f-cc534f207d89"]
    }], "AnchorBar",
     CacheGraphics->False,ExpressionUUID->
     "a3b1f60e-0504-4df2-9101-c3abe205e961"]}
  }]], "AnchorBarGrid",
 CellID->1,ExpressionUUID->"4f16de8f-1f2d-4156-9f69-70a9cfb83767"],

Cell["WolframInstitute`Puzzles`", "ContextNameCell",ExpressionUUID->"0bb08433-b97d-4d75-bcf7-78e2d1719fed"],

Cell[CellGroupData[{

Cell[BoxData[GridBox[{
   {Cell[TextData[{
     Cell[
     "SegWitAddressDecode", "ObjectName",ExpressionUUID->
      "1f8c09da-4c7e-4066-afef-65dbab13e419"],
     Cell[BoxData[
      TemplateBox[{8},
       "Spacer1"]],ExpressionUUID->"56637096-1169-4166-8e6b-f30ba4c1f829"],
     Cell[BoxData[
     ""], "ObjectNameTranslation",ExpressionUUID->
      "31f27177-e9cb-4ffd-a68f-e9b32a6a5d15"]
    }],ExpressionUUID->"ea2c1c0f-93aa-428c-9732-c45ffbe90154"], 
    "\[SpanFromLeft]"}
  }]], "ObjectNameGrid",ExpressionUUID->"2f67f348-dba6-4f26-b8f8-\
b31b90fd00d8"],

Cell[BoxData[GridBox[{
   {"", Cell[TextData[{
     Cell[BoxData[
      RowBox[{
       TemplateBox[{
         Cell[
          TextData["SegWitAddressDecode"]], 
         "paclet:WolframInstitute/Puzzles/ref/SegWitAddressDecode", 
         "WolframInstitute/Puzzles Package Symbol"},
        "PackageLink",
        BaseStyle->"InlineFormula"], "[", 
       StyleBox["address", "TI"], "]"}]], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "52da7e80-eb7d-4872-a41f-1f28e4619315"],
     "\[LineSeparator]",
     "gives an ",
     Cell[BoxData[
      TemplateBox[{
        Cell[
         TextData["Association"]], "paclet:ref/Association"},
       "RefLink",
       BaseStyle->"InlineFormula"]], "InlineFormula",
      FontFamily->"Source Sans Pro",ExpressionUUID->
      "add6bdbf-02e2-42ce-a45c-a7a00efa007e"],
     " with keys ",
     Cell[BoxData["\"\<HumanReadablePart\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "63294031-5f83-4129-a13d-79859703b454"],
     ", ",
     Cell[BoxData["\"\<WitnessVersion\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "8d446f6d-1534-400f-9cbe-50a5260f8d58"],
     ", ",
     Cell[BoxData["\"\<WitnessProgram\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "723af12e-6ba5-4dc8-a779-1bd9ed4487f2"],
     " and ",
     Cell[BoxData["\"\<ScriptPubKey\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "39432ad5-5aa5-4cc5-beab-58e61c3f5745"],
     " for a valid native segregated witness address, and a ",
     Cell[BoxData[
      TemplateBox[{
        Cell[
         TextData["Failure"]], "paclet:ref/Failure"},
       "RefLink",
       BaseStyle->"InlineFormula"]], "InlineFormula",
      FontFamily->"Source Sans Pro",ExpressionUUID->
      "3d539fbe-bec9-4f0d-a9bb-7b621564e23f"],
     " otherwise."
    }],ExpressionUUID->"38a15f67-6ca6-4ceb-97cd-e194008a4d8c"]},
   {"", Cell[TextData[{
     Cell[BoxData[
      RowBox[{
       TemplateBox[{
         Cell[
          TextData["SegWitAddressDecode"]], 
         "paclet:WolframInstitute/Puzzles/ref/SegWitAddressDecode", 
         "WolframInstitute/Puzzles Package Symbol"},
        "PackageLink",
        BaseStyle->"InlineFormula"], "[", 
       RowBox[{
        StyleBox["hrp", "TI"], ",", " ", 
        StyleBox["address", "TI"]}], "]"}]], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "3b184629-cc1e-4782-8b23-e23f23edc4de"],
     "\[LineSeparator]",
     "additionally requires the address to carry the human-readable part ",
     StyleBox["hrp", "TI"],
     ", giving a ",
     Cell[BoxData[
      TemplateBox[{
        Cell[
         TextData["Failure"]], "paclet:ref/Failure"},
       "RefLink",
       BaseStyle->"InlineFormula"]], "InlineFormula",
      FontFamily->"Source Sans Pro",ExpressionUUID->
      "d0e0b82e-83ca-42fc-92a4-fa024b576eec"],
     " if it does not."
    }],ExpressionUUID->"230de89a-e655-421d-81f2-6e653a45676c"]}
  }]], "Usage",ExpressionUUID->"ab026c83-78c2-4c63-a538-6fabbb455769"]
}, Open  ]],

Cell[CellGroupData[{

Cell[TextData[Cell[BoxData[Cell[TextData[{
  Cell[BoxData[
   DynamicBox[ToBoxes[
     If[CurrentValue[
        EvaluationCell[], "CellGroupOpen"] =!= Closed, 
      Style[
       Graphics[{
         Thickness[0.18], 
         RGBColor[0.8509803921568627, 0.396078431372549, 0], 
         Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
        PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
       0.68 Inherited], 
      Rotate[
       Style[
        Graphics[{
          Thickness[0.18], 
          RGBColor[0.8509803921568627, 0.396078431372549, 0], 
          Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
         PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
        0.68 Inherited], Rational[1, 2] Pi, {-1.65, -1}]]],
    ImageSizeCache->{
     13.600000000000001`, {-0.1685058593749993, 13.768505859375}}]],
   ExpressionUUID->"03e04041-c458-43ba-96d0-a5e12adb813f"],
  Cell[BoxData[
   TemplateBox[{1},
    "Spacer1"]],ExpressionUUID->"b33474c5-b3f7-4b0c-a103-b899909f7bc9"],
  "Details and Options"
 }], "NotesFrameText",ExpressionUUID->
  "27fa19f1-c5c5-4ba3-97f4-981552ca3c8e"]],ExpressionUUID->"37e6e6e0-56e3-\
4ef9-a8c2-4e6c8dcc81e7"]], "NotesSection",
 ShowGroupOpener->"Thumbnail",
 WholeCellGroupOpener->True,
 CellGroupingRules->{"SectionGrouping", 50},
 CacheGraphics->False,
 CellID->1476097411,ExpressionUUID->"8dc84f5e-3076-4bdd-99c6-8ca515ee998e"],

Cell[TextData[{
 Cell[BoxData["\<\"WitnessProgram\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "b7edf082-88af-481d-9669-fcd714e0c504"],
 " is the program as a byte list, and ",
 Cell[BoxData["\<\"ScriptPubKey\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "6ffa75c2-07f9-4d7f-9c4b-d2b9aab97156"],
 " is the output script it funds: the version opcode, then the program \
length, then the program."
}], "Notes",ExpressionUUID->"47bed8d2-fa1c-4e09-867f-204a24c5cd2c"],

Cell[TextData[{
 "The version opcode is ",
 Cell[BoxData[
  RowBox[{"0", "x00"}]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "aca66fbf-eeb3-4b1d-b232-271221668260"],
 " at witness version 0 and ",
 Cell[BoxData[
  RowBox[{
   RowBox[{"0", "x50"}], " ", "+", " ", "version"}]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "61bef486-b6d4-4ec9-adde-424c348fec18"],
 " above it, so version 1 gives ",
 Cell[BoxData[
  RowBox[{"0", "x51"}]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "f2e54922-ff16-49b4-a462-89daeab0a979"],
 " and version 16 gives ",
 Cell[BoxData[
  RowBox[{"0", "x60"}]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "f9fc9981-d20e-49f0-b10a-406abe9a55c2"],
 "."
}], "Notes",ExpressionUUID->"afa19ac1-42a8-45d5-b5d4-71912c153f3b"],

Cell["\<\
Every BIP350 rule is enforced: the Bech32 or Bech32m string must be valid, \
the data part non-empty, the witness version 0 to 16, the 5-bit to 8-bit \
regrouping must leave fewer than five zero padding bits, the program 2 to 40 \
bytes and exactly 20 or 32 bytes at version 0, and the checksum variant must \
be Bech32 at version 0 and Bech32m above it.\
\>", "Notes",ExpressionUUID->"35a0a42f-1f77-4e3b-b2de-87130bde38e5"],

Cell[TextData[{
 "Any of those failing gives a ",
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["Failure"]], "paclet:ref/Failure"},
   "RefLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",ExpressionUUID->
  "254f5304-286a-4e9c-a0aa-363d9af3e7b3"],
 ", since the string is a plausible address and the attempt engaged."
}], "Notes",ExpressionUUID->"00f7976b-15e7-42a0-97fd-d6ffe1f1d96e"],

Cell[TextData[{
 "The one-argument form accepts any human-readable part. Use the two-argument \
form to require ",
 Cell[BoxData["\<\"bc\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "e546183d-83af-41e2-8aa4-e47e9291cd69"],
 " or ",
 Cell[BoxData["\<\"tb\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "349e5d5a-00f8-42cd-aad1-e7f676eb219b"],
 ", which is what a wallet checking network does."
}], "Notes",ExpressionUUID->"aa9c47d5-4d43-4b9a-af3a-bc8b26fd1bf9"],

Cell[TextData[{
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["SegWitAddressQ"]], 
    "paclet:WolframInstitute/Puzzles/ref/SegWitAddressQ", 
    "WolframInstitute/Puzzles Package Symbol"},
   "PackageLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "51b4d5d3-92e5-44bc-8c27-cc337b256e9b"],
 " gives the same verdict as a boolean."
}], "Notes",ExpressionUUID->"5d5cc35c-1722-4e34-9454-b7f861095256"]
}, Closed]],

Cell["", "PageDelimiter",ExpressionUUID->"73a0d500-9a43-497d-9ffc-0bfd53e39fc6"],

Cell[CellGroupData[{

Cell[TextData[{
 Cell[BoxData[
  DynamicBox[ToBoxes[
    If[
     MatchQ[
      CurrentValue[
       EvaluationNotebook[], {
       TaggingRules, "Openers", "PrimaryExamplesSection"}, Open], 
      Alternatives[True, Open]], 
     Style[
      Graphics[{
        Thickness[0.18], 
        RGBColor[0.8509803921568627, 0.396078431372549, 0], 
        Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
       PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
      0.68 Inherited], 
     Rotate[
      Style[
       Graphics[{
         Thickness[0.18], 
         RGBColor[0.8509803921568627, 0.396078431372549, 0], 
         Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
        PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
       0.68 Inherited], Rational[1, 2] Pi, {-1.65, -1}]]],
   ImageSizeCache->{
    13.600000000000001`, {4.251494140625001, 9.348505859375}}]],
  ExpressionUUID->"d3beaff9-c37f-4e75-bf6e-684e51c76f86"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"7af1f5a2-c14b-4f80-aedc-7fcd649bbbef"],
 "Examples",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(12)", "ExampleCount",ExpressionUUID->
  "09d849fb-8563-4b00-b5e2-75f5a63c747e"]
}], "PrimaryExamplesSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1038096533,ExpressionUUID->"865e634d-13e2-42cc-9694-425f3dfb6ad1"],

Cell[BoxData[
 RowBox[{"Needs", "[", "\"\<WolframInstitute`Puzzles`\>\"", "]"}]], "Input", \
"ExampleInitialization",
 CellLabel->"In[1]:=",
 CellID->1969679695,ExpressionUUID->"3e532b20-6c0e-4e48-91c4-25857b030a80"],

Cell[CellGroupData[{

Cell[TextData[{
 Cell[BoxData[
  DynamicBox[ToBoxes[
    If[CurrentValue[
       EvaluationCell[], "CellGroupOpen"] =!= Closed, 
     Style[
      Graphics[{
        Thickness[0.18], 
        RGBColor[0.8509803921568627, 0.396078431372549, 0], 
        Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
       PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
      0.68 Inherited], 
     Rotate[
      Style[
       Graphics[{
         Thickness[0.18], 
         RGBColor[0.8509803921568627, 0.396078431372549, 0], 
         Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
        PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
       0.68 Inherited], Rational[1, 2] Pi, {-1.65, -1}]]]]],ExpressionUUID->
  "d78ec0c1-d908-4495-8373-bd2634179964"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"f85da197-720f-4b02-8c3e-fbfd53f7aff0"],
 "Basic Examples",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(3)", "ExampleCount",ExpressionUUID->
  "aad91f06-e1bb-4114-b698-acfabc1d0ce8"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1131281903,ExpressionUUID->"138a6575-9c7a-4b50-bcbe-2eb95aa48a4d"],

Cell["The BIP350 vector for a version 0 20-byte program:", "ExampleText",
 CellTags->
  "TextAnnotation",ExpressionUUID->"1894cb87-b107-4810-be6b-fa3a1bee382a"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Normal", "[", 
  RowBox[{
  "SegWitAddressDecode", 
   "[", "\"\<BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4\>\"", "]"}], 
  "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"93d9c900-aa72-4595-be83-19273bcd736e"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"\<\"HumanReadablePart\"\>", "\[Rule]", "\<\"bc\"\>"}], ",", 
   RowBox[{"\<\"WitnessVersion\"\>", "\[Rule]", "0"}], ",", 
   RowBox[{"\<\"WitnessProgram\"\>", "\[Rule]", 
    RowBox[{"{", 
     RowBox[{
     "117", ",", "30", ",", "118", ",", "232", ",", "25", ",", "145", ",", 
      "150", ",", "212", ",", "84", ",", "148", ",", "28", ",", "69", ",", 
      "209", ",", "179", ",", "163", ",", "35", ",", "241", ",", "67", ",", 
      "59", ",", "214"}], "}"}]}], ",", 
   RowBox[{"\<\"ScriptPubKey\"\>", "\[Rule]", 
    RowBox[{"{", 
     RowBox[{
     "0", ",", "20", ",", "117", ",", "30", ",", "118", ",", "232", ",", "25",
       ",", "145", ",", "150", ",", "212", ",", "84", ",", "148", ",", "28", ",",
       "69", ",", "209", ",", "179", ",", "163", ",", "35", ",", "241", ",", 
      "67", ",", "59", ",", "214"}], "}"}]}]}], "}"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"a8cb9bbe-a33e-49af-bbb7-ab379fa80858"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "71ca431b-ba01-4b9f-8a01-e8e2528d1a10"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"465d1372-11fe-4923-\
bea2-eaf8e4ff9caa"],

Cell[TextData[{
 "The published scriptPubKey for that vector is ",
 Cell[BoxData[
  RowBox[{"0014751", "e76e8199196d454941c45d1b3a323f1433bd6"}]], 
  "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "1922f005-909a-44c7-9672-fca2570e50fb"],
 ":"
}], "ExampleText",ExpressionUUID->"eecda52c-f607-4420-96db-4a1a9c631c8b"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"ByteListToHexString", "[", 
  RowBox[{
   RowBox[{
   "SegWitAddressDecode", 
    "[", "\"\<BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4\>\"", "]"}], 
   "[", "\"\<ScriptPubKey\>\"", "]"}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"927aa62e-56fe-4277-8309-7efc6120c56e"],

Cell[BoxData["\<\"0014751e76e8199196d454941c45d1b3a323f1433bd6\"\>"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"c381e184-857b-46f3-8ade-2ff8140a2d45"]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "c57d2899-b3ad-4efe-a83b-01178beca268"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"b05f8856-a45d-406f-\
82f8-ee1ce35991a7"],

Cell["A Taproot address decodes at witness version 1:", "ExampleText",ExpressionUUID->"462a04f2-e402-4b3e-9672-0f7a94597896"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{
  "SegWitAddressDecode", 
   "[", "\"\<bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqzk5jj0\>\
\"", "]"}], "[", "\"\<WitnessVersion\>\"", "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"c2f35354-2c5c-45f2-b015-6e5b92fdeaa9"],

Cell[BoxData["1"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"20bcf945-3389-45b3-b57c-64b9589db556"]
}, Open  ]]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell[TextData[{
 Cell[BoxData[
  DynamicBox[ToBoxes[
    If[CurrentValue[
       EvaluationCell[], "CellGroupOpen"] =!= Closed, 
     Style[
      Graphics[{
        Thickness[0.18], 
        RGBColor[0.8509803921568627, 0.396078431372549, 0], 
        Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
       PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
      0.68 Inherited], 
     Rotate[
      Style[
       Graphics[{
         Thickness[0.18], 
         RGBColor[0.8509803921568627, 0.396078431372549, 0], 
         Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
        PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
       0.68 Inherited], Rational[1, 2] Pi, {-1.65, -1}]]]]],ExpressionUUID->
  "ae939579-a0a8-4542-9a94-29239d5f5527"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"30ca0cbf-3102-4a57-9755-726ea340ccaa"],
 "Scope",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(4)", "ExampleCount",ExpressionUUID->
  "3ae6b6a3-c76f-4626-a4a6-690462d26480"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1293636265,ExpressionUUID->"b8ca87c5-6245-4e81-b700-26baf50e1a88"],

Cell[TextData[{
 "The version opcode of a Taproot output is ",
 Cell[BoxData[
  RowBox[{"0", "x51"}]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "8cede5bc-1ca5-4495-8636-fe287d8ad1d7"],
 ", so its scriptPubKey begins ",
 Cell[BoxData["5120"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "fb73d467-c286-45d1-93e6-258b87708ea9"],
 ":"
}], "ExampleText",ExpressionUUID->"7838c166-2494-4988-bc50-6706c2bdded2"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"ByteListToHexString", "[", 
  RowBox[{
   RowBox[{
   "SegWitAddressDecode", 
    "[", "\"\<bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqzk5jj0\>\
\"", "]"}], "[", "\"\<ScriptPubKey\>\"", "]"}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"08be8d23-5577-4488-8172-0cdb479ae36f"],

Cell[BoxData["\<\"\
512079be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\"\>"], \
"Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"8530f987-ddf4-4935-983d-92b13c73fbe5"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "0525e03a-d230-4c93-aab8-68d00d37fc49"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"7e470290-2058-40b8-\
a6ff-d295b157928c"],

Cell[TextData[{
 "The BIP350 vector at witness version 16 with a two-byte program gives the \
opcode ",
 Cell[BoxData[
  RowBox[{"0", "x60"}]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "627742f7-724c-4a2e-bff8-219adb6bc459"],
 ":"
}], "ExampleText",ExpressionUUID->"385c916d-4925-4f27-a6fe-ebd95bcfc1b8"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"ByteListToHexString", "[", 
  RowBox[{
   RowBox[{"SegWitAddressDecode", "[", "\"\<BC1SW50QGDZ25J\>\"", "]"}], 
   "[", "\"\<ScriptPubKey\>\"", "]"}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"882d2ed6-a862-4403-8dd4-2d7ff233c8a7"],

Cell[BoxData["\<\"6002751e\"\>"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"1e625f3b-3cfc-4432-974a-5c6524014449"]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "8d4f0652-2a7b-4054-b286-90d6ab646542"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"6f0bd2cd-a13f-4388-\
8848-3950546ea1ef"],

Cell[TextData[{
 "A testnet address carries the ",
 Cell[BoxData["\<\"tb\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "80364185-9fca-499f-94e7-37b0efd90d8b"],
 " human-readable part:"
}], "ExampleText",ExpressionUUID->"bdb54ebd-fff5-423f-8c04-5d0344ecb16a"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{
  "SegWitAddressDecode", 
   "[", "\"\<tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7\>\
\"", "]"}], "[", "\"\<HumanReadablePart\>\"", "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"acfac641-1a03-475b-a11d-9d79ca31c162"],

Cell[BoxData["\<\"tb\"\>"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"8c16c97e-1333-40bc-a7b5-555ed3199f0e"]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "3998ce7f-6794-4f03-ba4e-fd2000daea79"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"844cbc00-6163-48a5-\
9a1b-c43bf8b0f59b"],

Cell["The two-argument form is how a caller requires a network:", \
"ExampleText",ExpressionUUID->"b7771a22-e4e3-4391-86e7-fa1e1f6a9761"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"FailureQ", "[", 
  RowBox[{"SegWitAddressDecode", "[", 
   RowBox[{"\"\<tb\>\"", ",", 
    " ", "\"\<BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4\>\""}], "]"}], 
  "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"d987ac74-890d-4068-bc89-f13323260a23"],

Cell[BoxData["True"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"b602e237-164b-46b5-baf2-6693d5bf1d76"]
}, Open  ]]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{

Cell[TextData[{
 Cell[BoxData[
  DynamicBox[ToBoxes[
    If[CurrentValue[
       EvaluationCell[], "CellGroupOpen"] =!= Closed, 
     Style[
      Graphics[{
        Thickness[0.18], 
        RGBColor[0.8509803921568627, 0.396078431372549, 0], 
        Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
       PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
      0.68 Inherited], 
     Rotate[
      Style[
       Graphics[{
         Thickness[0.18], 
         RGBColor[0.8509803921568627, 0.396078431372549, 0], 
         Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
        PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
       0.68 Inherited], Rational[1, 2] Pi, {-1.65, -1}]]]]],ExpressionUUID->
  "aa644612-dd8e-4a56-92d7-43eef8440b7c"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"1b249f17-bc93-4c8c-aeb2-f7c9427d5289"],
 "Properties & Relations",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(2)", "ExampleCount",ExpressionUUID->
  "9cd141b2-aa83-4729-b24a-9812e4b860ab"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->2123667759,ExpressionUUID->"6180e49e-49ee-4edb-8493-8cb6a1224fe2"],

Cell["Re-encoding a decoded address reproduces it, in lower case:", \
"ExampleText",ExpressionUUID->"dbae169a-dd2b-42f4-a5e5-8a29ccf33aca"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"With", "[", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{"decoded", " ", "=", " ", 
     RowBox[{"SegWitAddressDecode", "[", "\"\<BC1SW50QGDZ25J\>\"", "]"}]}], 
    "}"}], ",", " ", 
   RowBox[{"SegWitAddressEncode", "[", 
    RowBox[{
     RowBox[{"decoded", "[", "\"\<HumanReadablePart\>\"", "]"}], ",", " ", 
     RowBox[{"decoded", "[", "\"\<WitnessVersion\>\"", "]"}], ",", " ", 
     RowBox[{"decoded", "[", "\"\<WitnessProgram\>\"", "]"}]}], "]"}]}], 
  "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"f95a45e7-1509-4678-a28c-a7497c75e591"],

Cell[BoxData["\<\"bc1sw50qgdz25j\"\>"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"48ae686b-a1a8-468d-a2b8-30c9ae5a813d"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "dd492702-c323-4416-94af-8c5b0cdad3be"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"9f40633f-f30b-4b6e-\
af92-7ba69f0618f5"],

Cell[TextData[{
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["Bech32Decode"]], 
    "paclet:WolframInstitute/Puzzles/ref/Bech32Decode", 
    "WolframInstitute/Puzzles Package Symbol"},
   "PackageLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "acc827c3-32f0-4de2-8eaf-816e49650dc3"],
 " sees the same string one layer down, as a human-readable part and 5-bit \
values:"
}], "ExampleText",ExpressionUUID->"9e3b4ceb-0e38-48c6-b1da-80ad483974e8"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"Bech32Decode", "[", "\"\<BC1SW50QGDZ25J\>\"", "]"}], 
  "[", "\"\<Data\>\"", "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"c8a03dcc-3950-47eb-9f2b-20d44fc9569f"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"16", ",", "14", ",", "20", ",", "15", ",", "0"}], "}"}]], "Output",\

 CellLabel->"Out[1]= ",ExpressionUUID->"26f76ab7-b5a3-47cc-b301-9691fa6ae790"]
}, Open  ]]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{

Cell[TextData[{
 Cell[BoxData[
  DynamicBox[ToBoxes[
    If[CurrentValue[
       EvaluationCell[], "CellGroupOpen"] =!= Closed, 
     Style[
      Graphics[{
        Thickness[0.18], 
        RGBColor[0.8509803921568627, 0.396078431372549, 0], 
        Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
       PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
      0.68 Inherited], 
     Rotate[
      Style[
       Graphics[{
         Thickness[0.18], 
         RGBColor[0.8509803921568627, 0.396078431372549, 0], 
         Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
        PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
       0.68 Inherited], Rational[1, 2] Pi, {-1.65, -1}]]]]],ExpressionUUID->
  "18067e26-2b70-4274-be85-8576273a296b"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"68272825-e404-4c6d-802d-f7c2f15553de"],
 "Possible Issues",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(3)", "ExampleCount",ExpressionUUID->
  "eb1814c7-38c1-4c89-b944-50069a04cdf9"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1305812373,ExpressionUUID->"dee8c950-ba9e-470a-bfd3-71f220df4fcc"],

Cell[TextData[{
 "BIP350 replaced the BIP173 version 1 and above vectors, so the old \
Bech32-checksummed forms are now ",
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["Failure"]], "paclet:ref/Failure"},
   "RefLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",ExpressionUUID->
  "9e8582ba-914c-41ef-b6e4-802c2ba7fea5"],
 "s:"
}], "ExampleText",ExpressionUUID->"e483b491-f499-4cbf-ab01-2f710352d004"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"FailureQ", "[", 
  RowBox[{"SegWitAddressDecode", "[", 
   RowBox[{"\"\<bc\>\"", ",", 
    " ", "\"\<\
bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k7grplx\>\"\
"}], "]"}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"42ca60bb-38c4-4bc5-99f0-2ef518eac5df"],

Cell[BoxData["True"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"deab7916-bd1b-4d84-ba3b-70e3d9f02f38"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "cd00dabe-bf4b-4c73-b35d-f79f156b4cef"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"d04a5413-770d-4e45-\
bfb1-80857c2da905"],

Cell["A version 0 address with a 16-byte program violates BIP141:", \
"ExampleText",ExpressionUUID->"6b4c30d4-59ec-470e-ae4f-1b5346ee7389"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"FailureQ", "[", 
  RowBox[{"SegWitAddressDecode", "[", 
   RowBox[{"\"\<bc\>\"", ",", 
    " ", "\"\<BC1QR508D6QEJXTDG4Y5R3ZARVARYV98GJ9P\>\""}], "]"}], 
  "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"fda24fb5-1d24-41b1-bac8-24fcb9567576"],

Cell[BoxData["True"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"fc494c8d-2645-462e-bd0e-beb39cf3e15a"]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "78e43580-d3dc-47c8-8f56-b09ba8b7a60a"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"80432042-3722-472a-\
9ed0-62d8a97fe5bd"],

Cell[TextData[{
 "The BIP350 vector beginning ",
 Cell[BoxData["\<\"tc1\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "1caa4765-3d96-4d5e-a56e-49f24f5719ec"],
 " is a valid Bech32m string over a human-readable part no Bitcoin network \
uses, so only the two-argument form rejects it:"
}], "ExampleText",ExpressionUUID->"a18eded2-a22b-45aa-9126-6cb838d52910"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"FailureQ", "[", 
    RowBox[{
    "SegWitAddressDecode", 
     "[", "\"\<tc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vq5zuyut\
\>\"", "]"}], "]"}], ",", " ", 
   RowBox[{"FailureQ", "[", 
    RowBox[{"SegWitAddressDecode", "[", 
     RowBox[{"\"\<bc\>\"", ",", 
      " ", "\"\<\
tc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vq5zuyut\>\""}], "]"}], 
    "]"}]}], "}"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"786470d5-1c76-4a02-b6a7-ed8cb368389b"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"False", ",", "True"}], "}"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"9ec9d424-ca04-45fb-b158-40133487d3b4"]
}, Open  ]]
}, Open  ]]
}, Closed]]
}, Open  ]],

Cell[BoxData[GridBox[{
   {
    DynamicBox[FEPrivate`ImportImage[
      FrontEnd`FileName[{"Documentation", "FooterIcons"}, 
       "RelatedFunction.png"]]], GridBox[{
      {
       StyleBox[
        RowBox[{"See", " ", "Also"}], "SeeAlsoSection"]},
      {Cell[TextData[{
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["SegWitAddressEncode"]], 
           "paclet:WolframInstitute/Puzzles/ref/SegWitAddressEncode", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "92aa6edf-f6a8-41c4-835d-cdea317bcaf4"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["SegWitAddressQ"]], 
           "paclet:WolframInstitute/Puzzles/ref/SegWitAddressQ", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "cb0972bc-9cb7-4b95-8c67-2572bd6876bd"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["Bech32Decode"]], 
           "paclet:WolframInstitute/Puzzles/ref/Bech32Decode", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "1a881c5e-8218-4887-89ce-ff5de5750c47"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["BitRegroup"]], 
           "paclet:WolframInstitute/Puzzles/ref/BitRegroup", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "6cb8fbc4-22c6-4240-a15b-365b08c22744"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["Base58CheckDecode"]], 
           "paclet:WolframInstitute/Puzzles/ref/Base58CheckDecode", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "20e7cf30-90fd-41cc-a694-a9aa55040d36"]
       }], "SeeAlso",ExpressionUUID->"0f5d78f9-121d-447a-98b5-1dd0226f7c8e"]}
     }]}
  }]], "SeeAlsoSection",ExpressionUUID->"647f894d-f31a-4781-ad02-\
1edb75b9b54b"],

Cell[BoxData[GridBox[{
   {
    DynamicBox[FEPrivate`ImportImage[
      FrontEnd`FileName[{"Documentation", "FooterIcons"}, 
       "RelatedGuide.png"]]], GridBox[{
      {
       StyleBox[
        RowBox[{"Related", " ", "Guides"}], "MoreAboutSection"]},
      {
       RowBox[{"\[FilledVerySmallSquare]", Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["Encodings"]], 
           "paclet:WolframInstitute/Puzzles/guide/Encodings"},
          "RefLinkPlain",
          BaseStyle->{"MoreAbout"}]], "MoreAbout",ExpressionUUID->
         "d3b604e8-c4a9-406f-8437-b3c88936eaa9"]}]}
     }]}
  }]], "MoreAboutSection",ExpressionUUID->"db9d9278-aec1-49d3-9efd-\
f6e15fb3f121"],

Cell[" ", "FooterCell",ExpressionUUID->"1a69ab2a-109f-445e-852a-fb6b64c3f60f"]
},
Saveable->False,
ScreenStyleEnvironment->"Working",
WindowSize->{900, 830},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
WindowTitle->"SegWitAddressDecode",
TaggingRules->{
 "ModificationHighlight" -> False, "ColorType" -> "", "LinkTrails" -> "", 
  "ExampleCounter" -> 1, 
  "Openers" -> {
   "PrimaryExamplesSection" -> Open, "ExampleSection" -> {"0" -> Open}, 
    "AllOptsTable" -> Closed}, "NewStyles" -> True, 
  "CitationPopupData" -> $Failed, "ShowCitation" -> False, "HasOptions" -> 
  True, "RootCaptions" -> "", "HeaderCoreAreaLink" -> {}, 
  "Metadata" -> {
   "built" -> "{2026, 8, 27, 0, 11, 48.930082}", 
    "history" -> {"XX", "", "", ""}, "context" -> "WolframInstitute`Puzzles`",
     "keywords" -> {}, "specialkeywords" -> {}, 
    "tutorialcollectionlinks" -> {}, "index" -> True, "label" -> 
    "Wolfram Institute/ Puzzles Symbol", "language" -> "en", "paclet" -> 
    "WolframInstitute/Puzzles", "status" -> "None", "summary" -> 
    "PackageLink[SegWitAddressDecode, paclet : \
WolframInstitute/Puzzles/ref/SegWitAddressDecode, WolframInstitute/Puzzles \
Package Symbol][address] gives an Association with keys HumanReadablePart, \
WitnessVersion, WitnessProgram and ScriptPubKey for a valid native segregated \
witness address, and a Failure otherwise. PackageLink[SegWitAddressDecode, \
paclet : WolframInstitute/Puzzles/ref/SegWitAddressDecode, \
WolframInstitute/Puzzles Package Symbol][hrp, address] additionally requires \
the address to carry the human-readable part hrp, giving a Failure if it does \
not.", "synonyms" -> {}, "tabletags" -> {}, "title" -> "SegWitAddressDecode", 
    "titlemodifier" -> "", "metadescription" -> "", "windowtitle" -> 
    "SegWitAddressDecode", "type" -> "Symbol", "uri" -> 
    "WolframInstitute/Puzzles/ref/SegWitAddressDecode", "WorkflowDockedCell" -> 
    ""}, "SearchTextTranslated" -> ""},
CellContext->CellGroup,
FrontEndVersion->"15.0 for Mac OS X ARM (64-bit) (May 19, 2026)",
StyleDefinitions->FrontEnd`FileName[{"Wolfram"}, "Reference.nb"],
ExpressionUUID->"50c16318-db3e-4933-8fc7-a77c84a7e4aa"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{
 "TextAnnotation"->{
  Cell[18373, 491, 160, 2, 70, "ExampleText",ExpressionUUID->"1894cb87-b107-4810-be6b-fa3a1bee382a",
   CellTags->"TextAnnotation"]}
 }
*)
(*CellTagsIndex
CellTagsIndex->{
 {"TextAnnotation", 41529, 1152}
 }
*)
(*NotebookFileOutline
Notebook[{
Cell[587, 21, 5831, 142, 70, "AnchorBarGrid",ExpressionUUID->"4f16de8f-1f2d-4156-9f69-70a9cfb83767",
 CellID->1],
Cell[6421, 165, 107, 0, 70, "ContextNameCell",ExpressionUUID->"0bb08433-b97d-4d75-bcf7-78e2d1719fed"],
Cell[CellGroupData[{
Cell[6553, 169, 562, 14, 70, "ObjectNameGrid",ExpressionUUID->"2f67f348-dba6-4f26-b8f8-b31b90fd00d8"],
Cell[7118, 185, 3289, 86, 70, "Usage",ExpressionUUID->"ab026c83-78c2-4c63-a538-6fabbb455769"]
}, Open  ]],
Cell[CellGroupData[{
Cell[10444, 276, 1444, 34, 70, "NotesSection",ExpressionUUID->"8dc84f5e-3076-4bdd-99c6-8ca515ee998e",
 CellGroupingRules->{"SectionGrouping", 50},
 CellID->1476097411],
Cell[11891, 312, 576, 12, 70, "Notes",ExpressionUUID->"47bed8d2-fa1c-4e09-867f-204a24c5cd2c"],
Cell[12470, 326, 952, 27, 70, "Notes",ExpressionUUID->"afa19ac1-42a8-45d5-b5d4-71912c153f3b"],
Cell[13425, 355, 434, 6, 70, "Notes",ExpressionUUID->"35a0a42f-1f77-4e3b-b2de-87130bde38e5"],
Cell[13862, 363, 434, 11, 70, "Notes",ExpressionUUID->"00f7976b-15e7-42a0-97fd-d6ffe1f1d96e"],
Cell[14299, 376, 572, 13, 70, "Notes",ExpressionUUID->"aa9c47d5-4d43-4b9a-af3a-bc8b26fd1bf9"],
Cell[14874, 391, 494, 13, 70, "Notes",ExpressionUUID->"5d5cc35c-1722-4e34-9454-b7f861095256"]
}, Closed]],
Cell[15383, 407, 80, 0, 70, "PageDelimiter",ExpressionUUID->"73a0d500-9a43-497d-9ffc-0bfd53e39fc6"],
Cell[CellGroupData[{
Cell[15488, 411, 1402, 37, 70, "PrimaryExamplesSection",ExpressionUUID->"865e634d-13e2-42cc-9694-425f3dfb6ad1",
 CellID->1038096533],
Cell[16893, 450, 216, 4, 70, "Input",ExpressionUUID->"3e532b20-6c0e-4e48-91c4-25857b030a80",
 CellID->1969679695],
Cell[CellGroupData[{
Cell[17134, 458, 1236, 31, 70, "ExampleSection",ExpressionUUID->"138a6575-9c7a-4b50-bcbe-2eb95aa48a4d",
 CellID->1131281903],
Cell[18373, 491, 160, 2, 70, "ExampleText",ExpressionUUID->"1894cb87-b107-4810-be6b-fa3a1bee382a",
 CellTags->"TextAnnotation"],
Cell[CellGroupData[{
Cell[18558, 497, 291, 7, 70, "Input",ExpressionUUID->"93d9c900-aa72-4595-be83-19273bcd736e"],
Cell[18852, 506, 987, 19, 70, "Output",ExpressionUUID->"a8cb9bbe-a33e-49af-bbb7-ab379fa80858"]
}, Open  ]],
Cell[CellGroupData[{
Cell[19876, 530, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"465d1372-11fe-4923-bea2-eaf8e4ff9caa"],
Cell[20103, 537, 364, 9, 70, "ExampleText",ExpressionUUID->"eecda52c-f607-4420-96db-4a1a9c631c8b"],
Cell[CellGroupData[{
Cell[20492, 550, 355, 8, 70, "Input",ExpressionUUID->"927aa62e-56fe-4277-8309-7efc6120c56e"],
Cell[20850, 560, 158, 1, 70, "Output",ExpressionUUID->"c381e184-857b-46f3-8ade-2ff8140a2d45"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[21057, 567, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"b05f8856-a45d-406f-82f8-ee1ce35991a7"],
Cell[21284, 574, 125, 0, 70, "ExampleText",ExpressionUUID->"462a04f2-e402-4b3e-9672-0f7a94597896"],
Cell[CellGroupData[{
Cell[21434, 578, 326, 7, 70, "Input",ExpressionUUID->"c2f35354-2c5c-45f2-b015-6e5b92fdeaa9"],
Cell[21763, 587, 107, 1, 70, "Output",ExpressionUUID->"20bcf945-3389-45b3-b57c-64b9589db556"]
}, Open  ]]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[21931, 595, 1227, 31, 70, "ExampleSection",ExpressionUUID->"b8ca87c5-6245-4e81-b700-26baf50e1a88",
 CellID->1293636265],
Cell[23161, 628, 510, 13, 70, "ExampleText",ExpressionUUID->"7838c166-2494-4988-bc50-6706c2bdded2"],
Cell[CellGroupData[{
Cell[23696, 645, 373, 8, 70, "Input",ExpressionUUID->"08be8d23-5577-4488-8172-0cdb479ae36f"],
Cell[24072, 655, 186, 3, 70, "Output",ExpressionUUID->"8530f987-ddf4-4935-983d-92b13c73fbe5"]
}, Open  ]],
Cell[CellGroupData[{
Cell[24295, 663, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"7e470290-2058-40b8-a6ff-d295b157928c"],
Cell[24522, 670, 358, 9, 70, "ExampleText",ExpressionUUID->"385c916d-4925-4f27-a6fe-ebd95bcfc1b8"],
Cell[CellGroupData[{
Cell[24905, 683, 318, 6, 70, "Input",ExpressionUUID->"882d2ed6-a862-4403-8dd4-2d7ff233c8a7"],
Cell[25226, 691, 122, 1, 70, "Output",ExpressionUUID->"1e625f3b-3cfc-4432-974a-5c6524014449"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[25397, 698, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"6f0bd2cd-a13f-4388-8848-3950546ea1ef"],
Cell[25624, 705, 314, 7, 70, "ExampleText",ExpressionUUID->"bdb54ebd-fff5-423f-8c04-5d0344ecb16a"],
Cell[CellGroupData[{
Cell[25963, 716, 329, 7, 70, "Input",ExpressionUUID->"acfac641-1a03-475b-a11d-9d79ca31c162"],
Cell[26295, 725, 116, 1, 70, "Output",ExpressionUUID->"8c16c97e-1333-40bc-a7b5-555ed3199f0e"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[26460, 732, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"844cbc00-6163-48a5-9a1b-c43bf8b0f59b"],
Cell[26687, 739, 137, 1, 70, "ExampleText",ExpressionUUID->"b7771a22-e4e3-4391-86e7-fa1e1f6a9761"],
Cell[CellGroupData[{
Cell[26849, 744, 329, 7, 70, "Input",ExpressionUUID->"d987ac74-890d-4068-bc89-f13323260a23"],
Cell[27181, 753, 110, 1, 70, "Output",ExpressionUUID->"b602e237-164b-46b5-baf2-6693d5bf1d76"]
}, Open  ]]
}, Open  ]]
}, Closed]],
Cell[CellGroupData[{
Cell[27352, 761, 1244, 31, 70, "ExampleSection",ExpressionUUID->"6180e49e-49ee-4edb-8493-8cb6a1224fe2",
 CellID->2123667759],
Cell[28599, 794, 139, 1, 70, "ExampleText",ExpressionUUID->"dbae169a-dd2b-42f4-a5e5-8a29ccf33aca"],
Cell[CellGroupData[{
Cell[28763, 799, 624, 14, 70, "Input",ExpressionUUID->"f95a45e7-1509-4678-a28c-a7497c75e591"],
Cell[29390, 815, 128, 1, 70, "Output",ExpressionUUID->"48ae686b-a1a8-468d-a2b8-30c9ae5a813d"]
}, Open  ]],
Cell[CellGroupData[{
Cell[29555, 821, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"9f40633f-f30b-4b6e-af92-7ba69f0618f5"],
Cell[29782, 828, 541, 14, 70, "ExampleText",ExpressionUUID->"9e3b4ceb-0e38-48c6-b1da-80ad483974e8"],
Cell[CellGroupData[{
Cell[30348, 846, 255, 5, 70, "Input",ExpressionUUID->"c8a03dcc-3950-47eb-9f2b-20d44fc9569f"],
Cell[30606, 853, 188, 4, 70, "Output",ExpressionUUID->"26f76ab7-b5a3-47cc-b301-9691fa6ae790"]
}, Open  ]]
}, Open  ]]
}, Closed]],
Cell[CellGroupData[{
Cell[30855, 864, 1237, 31, 70, "ExampleSection",ExpressionUUID->"dee8c950-ba9e-470a-bfd3-71f220df4fcc",
 CellID->1305812373],
Cell[32095, 897, 449, 12, 70, "ExampleText",ExpressionUUID->"e483b491-f499-4cbf-ab01-2f710352d004"],
Cell[CellGroupData[{
Cell[32569, 913, 362, 8, 70, "Input",ExpressionUUID->"42ca60bb-38c4-4bc5-99f0-2ef518eac5df"],
Cell[32934, 923, 110, 1, 70, "Output",ExpressionUUID->"deab7916-bd1b-4d84-ba3b-70e3d9f02f38"]
}, Open  ]],
Cell[CellGroupData[{
Cell[33081, 929, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"d04a5413-770d-4e45-bfb1-80857c2da905"],
Cell[33308, 936, 139, 1, 70, "ExampleText",ExpressionUUID->"6b4c30d4-59ec-470e-ae4f-1b5346ee7389"],
Cell[CellGroupData[{
Cell[33472, 941, 323, 7, 70, "Input",ExpressionUUID->"fda24fb5-1d24-41b1-bac8-24fcb9567576"],
Cell[33798, 950, 110, 1, 70, "Output",ExpressionUUID->"fc494c8d-2645-462e-bd0e-beb39cf3e15a"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[33957, 957, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"80432042-3722-472a-9ed0-62d8a97fe5bd"],
Cell[34184, 964, 414, 8, 70, "ExampleText",ExpressionUUID->"a18eded2-a22b-45aa-9126-6cb838d52910"],
Cell[CellGroupData[{
Cell[34623, 976, 577, 15, 70, "Input",ExpressionUUID->"786470d5-1c76-4a02-b6a7-ed8cb368389b"],
Cell[35203, 993, 159, 3, 70, "Output",ExpressionUUID->"9ec9d424-ca04-45fb-b158-40133487d3b4"]
}, Open  ]]
}, Open  ]]
}, Closed]]
}, Open  ]],
Cell[35413, 1002, 3134, 82, 70, "SeeAlsoSection",ExpressionUUID->"647f894d-f31a-4781-ad02-1edb75b9b54b"],
Cell[38550, 1086, 698, 19, 70, "MoreAboutSection",ExpressionUUID->"db9d9278-aec1-49d3-9efd-f6e15fb3f121"],
Cell[39251, 1107, 78, 0, 70, "FooterCell",ExpressionUUID->"1a69ab2a-109f-445e-852a-fb6b64c3f60f"]
}
]
*)

(* End of internal cache information *)

