(* 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[     46317,       1205]
NotebookOptionsPosition[     36319,       1021]
NotebookOutlinePosition[     38450,       1071]
CellTagsIndexPosition[     38372,       1066]
WindowTitle->SegWitAddressEncode
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->
           "160e4367-fd37-427d-8ca1-cc0bf7ace10e"], 
          TemplateBox[{8},
           "Spacer1"]}]],
         TextAlignment->Center,ExpressionUUID->
         "48134a78-d455-4012-990e-de90f7a621b1"],
        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->
           "2a37ed9e-c281-4460-a036-bbebed481478"]
         }],ExpressionUUID->"803d9e6f-a023-40e0-8dfc-139d674fd424"],
         StripOnInput->False],{
        StyleBox[
          "\"SegWitAddressDecode\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/SegWitAddressDecode"], 
         StyleBox[
          "\"SegWitAddressQ\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/SegWitAddressQ"], 
         StyleBox[
          "\"Bech32Encode\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/Bech32Encode"], 
         StyleBox["\"BitRegroup\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/BitRegroup"], 
         StyleBox[
          "\"Base58CheckEncode\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/Base58CheckEncode"]},
        Appearance->None,
        MenuAppearance->Automatic,
        MenuStyle->"SeeAlso"],
       MouseAppearanceTag["LinkHand"]]],
      LineSpacing->{1.4, 0},ExpressionUUID->
      "a8422814-1d04-4959-b301-2ebb5b9bf3d3"],
     "\[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->
           "387b9875-3514-4615-83f1-cb4bbc2dafe6"]
         }],ExpressionUUID->"78ca6a5f-992b-4d5d-8d27-85c05c373ae9"],
         StripOnInput->False],{
        "\"Encodings\"" :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/guide/Encodings"]},
        Appearance->None,
        MenuAppearance->Automatic,
        MenuStyle->"MoreAbout"],
       MouseAppearanceTag["LinkHand"]]],
      LineSpacing->{1.4, 0},ExpressionUUID->
      "c1a90b58-cdeb-45fd-9ae6-c97f60b68bd7"],
     "\[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->
           "974a04dc-f1d1-4242-b72c-61a0ddd97c8f"]
         }],ExpressionUUID->"4842be33-537f-42cd-83e0-872b29fc2652"],
         StripOnInput->False],{
        "\"WolframInstitute/Puzzles/ref/SegWitAddressEncode\"" :> None, 
         "\"Copy Wolfram Documentation Center URL\"" :> 
         CopyToClipboard["WolframInstitute/Puzzles/ref/SegWitAddressEncode"], 
         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/SegWitAddressEncode.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/SegWitAddressEncode" <> ".html"],
               None}]}]},
        Appearance->None,
        MenuAppearance->Automatic,
        MenuStyle->"URLMenu"],
       MouseAppearanceTag["LinkHand"]]],
      LineSpacing->{1.4, 0},ExpressionUUID->
      "d3b57b0d-09fb-4549-8a05-e22a4f1ad1fc"]
    }], "AnchorBar",
     CacheGraphics->False,ExpressionUUID->
     "10570fb5-1209-4c5d-b680-e5d9d6ca28c7"]}
  }]], "AnchorBarGrid",
 CellID->1,ExpressionUUID->"88f8485d-be52-4ff8-b3e5-b4b8bc0a65ce"],

Cell["WolframInstitute`Puzzles`", "ContextNameCell",ExpressionUUID->"95ea3571-f09d-4759-b767-5c057815d180"],

Cell[CellGroupData[{

Cell[BoxData[GridBox[{
   {Cell[TextData[{
     Cell[
     "SegWitAddressEncode", "ObjectName",ExpressionUUID->
      "cecba27d-2533-4133-aed1-20b3a9cb0890"],
     Cell[BoxData[
      TemplateBox[{8},
       "Spacer1"]],ExpressionUUID->"3ff9a2b7-15d9-4e5b-a912-202c3809435d"],
     Cell[BoxData[
     ""], "ObjectNameTranslation",ExpressionUUID->
      "eb8186c5-4b25-4e39-9f9a-2bff9683fa87"]
    }],ExpressionUUID->"612ad10f-ed33-4f7d-844b-b8f44ce35082"], 
    "\[SpanFromLeft]"}
  }]], "ObjectNameGrid",ExpressionUUID->"f9a3328e-aba6-477e-ad70-\
82db5c5481dc"],

Cell[BoxData[GridBox[{
   {"", Cell[TextData[{
     Cell[BoxData[
      RowBox[{
       TemplateBox[{
         Cell[
          TextData["SegWitAddressEncode"]], 
         "paclet:WolframInstitute/Puzzles/ref/SegWitAddressEncode", 
         "WolframInstitute/Puzzles Package Symbol"},
        "PackageLink",
        BaseStyle->"InlineFormula"], "[", 
       RowBox[{
        StyleBox["hrp", "TI"], ",", " ", 
        StyleBox["version", "TI"], ",", " ", 
        StyleBox["program", "TI"]}], "]"}]], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "110f5066-0c32-43f9-8e2f-f8a9aa0343cb"],
     "\[LineSeparator]",
     "gives the native segregated witness address for a witness ",
     StyleBox["version", "TI"],
     " between 0 and 16 and a witness ",
     StyleBox["program", "TI"],
     " byte list."
    }],ExpressionUUID->"1ad3386f-b928-4cf7-90bc-255ea314aa8b"]}
  }]], "Usage",ExpressionUUID->"36388dd4-b265-48a9-845f-7cbf3c0e2f76"]
}, 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->"f870132d-01e3-42f3-a593-568aef241d36"],
  Cell[BoxData[
   TemplateBox[{1},
    "Spacer1"]],ExpressionUUID->"4b3226a2-4cc9-49d4-9efe-9c7f54d4c362"],
  "Details and Options"
 }], "NotesFrameText",ExpressionUUID->
  "e65c04e2-17dc-49cb-900c-a0c70b9b5bf5"]],ExpressionUUID->"623f4d93-72df-\
4f9e-a0f1-9d445209518e"]], "NotesSection",
 ShowGroupOpener->"Thumbnail",
 WholeCellGroupOpener->True,
 CellGroupingRules->{"SectionGrouping", 50},
 CacheGraphics->False,
 CellID->2055203098,ExpressionUUID->"f6b75e80-7600-4e24-b956-5f01d0ba86e4"],

Cell[TextData[{
 "The human-readable part is the network prefix: ",
 Cell[BoxData["\<\"bc\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "910dbf43-9163-4ab5-a65f-545a403d08f2"],
 " for mainnet and ",
 Cell[BoxData["\<\"tb\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "304d52fa-905c-4291-989c-ff31e1014429"],
 " for testnet, with ",
 Cell[BoxData["\<\"bcrt\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "56a261d1-ba62-4267-aa9c-e1bed3e42a05"],
 " for regtest. No prefix is privileged here, so any prefix a Bech32 \
human-readable part allows is encoded."
}], "Notes",ExpressionUUID->"568ce87c-a350-49cd-8917-6bddea172786"],

Cell["\<\
Witness version 0 uses the Bech32 checksum and versions 1 through 16 use \
Bech32m. This is the rule BIP350 added, and it is what distinguishes a \
Taproot address from a version 0 one at the checksum level.\
\>", "Notes",ExpressionUUID->"6401cd68-3904-43e5-a216-3cc73f2322e8"],

Cell["\<\
The witness program must be 2 to 40 bytes. At version 0 it must be exactly 20 \
bytes, a P2WPKH key hash, or exactly 32 bytes, a P2WSH script hash, as BIP141 \
requires.\
\>", "Notes",ExpressionUUID->"0d07d7b9-bc51-4566-853e-12d4268a56cd"],

Cell[TextData[{
 "The program is regrouped from 8-bit bytes to 5-bit values with ",
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["BitRegroup"]], 
    "paclet:WolframInstitute/Puzzles/ref/BitRegroup", 
    "WolframInstitute/Puzzles Package Symbol"},
   "PackageLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "9555ad1e-1a05-4b1b-a9a8-3b530d197893"],
 " and the witness version is placed in front of it as the first data value."
}], "Notes",ExpressionUUID->"e4a638cd-9a86-4c04-87cf-bd3a7e844a95"],

Cell["The result is lower case and at most 90 characters.", "Notes",ExpressionUUID->"3ff1fd77-a279-4b06-a32e-dc10aa4cd7c5"],

Cell["\<\
Arguments outside these ranges match no definition and the call is returned \
unevaluated.\
\>", "Notes",ExpressionUUID->"ec7a0205-b704-4cd4-afec-eb8acd08f3a1"]
}, Closed]],

Cell["", "PageDelimiter",ExpressionUUID->"6f1a2492-e323-4728-a38d-a9edba9f796d"],

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->"93c6b565-1ba6-4216-bfe6-8999b328246a"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"c9ae4294-372f-4fe9-b6d1-8369ea30759e"],
 "Examples",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(13)", "ExampleCount",ExpressionUUID->
  "32eb59e1-07ad-44b8-9c02-68b3e1e34caa"]
}], "PrimaryExamplesSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1671489738,ExpressionUUID->"0f7ebc9b-7273-412e-bcc5-821751e13a20"],

Cell[BoxData[
 RowBox[{"Needs", "[", "\"\<WolframInstitute`Puzzles`\>\"", "]"}]], "Input", \
"ExampleInitialization",
 CellLabel->"In[1]:=",
 CellID->1969679695,ExpressionUUID->"3bb1c7c7-61a4-4139-85d8-b23892e5cc3b"],

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->
  "fd0cffbb-4a7a-4c07-bffc-0c16180a5682"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"b8995dc3-0095-4337-a6c0-38d6a297e386"],
 "Basic Examples",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(3)", "ExampleCount",ExpressionUUID->
  "cb7ecc78-e362-41fb-ab59-252846e377c1"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1494440159,ExpressionUUID->"540bf98c-04e6-4bd8-8c4f-2d1eff0714f7"],

Cell["\<\
The BIP350 vector for a version 0 20-byte program, a P2WPKH address:\
\>", "ExampleText",
 CellTags->
  "TextAnnotation",ExpressionUUID->"7e37cc43-1c9a-469c-a0a8-abcca9f840ef"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"SegWitAddressEncode", "[", 
  RowBox[{"\"\<bc\>\"", ",", " ", "0", ",", " ", 
   RowBox[{
   "HexStringToByteList", 
    "[", "\"\<751e76e8199196d454941c45d1b3a323f1433bd6\>\"", "]"}]}], 
  "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"31922412-53b1-4449-99e7-c6582b67a3bf"],

Cell[BoxData["\<\"bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4\"\>"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"92e10846-f317-4e97-b787-73e8367e6276"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "d170a134-45a5-47e4-af02-2923e734251c"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"13170fe0-b3e4-450a-\
a3cc-15e1f7dd0a8b"],

Cell["\<\
A version 1 32-byte program is a Taproot output, and BIP350 requires the \
Bech32m checksum for it:\
\>", "ExampleText",ExpressionUUID->"2799e821-604d-460a-8e2c-d081659dc048"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"SegWitAddressEncode", "[", 
  RowBox[{"\"\<bc\>\"", ",", " ", "1", ",", " ", 
   RowBox[{
   "HexStringToByteList", 
    "[", "\"\<\
79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\>\"", 
    "]"}]}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"808b378a-bba4-435d-a6d4-2fc7ba04607e"],

Cell[BoxData["\<\"\
bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqzk5jj0\"\>"], "Output",\

 CellLabel->"Out[1]= ",ExpressionUUID->"86029024-9ab8-4f9b-915a-ca1a7303eb35"]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "2685a926-da08-4e98-960d-3973d06e6a26"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"905cf715-633e-4ece-\
b6e9-df64ff1f5bbb"],

Cell["\<\
The testnet prefix gives the testnet form of the same kind of address:\
\>", "ExampleText",ExpressionUUID->"dffb0869-e7d8-4d7a-91b5-0c77d81e220d"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"SegWitAddressEncode", "[", 
  RowBox[{"\"\<tb\>\"", ",", " ", "0", ",", " ", 
   RowBox[{
   "HexStringToByteList", 
    "[", "\"\<\
1863143c14c5166804bd19203356da136c985678cd4d27a1b8c6329604903262\>\"", 
    "]"}]}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"5cc2865c-69b7-4bf0-9263-7627a7e17a68"],

Cell[BoxData["\<\"\
tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7\"\>"], "Output",\

 CellLabel->"Out[1]= ",ExpressionUUID->"07174b8e-9914-4542-9af0-ef163e867f6a"]
}, 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->
  "7bb9ee20-411d-4059-8cc5-f4d0ff31050c"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"4f25b2e5-a7b9-4a4e-a67e-ea0df5060328"],
 "Scope",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(4)", "ExampleCount",ExpressionUUID->
  "6974ff4d-2acc-4a66-8b38-ce445a16f47c"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1293636265,ExpressionUUID->"992a3a55-eae1-4bf9-87d5-e8739dc667c7"],

Cell["A version 0 32-byte program is a P2WSH address:", "ExampleText",ExpressionUUID->"cabf1414-9a28-48cc-b379-636b2438557a"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"SegWitAddressEncode", "[", 
  RowBox[{"\"\<bc\>\"", ",", " ", "0", ",", " ", 
   RowBox[{
   "HexStringToByteList", 
    "[", "\"\<\
1863143c14c5166804bd19203356da136c985678cd4d27a1b8c6329604903262\>\"", 
    "]"}]}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"a35f65a7-4a35-4475-8e14-08f18a404f5e"],

Cell[BoxData["\<\"\
bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3\"\>"], "Output",\

 CellLabel->"Out[1]= ",ExpressionUUID->"ba7757e1-e26f-46e5-8225-2be2e357c4a3"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "84a3741a-c88b-4cd3-85a7-f0390fdf6c8a"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"96662681-7128-4798-\
9947-99814c5a19a4"],

Cell["\<\
The BIP350 vector at witness version 16 with the shortest allowed program, \
two bytes:\
\>", "ExampleText",ExpressionUUID->"cc9de204-351a-4a53-b81f-71a5be05c1b9"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"SegWitAddressEncode", "[", 
  RowBox[{"\"\<bc\>\"", ",", " ", "16", ",", " ", 
   RowBox[{"HexStringToByteList", "[", "\"\<751e\>\"", "]"}]}], 
  "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"7bda5de4-8b71-4451-ab20-7551c91e3e32"],

Cell[BoxData["\<\"bc1sw50qgdz25j\"\>"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"73e9e1c2-4201-473d-8c30-3979f0f43773"]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "20485e60-0f0d-4994-9447-018bb7d715a7"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"179b8c5b-0ad1-4c06-\
b09e-7742d5706fba"],

Cell["\<\
The BIP350 vector at witness version 2 with a 16-byte program:\
\>", "ExampleText",ExpressionUUID->"af0c97a4-3029-481b-94cf-6c7867e8282a"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"SegWitAddressEncode", "[", 
  RowBox[{"\"\<bc\>\"", ",", " ", "2", ",", " ", 
   RowBox[{
   "HexStringToByteList", "[", "\"\<751e76e8199196d454941c45d1b3a323\>\"", 
    "]"}]}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"2d341b88-79ff-46c9-80e3-26ea0ff5854d"],

Cell[BoxData["\<\"bc1zw508d6qejxtdg4y5r3zarvaryvaxxpcs\"\>"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"a9b79d69-105f-4974-b06a-9efaac3abf61"]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "8c1419d5-bb74-41ff-b0bb-1a1a43bcc7a7"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"d9d2c87c-2912-40bf-\
ab1b-092052450860"],

Cell["\<\
The longest allowed program is 40 bytes, which BIP350 lists at witness \
version 1:\
\>", "ExampleText",ExpressionUUID->"00a77af6-d2dd-4bae-aa44-0ec3d3eb062e"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"SegWitAddressEncode", "[", 
  RowBox[{"\"\<bc\>\"", ",", " ", "1", ",", " ", 
   RowBox[{
   "HexStringToByteList", 
    "[", "\"\<\
751e76e8199196d454941c45d1b3a323f1433bd6751e76e8199196d454941c45d1b3a323f1433b\
d6\>\"", "]"}]}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"0af719fe-74a2-4fe1-be28-9e9589d560a2"],

Cell[BoxData["\<\"\
bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7kt5nd6y\"\>\
"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"5e75c5d4-e4b4-48b6-b708-e0ce82d9be87"]
}, 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->
  "e1015ce9-6ce3-4d94-abe8-f24fba1ff0b4"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"ae8ebe9c-13d6-4728-b72b-8a5ed09c942b"],
 "Properties & Relations",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(3)", "ExampleCount",ExpressionUUID->
  "f61b1484-2531-4c9b-bfee-50fca26f660e"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->2123667759,ExpressionUUID->"5010aca7-79be-42f1-a907-2e05b35591d2"],

Cell[TextData[{
 "The checksum variant is read back by ",
 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->
  "00dcb71f-d0c5-4c36-adbe-3cdca70bf53b"],
 ", and it follows the witness version:"
}], "ExampleText",ExpressionUUID->"2642fa2a-da65-4f72-9596-d8dd0a712615"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"Bech32Decode", "[", 
   RowBox[{"SegWitAddressEncode", "[", 
    RowBox[{"\"\<bc\>\"", ",", " ", "1", ",", " ", 
     RowBox[{
     "HexStringToByteList", 
      "[", "\"\<\
79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\>\"", 
      "]"}]}], "]"}], "]"}], "[", "\"\<Variant\>\"", "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"c8c0a77b-3d0a-4012-8850-127b293f0643"],

Cell[BoxData["\<\"Bech32m\"\>"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"026bc52f-b63a-4529-8719-6fb0dcb20cfe"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "f3c01ff7-08b4-4f54-89d3-86f4be72cfb0"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"1a686b31-ebd0-4617-\
b729-62c3a38bcaea"],

Cell["\<\
The same program at witness version 0 would use the other constant, which is \
what BIP350 changed:\
\>", "ExampleText",ExpressionUUID->"f2b03b80-d7e3-4ebc-a4b9-ecca88a75549"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"Bech32Decode", "[", 
   RowBox[{"SegWitAddressEncode", "[", 
    RowBox[{"\"\<bc\>\"", ",", " ", "0", ",", " ", 
     RowBox[{
     "HexStringToByteList", 
      "[", "\"\<\
79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\>\"", 
      "]"}]}], "]"}], "]"}], "[", "\"\<Variant\>\"", "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"9525b63a-c225-406f-a846-754e9c6415ec"],

Cell[BoxData["\<\"Bech32\"\>"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"89eb3cd8-b307-4bb4-a019-6cd6d45a74b9"]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "e16abdb0-9b96-4cb8-9cbb-c2ee44f39395"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"1dc47863-47f1-4364-\
8ae9-86b266cdaf43"],

Cell[TextData[{
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["SegWitAddressDecode"]], 
    "paclet:WolframInstitute/Puzzles/ref/SegWitAddressDecode", 
    "WolframInstitute/Puzzles Package Symbol"},
   "PackageLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "5ccfede9-e0dc-4843-b49b-267d8cbd7518"],
 " recovers the version and program exactly:"
}], "ExampleText",ExpressionUUID->"86a129a6-cf63-4368-85f4-a3192dbe2d13"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"SegWitAddressDecode", "[", 
   RowBox[{"SegWitAddressEncode", "[", 
    RowBox[{"\"\<bc\>\"", ",", " ", "16", ",", " ", 
     RowBox[{"{", 
      RowBox[{"117", ",", " ", "30"}], "}"}]}], "]"}], "]"}], 
  "[", "\"\<WitnessProgram\>\"", "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"026d1f67-0cf9-4850-8450-63b4976afd92"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"117", ",", "30"}], "}"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"8a597d45-2e7f-4c5c-b184-480dec61dd04"]
}, 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->
  "0811a9a2-43ae-4f9a-af44-166b7d070016"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"5679c8b5-4923-4a9e-b230-b3e4e8f0b466"],
 "Possible Issues",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(3)", "ExampleCount",ExpressionUUID->
  "de851029-566f-4448-8782-85cfe0881e6c"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1305812373,ExpressionUUID->"742d0659-29f7-48a2-934f-4fa3898c0a3d"],

Cell["\<\
BIP141 allows only 20-byte and 32-byte programs at witness version 0, so a \
21-byte one matches no definition and the call is returned unevaluated:\
\>", "ExampleText",ExpressionUUID->"60bddba3-3110-4fd1-97e3-7e8e0ea7f855"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"SegWitAddressEncode", "[", 
  RowBox[{"\"\<bc\>\"", ",", " ", "0", ",", " ", 
   RowBox[{"ConstantArray", "[", 
    RowBox[{"0", ",", " ", "21"}], "]"}]}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"a46cbd69-35fa-40d2-8e38-f6d2717bc5d6"],

Cell[BoxData[
 RowBox[{"SegWitAddressEncode", "[", 
  RowBox[{"\<\"bc\"\>", ",", "0", ",", 
   RowBox[{"{", 
    RowBox[{
    "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
      ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",",
      "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0"}], "}"}]}], 
  "]"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"59bad50b-8ca2-4c21-99ea-1539d4421822"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "6f2d1b93-0e06-4124-80bb-68c24ffde83a"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"061a3f06-4fb5-407b-\
bae7-1e8793ea865f"],

Cell["\<\
An upper-case human-readable part is not something an encoder may emit:\
\>", "ExampleText",ExpressionUUID->"ab8ddeca-e2e2-49ff-8d92-ac0c419c6b40"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"SegWitAddressEncode", "[", 
  RowBox[{"\"\<BC\>\"", ",", " ", "0", ",", " ", 
   RowBox[{"ConstantArray", "[", 
    RowBox[{"0", ",", " ", "20"}], "]"}]}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"b0be376e-e1d3-4627-8ae6-da470c8771f8"],

Cell[BoxData[
 RowBox[{"SegWitAddressEncode", "[", 
  RowBox[{"\<\"BC\"\>", ",", "0", ",", 
   RowBox[{"{", 
    RowBox[{
    "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
      ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",",
      "0", ",", "0", ",", "0", ",", "0", ",", "0"}], "}"}]}], "]"}]], "Output",\

 CellLabel->"Out[1]= ",ExpressionUUID->"58c4c832-c34d-4760-9c2f-02e686d30e79"]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "c42000c6-2262-4725-8cd4-fa6298c2a602"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"2a50560e-3553-487c-\
822c-abc004c5b7d2"],

Cell["Witness version 17 does not exist:", "ExampleText",ExpressionUUID->"0b977e93-2a85-4b55-8704-6b2fcb16ec39"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"SegWitAddressEncode", "[", 
  RowBox[{"\"\<bc\>\"", ",", " ", "17", ",", " ", 
   RowBox[{"ConstantArray", "[", 
    RowBox[{"0", ",", " ", "32"}], "]"}]}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"4fab8261-420a-430f-9c4d-b6ed33f79687"],

Cell[BoxData[
 RowBox[{"SegWitAddressEncode", "[", 
  RowBox[{"\<\"bc\"\>", ",", "17", ",", 
   RowBox[{"{", 
    RowBox[{
    "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
      ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",",
      "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", 
     "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", 
     "0", ",", "0", ",", "0"}], "}"}]}], "]"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"919a128a-c916-4812-909c-931046da7fa8"]
}, 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["SegWitAddressDecode"]], 
           "paclet:WolframInstitute/Puzzles/ref/SegWitAddressDecode", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "1b24d4bf-f5b3-4115-a3b8-a8d725c826f7"],
        "\[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->
         "6ad693e5-aa44-4d80-9329-1d6defed94b8"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["Bech32Encode"]], 
           "paclet:WolframInstitute/Puzzles/ref/Bech32Encode", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "33f014a7-c45b-4bcb-b7e3-6ea9b2a68029"],
        "\[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->
         "2aa6c6d4-c9ac-4b66-acfc-9c9f041a0ad4"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["Base58CheckEncode"]], 
           "paclet:WolframInstitute/Puzzles/ref/Base58CheckEncode", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "79ded739-8ece-4c0a-ba32-f373b34a66be"]
       }], "SeeAlso",ExpressionUUID->"0490c5ce-79a5-48df-93e9-d17f5a0d7993"]}
     }]}
  }]], "SeeAlsoSection",ExpressionUUID->"946e0f22-3b55-47df-8986-\
1a8ed74c4909"],

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->
         "642db923-0927-4cbf-8bcf-a622927121c2"]}]}
     }]}
  }]], "MoreAboutSection",ExpressionUUID->"dec49337-b865-4134-bd32-\
7048d3af6b1a"],

Cell[" ", "FooterCell",ExpressionUUID->"8670a9c8-60cc-440f-810c-80f869062bb5"]
},
Saveable->False,
ScreenStyleEnvironment->"Working",
WindowSize->{900, 830},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
WindowTitle->"SegWitAddressEncode",
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, 50.722342}", 
    "history" -> {"XX", "", "", ""}, "context" -> "WolframInstitute`Puzzles`",
     "keywords" -> {}, "specialkeywords" -> {}, 
    "tutorialcollectionlinks" -> {}, "index" -> True, "label" -> 
    "Wolfram Institute/ Puzzles Symbol", "language" -> "en", "paclet" -> 
    "WolframInstitute/Puzzles", "status" -> "None", "summary" -> 
    "PackageLink[SegWitAddressEncode, paclet : \
WolframInstitute/Puzzles/ref/SegWitAddressEncode, WolframInstitute/Puzzles \
Package Symbol][hrp, version, program] gives the native segregated witness \
address for a witness version between 0 and 16 and a witness program byte \
list.", "synonyms" -> {}, "tabletags" -> {}, "title" -> "SegWitAddressEncode",
     "titlemodifier" -> "", "metadescription" -> "", "windowtitle" -> 
    "SegWitAddressEncode", "type" -> "Symbol", "uri" -> 
    "WolframInstitute/Puzzles/ref/SegWitAddressEncode", "WorkflowDockedCell" -> 
    ""}, "SearchTextTranslated" -> ""},
CellContext->CellGroup,
FrontEndVersion->"15.0 for Mac OS X ARM (64-bit) (May 19, 2026)",
StyleDefinitions->FrontEnd`FileName[{"Wolfram"}, "Reference.nb"],
ExpressionUUID->"e8165e72-37e9-4e4d-bfc2-4dcffc334f89"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{
 "TextAnnotation"->{
  Cell[14828, 391, 186, 4, 70, "ExampleText",ExpressionUUID->"7e37cc43-1c9a-469c-a0a8-abcca9f840ef",
   CellTags->"TextAnnotation"]}
 }
*)
(*CellTagsIndex
CellTagsIndex->{
 {"TextAnnotation", 38215, 1060}
 }
*)
(*NotebookFileOutline
Notebook[{
Cell[587, 21, 5831, 142, 70, "AnchorBarGrid",ExpressionUUID->"88f8485d-be52-4ff8-b3e5-b4b8bc0a65ce",
 CellID->1],
Cell[6421, 165, 107, 0, 70, "ContextNameCell",ExpressionUUID->"95ea3571-f09d-4759-b767-5c057815d180"],
Cell[CellGroupData[{
Cell[6553, 169, 562, 14, 70, "ObjectNameGrid",ExpressionUUID->"f9a3328e-aba6-477e-ad70-82db5c5481dc"],
Cell[7118, 185, 997, 25, 70, "Usage",ExpressionUUID->"36388dd4-b265-48a9-845f-7cbf3c0e2f76"]
}, Open  ]],
Cell[CellGroupData[{
Cell[8152, 215, 1444, 34, 70, "NotesSection",ExpressionUUID->"f6b75e80-7600-4e24-b956-5f01d0ba86e4",
 CellGroupingRules->{"SectionGrouping", 50},
 CellID->2055203098],
Cell[9599, 251, 789, 18, 70, "Notes",ExpressionUUID->"568ce87c-a350-49cd-8917-6bddea172786"],
Cell[10391, 271, 287, 4, 70, "Notes",ExpressionUUID->"6401cd68-3904-43e5-a216-3cc73f2322e8"],
Cell[10681, 277, 249, 4, 70, "Notes",ExpressionUUID->"0d07d7b9-bc51-4566-853e-12d4268a56cd"],
Cell[10933, 283, 591, 14, 70, "Notes",ExpressionUUID->"e4a638cd-9a86-4c04-87cf-bd3a7e844a95"],
Cell[11527, 299, 123, 0, 70, "Notes",ExpressionUUID->"3ff1fd77-a279-4b06-a32e-dc10aa4cd7c5"],
Cell[11653, 301, 170, 3, 70, "Notes",ExpressionUUID->"ec7a0205-b704-4cd4-afec-eb8acd08f3a1"]
}, Closed]],
Cell[11838, 307, 80, 0, 70, "PageDelimiter",ExpressionUUID->"6f1a2492-e323-4728-a38d-a9edba9f796d"],
Cell[CellGroupData[{
Cell[11943, 311, 1402, 37, 70, "PrimaryExamplesSection",ExpressionUUID->"0f7ebc9b-7273-412e-bcc5-821751e13a20",
 CellID->1671489738],
Cell[13348, 350, 216, 4, 70, "Input",ExpressionUUID->"3bb1c7c7-61a4-4139-85d8-b23892e5cc3b",
 CellID->1969679695],
Cell[CellGroupData[{
Cell[13589, 358, 1236, 31, 70, "ExampleSection",ExpressionUUID->"540bf98c-04e6-4bd8-8c4f-2d1eff0714f7",
 CellID->1494440159],
Cell[14828, 391, 186, 4, 70, "ExampleText",ExpressionUUID->"7e37cc43-1c9a-469c-a0a8-abcca9f840ef",
 CellTags->"TextAnnotation"],
Cell[CellGroupData[{
Cell[15039, 399, 357, 8, 70, "Input",ExpressionUUID->"31922412-53b1-4449-99e7-c6582b67a3bf"],
Cell[15399, 409, 156, 1, 70, "Output",ExpressionUUID->"92e10846-f317-4e97-b787-73e8367e6276"]
}, Open  ]],
Cell[CellGroupData[{
Cell[15592, 415, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"13170fe0-b3e4-450a-a3cc-15e1f7dd0a8b"],
Cell[15819, 422, 185, 3, 70, "ExampleText",ExpressionUUID->"2799e821-604d-460a-8e2c-d081659dc048"],
Cell[CellGroupData[{
Cell[16029, 429, 385, 9, 70, "Input",ExpressionUUID->"808b378a-bba4-435d-a6d4-2fc7ba04607e"],
Cell[16417, 440, 180, 3, 70, "Output",ExpressionUUID->"86029024-9ab8-4f9b-915a-ca1a7303eb35"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[16646, 449, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"905cf715-633e-4ece-b6e9-df64ff1f5bbb"],
Cell[16873, 456, 156, 2, 70, "ExampleText",ExpressionUUID->"dffb0869-e7d8-4d7a-91b5-0c77d81e220d"],
Cell[CellGroupData[{
Cell[17054, 462, 385, 9, 70, "Input",ExpressionUUID->"5cc2865c-69b7-4bf0-9263-7627a7e17a68"],
Cell[17442, 473, 180, 3, 70, "Output",ExpressionUUID->"07174b8e-9914-4542-9af0-ef163e867f6a"]
}, Open  ]]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[17683, 483, 1227, 31, 70, "ExampleSection",ExpressionUUID->"992a3a55-eae1-4bf9-87d5-e8739dc667c7",
 CellID->1293636265],
Cell[18913, 516, 125, 0, 70, "ExampleText",ExpressionUUID->"cabf1414-9a28-48cc-b379-636b2438557a"],
Cell[CellGroupData[{
Cell[19063, 520, 385, 9, 70, "Input",ExpressionUUID->"a35f65a7-4a35-4475-8e14-08f18a404f5e"],
Cell[19451, 531, 180, 3, 70, "Output",ExpressionUUID->"ba7757e1-e26f-46e5-8225-2be2e357c4a3"]
}, Open  ]],
Cell[CellGroupData[{
Cell[19668, 539, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"96662681-7128-4798-9947-99814c5a19a4"],
Cell[19895, 546, 173, 3, 70, "ExampleText",ExpressionUUID->"cc9de204-351a-4a53-b81f-71a5be05c1b9"],
Cell[CellGroupData[{
Cell[20093, 553, 313, 6, 70, "Input",ExpressionUUID->"7bda5de4-8b71-4451-ab20-7551c91e3e32"],
Cell[20409, 561, 128, 1, 70, "Output",ExpressionUUID->"73e9e1c2-4201-473d-8c30-3979f0f43773"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[20586, 568, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"179b8c5b-0ad1-4c06-b09e-7742d5706fba"],
Cell[20813, 575, 148, 2, 70, "ExampleText",ExpressionUUID->"af0c97a4-3029-481b-94cf-6c7867e8282a"],
Cell[CellGroupData[{
Cell[20986, 581, 346, 7, 70, "Input",ExpressionUUID->"2d341b88-79ff-46c9-80e3-26ea0ff5854d"],
Cell[21335, 590, 150, 1, 70, "Output",ExpressionUUID->"a9b79d69-105f-4974-b06a-9efaac3abf61"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[21534, 597, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"d9d2c87c-2912-40bf-ab1b-092052450860"],
Cell[21761, 604, 169, 3, 70, "ExampleText",ExpressionUUID->"00a77af6-d2dd-4bae-aa44-0ec3d3eb062e"],
Cell[CellGroupData[{
Cell[21955, 611, 398, 9, 70, "Input",ExpressionUUID->"0af719fe-74a2-4fe1-be28-9e9589d560a2"],
Cell[22356, 622, 192, 3, 70, "Output",ExpressionUUID->"5e75c5d4-e4b4-48b6-b708-e0ce82d9be87"]
}, Open  ]]
}, Open  ]]
}, Closed]],
Cell[CellGroupData[{
Cell[22609, 632, 1244, 31, 70, "ExampleSection",ExpressionUUID->"5010aca7-79be-42f1-a907-2e05b35591d2",
 CellID->2123667759],
Cell[23856, 665, 538, 14, 70, "ExampleText",ExpressionUUID->"2642fa2a-da65-4f72-9596-d8dd0a712615"],
Cell[CellGroupData[{
Cell[24419, 683, 477, 11, 70, "Input",ExpressionUUID->"c8c0a77b-3d0a-4012-8850-127b293f0643"],
Cell[24899, 696, 121, 1, 70, "Output",ExpressionUUID->"026bc52f-b63a-4529-8719-6fb0dcb20cfe"]
}, Open  ]],
Cell[CellGroupData[{
Cell[25057, 702, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"1a686b31-ebd0-4617-b729-62c3a38bcaea"],
Cell[25284, 709, 185, 3, 70, "ExampleText",ExpressionUUID->"f2b03b80-d7e3-4ebc-a4b9-ecca88a75549"],
Cell[CellGroupData[{
Cell[25494, 716, 477, 11, 70, "Input",ExpressionUUID->"9525b63a-c225-406f-a846-754e9c6415ec"],
Cell[25974, 729, 120, 1, 70, "Output",ExpressionUUID->"89eb3cd8-b307-4bb4-a019-6cd6d45a74b9"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[26143, 736, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"1dc47863-47f1-4364-8ae9-86b266cdaf43"],
Cell[26370, 743, 515, 13, 70, "ExampleText",ExpressionUUID->"86a129a6-cf63-4368-85f4-a3192dbe2d13"],
Cell[CellGroupData[{
Cell[26910, 760, 414, 9, 70, "Input",ExpressionUUID->"026d1f67-0cf9-4850-8450-63b4976afd92"],
Cell[27327, 771, 155, 3, 70, "Output",ExpressionUUID->"8a597d45-2e7f-4c5c-b184-480dec61dd04"]
}, Open  ]]
}, Open  ]]
}, Closed]],
Cell[CellGroupData[{
Cell[27543, 781, 1237, 31, 70, "ExampleSection",ExpressionUUID->"742d0659-29f7-48a2-934f-4fa3898c0a3d",
 CellID->1305812373],
Cell[28783, 814, 234, 3, 70, "ExampleText",ExpressionUUID->"60bddba3-3110-4fd1-97e3-7e8e0ea7f855"],
Cell[CellGroupData[{
Cell[29042, 821, 323, 6, 70, "Input",ExpressionUUID->"a46cbd69-35fa-40d2-8e38-f6d2717bc5d6"],
Cell[29368, 829, 453, 9, 70, "Output",ExpressionUUID->"59bad50b-8ca2-4c21-99ea-1539d4421822"]
}, Open  ]],
Cell[CellGroupData[{
Cell[29858, 843, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"061a3f06-4fb5-407b-bae7-1e8793ea865f"],
Cell[30085, 850, 157, 2, 70, "ExampleText",ExpressionUUID->"ab8ddeca-e2e2-49ff-8d92-ac0c419c6b40"],
Cell[CellGroupData[{
Cell[30267, 856, 323, 6, 70, "Input",ExpressionUUID->"b0be376e-e1d3-4627-8ae6-da470c8771f8"],
Cell[30593, 864, 442, 9, 70, "Output",ExpressionUUID->"58c4c832-c34d-4760-9c2f-02e686d30e79"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[31084, 879, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"2a50560e-3553-487c-822c-abc004c5b7d2"],
Cell[31311, 886, 112, 0, 70, "ExampleText",ExpressionUUID->"0b977e93-2a85-4b55-8704-6b2fcb16ec39"],
Cell[CellGroupData[{
Cell[31448, 890, 324, 6, 70, "Input",ExpressionUUID->"4fab8261-420a-430f-9c4d-b6ed33f79687"],
Cell[31775, 898, 573, 10, 70, "Output",ExpressionUUID->"919a128a-c916-4812-909c-931046da7fa8"]
}, Open  ]]
}, Open  ]]
}, Closed]]
}, Open  ]],
Cell[32399, 914, 3134, 82, 70, "SeeAlsoSection",ExpressionUUID->"946e0f22-3b55-47df-8986-1a8ed74c4909"],
Cell[35536, 998, 698, 19, 70, "MoreAboutSection",ExpressionUUID->"dec49337-b865-4134-bd32-7048d3af6b1a"],
Cell[36237, 1019, 78, 0, 70, "FooterCell",ExpressionUUID->"8670a9c8-60cc-440f-810c-80f869062bb5"]
}
]
*)

(* End of internal cache information *)

