[{"data":1,"prerenderedAt":795},["ShallowReactive",2],{"navigation_docs":3,"-blockchains-zcash":108,"-blockchains-zcash-surround":792},[4,32],{"title":5,"path":6,"stem":7,"children":8,"icon":31},"Guide","\u002Fguide","1.guide\u002F1.index",[9,11,15,19,23,27],{"title":10,"path":6,"stem":7},"Getting Started",{"title":12,"path":13,"stem":14},"Working with Keys","\u002Fguide\u002Fkeys","1.guide\u002F2.keys",{"title":16,"path":17,"stem":18},"Working with Addresses","\u002Fguide\u002Faddresses","1.guide\u002F3.addresses",{"title":20,"path":21,"stem":22},"Generating Wallets","\u002Fguide\u002Fwallets","1.guide\u002F4.wallets",{"title":24,"path":25,"stem":26},"Working with EVM Chains","\u002Fguide\u002Fevm","1.guide\u002F5.evm",{"title":28,"path":29,"stem":30},"Creating Custom Blockchains","\u002Fguide\u002Fcustom","1.guide\u002F6.custom","i-lucide-book-open",{"title":33,"path":34,"stem":35,"children":36,"icon":107},"Blockchains","\u002Fblockchains","2.blockchains\u002F0.index",[37,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103],{"title":38,"path":34,"stem":35},"Overview",{"title":40,"path":41,"stem":42},"Aptos","\u002Fblockchains\u002Faptos","2.blockchains\u002Faptos",{"title":44,"path":45,"stem":46},"Base","\u002Fblockchains\u002Fbase","2.blockchains\u002Fbase",{"title":48,"path":49,"stem":50},"Bitcoin","\u002Fblockchains\u002Fbitcoin","2.blockchains\u002Fbitcoin",{"title":52,"path":53,"stem":54},"Bitcoin Cash","\u002Fblockchains\u002Fbitcoincash","2.blockchains\u002Fbitcoincash",{"title":56,"path":57,"stem":58},"Bitcoin Gold","\u002Fblockchains\u002Fbitcoingold","2.blockchains\u002Fbitcoingold",{"title":60,"path":61,"stem":62},"Bitcoin SV","\u002Fblockchains\u002Fbitcoinsv","2.blockchains\u002Fbitcoinsv",{"title":64,"path":65,"stem":66},"Cardano","\u002Fblockchains\u002Fcardano","2.blockchains\u002Fcardano",{"title":68,"path":69,"stem":70},"Dash","\u002Fblockchains\u002Fdash","2.blockchains\u002Fdash",{"title":72,"path":73,"stem":74},"Decred","\u002Fblockchains\u002Fdecred","2.blockchains\u002Fdecred",{"title":76,"path":77,"stem":78},"Dogecoin","\u002Fblockchains\u002Fdogecoin","2.blockchains\u002Fdogecoin",{"title":80,"path":81,"stem":82},"Ethereum","\u002Fblockchains\u002Fethereum","2.blockchains\u002Fethereum",{"title":84,"path":85,"stem":86},"Litecoin","\u002Fblockchains\u002Flitecoin","2.blockchains\u002Flitecoin",{"title":88,"path":89,"stem":90},"Solana","\u002Fblockchains\u002Fsolana","2.blockchains\u002Fsolana",{"title":92,"path":93,"stem":94},"Stellar","\u002Fblockchains\u002Fstellar","2.blockchains\u002Fstellar",{"title":96,"path":97,"stem":98},"Sui","\u002Fblockchains\u002Fsui","2.blockchains\u002Fsui",{"title":100,"path":101,"stem":102},"TRON","\u002Fblockchains\u002Ftron","2.blockchains\u002Ftron",{"title":104,"path":105,"stem":106},"Zcash","\u002Fblockchains\u002Fzcash","2.blockchains\u002Fzcash","i-lucide-boxes",{"id":109,"title":104,"body":110,"description":785,"extension":786,"links":787,"meta":788,"navigation":184,"path":105,"seo":790,"stem":106,"__hash__":791},"docs\u002F2.blockchains\u002Fzcash.md",{"type":111,"value":112,"toc":776},"minimark",[113,120,125,262,278,282,293,306,310,323,386,477,498,502,595,602,612,616,623,690,703,714,728,732,750,754,772],[114,115],"chain-facts",{"coin":116,"curve":117,"driver":118,"formats":119},"133","secp256k1","zcash","transparent P2PKH",[121,122,124],"h2",{"id":123},"load-it","Load it",[126,127,132],"pre",{"className":128,"code":129,"language":130,"meta":131,"style":131},"language-js shiki shiki-themes github-light github-light poimandres","import { useBlockchain, blockchains } from \"@agntn\u002Fkeys\";\n\nconst zcashChain = useBlockchain(await blockchains.zcash()());\nconst testnet = useBlockchain(await blockchains.zcash({ network: \"testnet\" })());\n","js","",[133,134,135,179,186,221],"code",{"__ignoreMap":131},[136,137,140,144,148,152,155,158,161,165,169,173,176],"span",{"class":138,"line":139},"line",1,[136,141,143],{"class":142},"sP0CR","import",[136,145,147],{"class":146},"sKlNE"," {",[136,149,151],{"class":150},"snHMy"," useBlockchain",[136,153,154],{"class":146},",",[136,156,157],{"class":150}," blockchains",[136,159,160],{"class":146}," }",[136,162,164],{"class":163},"stCPd"," from",[136,166,168],{"class":167},"scVjq"," \"",[136,170,172],{"class":171},"sQ7BG","@agntn\u002Fkeys",[136,174,175],{"class":167},"\"",[136,177,178],{"class":146},";\n",[136,180,182],{"class":138,"line":181},2,[136,183,185],{"emptyLinePlaceholder":184},true,"\n",[136,187,189,193,197,200,203,206,210,213,216,218],{"class":138,"line":188},3,[136,190,192],{"class":191},"s1TYA","const",[136,194,196],{"class":195},"saoiD"," zcashChain",[136,198,199],{"class":191}," =",[136,201,151],{"class":202},"sULi6",[136,204,205],{"class":146},"(",[136,207,209],{"class":208},"sZW6a","await",[136,211,157],{"class":212},"spVlQ",[136,214,215],{"class":146},".",[136,217,118],{"class":202},[136,219,220],{"class":146},"()());\n",[136,222,224,226,229,231,233,235,237,239,241,243,246,249,252,254,257,259],{"class":138,"line":223},4,[136,225,192],{"class":191},[136,227,228],{"class":195}," testnet",[136,230,199],{"class":191},[136,232,151],{"class":202},[136,234,205],{"class":146},[136,236,209],{"class":208},[136,238,157],{"class":212},[136,240,215],{"class":146},[136,242,118],{"class":202},[136,244,245],{"class":146},"({",[136,247,248],{"class":150}," network",[136,250,251],{"class":146},":",[136,253,168],{"class":167},[136,255,256],{"class":171},"testnet",[136,258,175],{"class":167},[136,260,261],{"class":146}," })());\n",[263,264,265,266,269,270,273,274,277],"p",{},"Mainnet and testnet only, anything else throws in the constructor. Regtest in zcashd uses the testnet base58 bytes, so a testnet driver reads its ",[133,267,268],{},"tm"," and ",[133,271,272],{},"t2"," addresses. Not its TEX addresses though, those get a ",[133,275,276],{},"texregtest"," prefix of their own.",[121,279,281],{"id":280},"transparent-not-shielded","Transparent, not shielded",[263,283,284,285,288,289,292],{},"Zcash has two worlds. The shielded one (Sapling ",[133,286,287],{},"zs1",", Orchard inside unified ",[133,290,291],{},"u1"," addresses) runs on Jubjub and Pallas keys with ZIP-32 derivation, and none of that is secp256k1. The transparent one is basically Bitcoin from 2016. This driver does the transparent one and nothing else.",[263,294,295,296,299,300,302,303,305],{},"So ",[133,297,298],{},"validateAddress"," answers false for a perfectly good ",[133,301,287],{}," or ",[133,304,291],{}," address. False here means \"not transparent\", not \"not Zcash\". Keep that in mind before you tell anyone their shielded address is broken.",[121,307,309],{"id":308},"the-address","The address",[263,311,312,315,316,319,320,215],{},[133,313,314],{},"RIPEMD160(SHA256(pubkey))",", two version bytes in front, base58check. The two bytes are the whole difference from Bitcoin, and the reason every address starts with ",[133,317,318],{},"t",". The bytes come from zcashd v6.20.0 ",[133,321,322],{},"chainparams.cpp",[324,325,326,342],"table",{},[327,328,329],"thead",{},[330,331,332,336,339],"tr",{},[333,334,335],"th",{},"Network",[333,337,338],{},"P2PKH",[333,340,341],{},"P2SH",[343,344,345,368],"tbody",{},[330,346,347,351,360],{},[348,349,350],"td",{},"mainnet",[348,352,353,356,357],{},[133,354,355],{},"1c b8",", starts with ",[133,358,359],{},"t1",[348,361,362,356,365],{},[133,363,364],{},"1c bd",[133,366,367],{},"t3",[330,369,370,372,379],{},[348,371,256],{},[348,373,374,356,377],{},[133,375,376],{},"1d 25",[133,378,268],{},[348,380,381,356,384],{},[133,382,383],{},"1c ba",[133,385,272],{},[126,387,389],{"className":128,"code":388,"language":130,"meta":131,"style":131},"const privateKey = \"0000000000000000000000000000000000000000000000000000000000000001\";\nconst publicKey = zcashChain.getKeyPublic(privateKey);\n\nzcashChain.getAddress(publicKey); \u002F\u002F t1UYsZVJkLPeMjxEtACvSxfWuNmddpWfxzs\ntestnet.getAddress(publicKey); \u002F\u002F tmLPctKo9j49rtCSKpwEBpLBeykiTGomGQs\n",[133,390,391,409,433,437,459],{"__ignoreMap":131},[136,392,393,395,398,400,402,405,407],{"class":138,"line":139},[136,394,192],{"class":191},[136,396,397],{"class":195}," privateKey",[136,399,199],{"class":191},[136,401,168],{"class":167},[136,403,404],{"class":171},"0000000000000000000000000000000000000000000000000000000000000001",[136,406,175],{"class":167},[136,408,178],{"class":146},[136,410,411,413,416,418,420,422,425,427,430],{"class":138,"line":181},[136,412,192],{"class":191},[136,414,415],{"class":195}," publicKey",[136,417,199],{"class":191},[136,419,196],{"class":212},[136,421,215],{"class":146},[136,423,424],{"class":202},"getKeyPublic",[136,426,205],{"class":146},[136,428,429],{"class":212},"privateKey",[136,431,432],{"class":146},");\n",[136,434,435],{"class":138,"line":188},[136,436,185],{"emptyLinePlaceholder":184},[136,438,439,442,444,447,449,452,455],{"class":138,"line":223},[136,440,441],{"class":212},"zcashChain",[136,443,215],{"class":146},[136,445,446],{"class":202},"getAddress",[136,448,205],{"class":146},[136,450,451],{"class":212},"publicKey",[136,453,454],{"class":146},"); ",[136,456,458],{"class":457},"sjhu3","\u002F\u002F t1UYsZVJkLPeMjxEtACvSxfWuNmddpWfxzs\n",[136,460,462,464,466,468,470,472,474],{"class":138,"line":461},5,[136,463,256],{"class":212},[136,465,215],{"class":146},[136,467,446],{"class":202},[136,469,205],{"class":146},[136,471,451],{"class":212},[136,473,454],{"class":146},[136,475,476],{"class":457},"\u002F\u002F tmLPctKo9j49rtCSKpwEBpLBeykiTGomGQs\n",[263,478,479,482,483,486,487,490,491,494,495,215],{},[133,480,481],{},"legacy"," is the only type it writes. Zcash never had SegWit, and the library's ",[133,484,485],{},"p2sh"," type is P2SH wrapping a P2WPKH program, which anyone can spend on a chain without SegWit. So ",[133,488,489],{},"\"p2sh\"",", ",[133,492,493],{},"\"segwit\""," and the rest throw a ",[133,496,497],{},"RangeError",[121,499,501],{"id":500},"validation","Validation",[126,503,505],{"className":128,"code":504,"language":130,"meta":131,"style":131},"zcashChain.validateAddress(\"t1UYsZVJkLPeMjxEtACvSxfWuNmddpWfxzs\"); \u002F\u002F true\nzcashChain.validateAddress(\"t3VDyGHn9mbyCf448m2cHTu5uXvsJpKHbiZ\"); \u002F\u002F true, P2SH\nzcashChain.validateAddress(\"tex1s2rt77ggv6q989lr49rkgzmh5slsksa9khdgte\"); \u002F\u002F true, TEX\nzcashChain.validateAddress(\"1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH\"); \u002F\u002F false, Bitcoin's version byte\n",[133,506,507,529,551,573],{"__ignoreMap":131},[136,508,509,511,513,515,517,519,522,524,526],{"class":138,"line":139},[136,510,441],{"class":212},[136,512,215],{"class":146},[136,514,298],{"class":202},[136,516,205],{"class":146},[136,518,175],{"class":167},[136,520,521],{"class":171},"t1UYsZVJkLPeMjxEtACvSxfWuNmddpWfxzs",[136,523,175],{"class":167},[136,525,454],{"class":146},[136,527,528],{"class":457},"\u002F\u002F true\n",[136,530,531,533,535,537,539,541,544,546,548],{"class":138,"line":181},[136,532,441],{"class":212},[136,534,215],{"class":146},[136,536,298],{"class":202},[136,538,205],{"class":146},[136,540,175],{"class":167},[136,542,543],{"class":171},"t3VDyGHn9mbyCf448m2cHTu5uXvsJpKHbiZ",[136,545,175],{"class":167},[136,547,454],{"class":146},[136,549,550],{"class":457},"\u002F\u002F true, P2SH\n",[136,552,553,555,557,559,561,563,566,568,570],{"class":138,"line":188},[136,554,441],{"class":212},[136,556,215],{"class":146},[136,558,298],{"class":202},[136,560,205],{"class":146},[136,562,175],{"class":167},[136,564,565],{"class":171},"tex1s2rt77ggv6q989lr49rkgzmh5slsksa9khdgte",[136,567,175],{"class":167},[136,569,454],{"class":146},[136,571,572],{"class":457},"\u002F\u002F true, TEX\n",[136,574,575,577,579,581,583,585,588,590,592],{"class":138,"line":223},[136,576,441],{"class":212},[136,578,215],{"class":146},[136,580,298],{"class":202},[136,582,205],{"class":146},[136,584,175],{"class":167},[136,586,587],{"class":171},"1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH",[136,589,175],{"class":167},[136,591,454],{"class":146},[136,593,594],{"class":457},"\u002F\u002F false, Bitcoin's version byte\n",[263,596,597,598,601],{},"P2PKH and P2SH under the driver's own version bytes, plus TEX. A TEX address from ZIP-320 is the same 20 byte P2PKH hash in bech32m under ",[133,599,600],{},"tex",", and it tells the sending wallet to pay from transparent funds only. ZIP-320 exists because Binance wanted exactly that for deposits, so it passes. The library never writes one, same as P2SH. A testnet address fails on mainnet and the other way round.",[263,603,604,605,269,608,611],{},"The vectors in the tests come from zcashd's own ",[133,606,607],{},"key_tests.cpp",[133,609,610],{},"base58_keys_valid.json",", the TEX pair from ZIP-320, and the shielded addresses that have to fail from librustzcash.",[121,613,615],{"id":614},"mnemonics","Mnemonics",[263,617,618,619,622],{},"BIP32 on ",[133,620,621],{},"m\u002F44'\u002F133'\u002Faccount'\u002Fchange\u002Findex",", coin type 133 from SLIP-0044.",[126,624,626],{"className":128,"code":625,"language":130,"meta":131,"style":131},"const mnemonic =\n  \"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about\";\n\nzcashChain.deriveHDWallet(mnemonic, \"m\u002F44'\u002F133'\u002F0'\u002F0\u002F0\").address;\n\u002F\u002F t1XVXWCvpMgBvUaed4XDqWtgQgJSu1Ghz7F, the same address Ledger Live derives\n",[133,627,628,638,650,654,685],{"__ignoreMap":131},[136,629,630,632,635],{"class":138,"line":139},[136,631,192],{"class":191},[136,633,634],{"class":195}," mnemonic",[136,636,637],{"class":191}," =\n",[136,639,640,643,646,648],{"class":138,"line":181},[136,641,642],{"class":167},"  \"",[136,644,645],{"class":171},"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",[136,647,175],{"class":167},[136,649,178],{"class":146},[136,651,652],{"class":138,"line":188},[136,653,185],{"emptyLinePlaceholder":184},[136,655,656,658,660,663,665,668,670,672,675,677,680,683],{"class":138,"line":223},[136,657,441],{"class":212},[136,659,215],{"class":146},[136,661,662],{"class":202},"deriveHDWallet",[136,664,205],{"class":146},[136,666,667],{"class":212},"mnemonic",[136,669,490],{"class":146},[136,671,175],{"class":167},[136,673,674],{"class":171},"m\u002F44'\u002F133'\u002F0'\u002F0\u002F0",[136,676,175],{"class":167},[136,678,679],{"class":146},").",[136,681,682],{"class":212},"address",[136,684,178],{"class":146},[136,686,687],{"class":138,"line":461},[136,688,689],{"class":457},"\u002F\u002F t1XVXWCvpMgBvUaed4XDqWtgQgJSu1Ghz7F, the same address Ledger Live derives\n",[263,691,692,693,696,697,699,700,702],{},"The purpose level doesn't pick a format, there's only one. ",[133,694,695],{},"m\u002F84'"," still gives you a ",[133,698,359],{}," address, and an explicit ",[133,701,489],{}," still throws.",[263,704,705,706,709,710,713],{},"One trap on testnet. zcashd walks coin type 1 there, but ",[133,707,708],{},"getDerivationPath"," writes 133 on every network, like every other driver in the library. For a testnet wallet that has to match zcashd, pass ",[133,711,712],{},"m\u002F44'\u002F1'\u002F0'\u002F0\u002F0"," yourself.",[263,715,716,717,269,720,723,724,727],{},"WIF works without a Zcash entry. Zcash kept Bitcoin's ",[133,718,719],{},"0x80",[133,721,722],{},"0xef",", so ",[133,725,726],{},"decodeWIF(wif, { chain: \"bitcoin\" })"," reads a key exported from zcashd.",[121,729,731],{"id":730},"signing","Signing",[263,733,734,735,738,739,742,743,745,746,749],{},"zcashd signs under ",[133,736,737],{},"\"\\x16Zcash Signed Message:\\n\"",", then does what Bitcoin does: compact size lengths, double SHA-256, secp256k1. Only the preamble differs, and that's enough for a Bitcoin signature to fail here. The tests take the signature from Zallet's ",[133,740,741],{},"verifymessage"," test, recover its key, get Zallet's ",[133,744,359],{}," address back and verify it. ",[133,747,748],{},"{ recovered: true }"," throws, same as on Bitcoin.",[121,751,753],{"id":752},"where-it-lives","Where it lives",[263,755,756,759,760,763,764,767,768,771],{},[133,757,758],{},"src\u002Fblockchains\u002Fzcash.ts"," has the version bytes, the preamble and the address rules. It extends ",[133,761,762],{},"AbstractBitcoinMessageBlockchain"," in ",[133,765,766],{},"src\u002Futils\u002Fbitcoin.ts",", the part of the Bitcoin base with keys and signed messages and none of the address formats. The base58 helpers in ",[133,769,770],{},"src\u002Futils\u002Faddress.ts"," take one version byte, so the driver puts its two bytes on the hash itself.",[773,774,775],"style",{},"html pre.shiki code .sP0CR, html code.shiki .sP0CR{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#5DE4C7}html pre.shiki code .sKlNE, html code.shiki .sKlNE{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#A6ACCD}html pre.shiki code .snHMy, html code.shiki .snHMy{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#ADD7FF}html pre.shiki code .stCPd, html code.shiki .stCPd{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#A6ACCD}html pre.shiki code .scVjq, html code.shiki .scVjq{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#A6ACCD}html pre.shiki code .sQ7BG, html code.shiki .sQ7BG{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#5DE4C7}html pre.shiki code .s1TYA, html code.shiki .s1TYA{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#91B4D5}html pre.shiki code .saoiD, html code.shiki .saoiD{--shiki-light:#005CC5;--shiki-default:#005CC5;--shiki-dark:#E4F0FB}html pre.shiki code .sULi6, html code.shiki .sULi6{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#E4F0FBD0}html pre.shiki code .sZW6a, html code.shiki .sZW6a{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#5DE4C7C0}html pre.shiki code .spVlQ, html code.shiki .spVlQ{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#E4F0FB}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sjhu3, html code.shiki .sjhu3{--shiki-light:#6A737D;--shiki-light-font-style:inherit;--shiki-default:#6A737D;--shiki-default-font-style:inherit;--shiki-dark:#767C9DB0;--shiki-dark-font-style:italic}",{"title":131,"searchDepth":181,"depth":181,"links":777},[778,779,780,781,782,783,784],{"id":123,"depth":181,"text":124},{"id":280,"depth":181,"text":281},{"id":308,"depth":181,"text":309},{"id":500,"depth":181,"text":501},{"id":614,"depth":181,"text":615},{"id":730,"depth":181,"text":731},{"id":752,"depth":181,"text":753},"Transparent Zcash only. Bitcoin's P2PKH behind two version bytes, a t1 address, and nothing shielded.","md",null,{"icon":789},"i-token-zec",{"title":104,"description":785},"0Qo_-FWtgkrfAE9i1tJ0QqDW1H3O45AP41Ki7J2l6LU",[793,787],{"title":100,"path":101,"stem":102,"description":794,"children":-1},"secp256k1 with Ethereum's 20 byte hash wrapped in base58check so every address starts with T.",1790282411352]