[{"data":1,"prerenderedAt":1503},["ShallowReactive",2],{"navigation_docs":3,"-guide-wallets":84,"-guide-wallets-surround":1498},[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":83},"Blockchains","\u002Fblockchains","2.blockchains\u002F0.index",[37,39,43,47,51,55,59,63,67,71,75,79],{"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},"Cardano","\u002Fblockchains\u002Fcardano","2.blockchains\u002Fcardano",{"title":56,"path":57,"stem":58},"Decred","\u002Fblockchains\u002Fdecred","2.blockchains\u002Fdecred",{"title":60,"path":61,"stem":62},"Ethereum","\u002Fblockchains\u002Fethereum","2.blockchains\u002Fethereum",{"title":64,"path":65,"stem":66},"Litecoin","\u002Fblockchains\u002Flitecoin","2.blockchains\u002Flitecoin",{"title":68,"path":69,"stem":70},"Solana","\u002Fblockchains\u002Fsolana","2.blockchains\u002Fsolana",{"title":72,"path":73,"stem":74},"Stellar","\u002Fblockchains\u002Fstellar","2.blockchains\u002Fstellar",{"title":76,"path":77,"stem":78},"Sui","\u002Fblockchains\u002Fsui","2.blockchains\u002Fsui",{"title":80,"path":81,"stem":82},"TRON","\u002Fblockchains\u002Ftron","2.blockchains\u002Ftron","i-lucide-boxes",{"id":85,"title":20,"body":86,"description":1491,"extension":1492,"links":1493,"meta":1494,"navigation":244,"path":21,"seo":1496,"stem":22,"__hash__":1497},"docs\u002F1.guide\u002F4.wallets.md",{"type":87,"value":88,"toc":1481},"minimark",[89,94,98,173,179,183,345,355,434,437,441,518,534,538,544,656,659,705,708,712,718,820,823,826,928,950,961,965,975,1289,1320,1323,1330,1334,1337,1341,1347,1470,1477],[90,91,93],"h2",{"id":92},"what-a-wallet-is-here","What a wallet is here",[95,96,97],"p",{},"Keys plus the address they map to. Nothing else, no storage, no balance, no transactions.",[99,100,105],"pre",{"className":101,"code":102,"language":103,"meta":104,"style":104},"language-typescript shiki shiki-themes github-light github-light poimandres","interface Wallet extends Keys {\n  address: string;\n  warnings?: readonly string[];\n}\n","typescript","",[106,107,108,133,150,167],"code",{"__ignoreMap":104},[109,110,113,117,121,125,129],"span",{"class":111,"line":112},"line",1,[109,114,116],{"class":115},"s1TYA","interface",[109,118,120],{"class":119},"sCrqT"," Wallet",[109,122,124],{"class":123},"sP0CR"," extends",[109,126,128],{"class":127},"scZRh"," Keys",[109,130,132],{"class":131},"sKlNE"," {\n",[109,134,136,140,143,147],{"class":111,"line":135},2,[109,137,139],{"class":138},"s0VbO","  address",[109,141,142],{"class":115},":",[109,144,146],{"class":145},"s8yaW"," string",[109,148,149],{"class":131},";\n",[109,151,153,156,159,162,164],{"class":111,"line":152},3,[109,154,155],{"class":138},"  warnings",[109,157,158],{"class":115},"?:",[109,160,161],{"class":123}," readonly",[109,163,146],{"class":145},[109,165,166],{"class":131},"[];\n",[109,168,170],{"class":111,"line":169},4,[109,171,172],{"class":131},"}\n",[95,174,175,178],{},[106,176,177],{},"warnings"," only shows up when you asked for a derivation a stricter library would refuse. More on that below.",[90,180,182],{"id":181},"new-wallet","New wallet",[99,184,188],{"className":185,"code":186,"language":187,"meta":104,"style":104},"language-js shiki shiki-themes github-light github-light poimandres","import { useBlockchain } from \"@agntn\u002Fkeys\";\nimport Bitcoin from \"@agntn\u002Fkeys\u002Fblockchains\u002Fbitcoin\";\n\nconst chain = useBlockchain(new Bitcoin());\nconst wallet = chain.generateWallet();\n\nwallet.keys.private;\nwallet.keys.public;\nwallet.address;\n","js",[106,189,190,222,240,246,272,294,299,317,333],{"__ignoreMap":104},[109,191,192,195,198,202,205,209,213,217,220],{"class":111,"line":112},[109,193,194],{"class":123},"import",[109,196,197],{"class":131}," {",[109,199,201],{"class":200},"snHMy"," useBlockchain",[109,203,204],{"class":131}," }",[109,206,208],{"class":207},"stCPd"," from",[109,210,212],{"class":211},"scVjq"," \"",[109,214,216],{"class":215},"sQ7BG","@agntn\u002Fkeys",[109,218,219],{"class":211},"\"",[109,221,149],{"class":131},[109,223,224,226,229,231,233,236,238],{"class":111,"line":135},[109,225,194],{"class":123},[109,227,228],{"class":200}," Bitcoin",[109,230,208],{"class":207},[109,232,212],{"class":211},[109,234,235],{"class":215},"@agntn\u002Fkeys\u002Fblockchains\u002Fbitcoin",[109,237,219],{"class":211},[109,239,149],{"class":131},[109,241,242],{"class":111,"line":152},[109,243,245],{"emptyLinePlaceholder":244},true,"\n",[109,247,248,251,255,258,261,264,267,269],{"class":111,"line":169},[109,249,250],{"class":115},"const",[109,252,254],{"class":253},"saoiD"," chain",[109,256,257],{"class":115}," =",[109,259,201],{"class":260},"sULi6",[109,262,263],{"class":131},"(",[109,265,266],{"class":123},"new",[109,268,228],{"class":260},[109,270,271],{"class":131},"());\n",[109,273,275,277,280,282,285,288,291],{"class":111,"line":274},5,[109,276,250],{"class":115},[109,278,279],{"class":253}," wallet",[109,281,257],{"class":115},[109,283,254],{"class":284},"spVlQ",[109,286,287],{"class":131},".",[109,289,290],{"class":260},"generateWallet",[109,292,293],{"class":131},"();\n",[109,295,297],{"class":111,"line":296},6,[109,298,245],{"emptyLinePlaceholder":244},[109,300,302,305,307,310,312,315],{"class":111,"line":301},7,[109,303,304],{"class":284},"wallet",[109,306,287],{"class":131},[109,308,309],{"class":284},"keys",[109,311,287],{"class":131},[109,313,314],{"class":284},"private",[109,316,149],{"class":131},[109,318,320,322,324,326,328,331],{"class":111,"line":319},8,[109,321,304],{"class":284},[109,323,287],{"class":131},[109,325,309],{"class":284},[109,327,287],{"class":131},[109,329,330],{"class":284},"public",[109,332,149],{"class":131},[109,334,336,338,340,343],{"class":111,"line":335},9,[109,337,304],{"class":284},[109,339,287],{"class":131},[109,341,342],{"class":284},"address",[109,344,149],{"class":131},[95,346,347,348,351,352,287],{},"Two optional arguments: key options first, address type second. The key options go to ",[106,349,350],{},"generateKeys",", the address type to ",[106,353,354],{},"getAddress",[99,356,358],{"className":185,"code":357,"language":187,"meta":104,"style":104},"chain.generateWallet({ compressed: false }); \u002F\u002F uncompressed public key, legacy address\nchain.generateWallet({}, \"p2sh\"); \u002F\u002F starts with 3\nchain.generateWallet({}, \"taproot\"); \u002F\u002F starts with bc1p\n",[106,359,360,388,412],{"__ignoreMap":104},[109,361,362,365,367,369,372,375,377,381,384],{"class":111,"line":112},[109,363,364],{"class":284},"chain",[109,366,287],{"class":131},[109,368,290],{"class":260},[109,370,371],{"class":131},"({",[109,373,374],{"class":200}," compressed",[109,376,142],{"class":131},[109,378,380],{"class":379},"sNe8j"," false",[109,382,383],{"class":131}," }); ",[109,385,387],{"class":386},"sjhu3","\u002F\u002F uncompressed public key, legacy address\n",[109,389,390,392,394,396,399,401,404,406,409],{"class":111,"line":135},[109,391,364],{"class":284},[109,393,287],{"class":131},[109,395,290],{"class":260},[109,397,398],{"class":131},"({}, ",[109,400,219],{"class":211},[109,402,403],{"class":215},"p2sh",[109,405,219],{"class":211},[109,407,408],{"class":131},"); ",[109,410,411],{"class":386},"\u002F\u002F starts with 3\n",[109,413,414,416,418,420,422,424,427,429,431],{"class":111,"line":152},[109,415,364],{"class":284},[109,417,287],{"class":131},[109,419,290],{"class":260},[109,421,398],{"class":131},[109,423,219],{"class":211},[109,425,426],{"class":215},"taproot",[109,428,219],{"class":211},[109,430,408],{"class":131},[109,432,433],{"class":386},"\u002F\u002F starts with bc1p\n",[95,435,436],{},"That empty object in the middle is annoying but honest: the address type is the second parameter and there's no overload that lets you skip the first.",[90,438,440],{"id":439},"a-key-you-already-have","A key you already have",[99,442,444],{"className":185,"code":443,"language":187,"meta":104,"style":104},"const privateKey = \"7f9e5b9e3bbed34a4c28c8c1665525fc2cd7afb4fdc7edca3eb93ddf8a31ef56\";\nconst wallet = chain.deriveWallet(privateKey);\nconst segwitWallet = chain.deriveWallet(privateKey, {}, \"segwit\");\n",[106,445,446,464,487],{"__ignoreMap":104},[109,447,448,450,453,455,457,460,462],{"class":111,"line":112},[109,449,250],{"class":115},[109,451,452],{"class":253}," privateKey",[109,454,257],{"class":115},[109,456,212],{"class":211},[109,458,459],{"class":215},"7f9e5b9e3bbed34a4c28c8c1665525fc2cd7afb4fdc7edca3eb93ddf8a31ef56",[109,461,219],{"class":211},[109,463,149],{"class":131},[109,465,466,468,470,472,474,476,479,481,484],{"class":111,"line":135},[109,467,250],{"class":115},[109,469,279],{"class":253},[109,471,257],{"class":115},[109,473,254],{"class":284},[109,475,287],{"class":131},[109,477,478],{"class":260},"deriveWallet",[109,480,263],{"class":131},[109,482,483],{"class":284},"privateKey",[109,485,486],{"class":131},");\n",[109,488,489,491,494,496,498,500,502,504,506,509,511,514,516],{"class":111,"line":152},[109,490,250],{"class":115},[109,492,493],{"class":253}," segwitWallet",[109,495,257],{"class":115},[109,497,254],{"class":284},[109,499,287],{"class":131},[109,501,478],{"class":260},[109,503,263],{"class":131},[109,505,483],{"class":284},[109,507,508],{"class":131},", {}, ",[109,510,219],{"class":211},[109,512,513],{"class":215},"segwit",[109,515,219],{"class":211},[109,517,486],{"class":131},[95,519,520,521,523,524,527,528,533],{},"Same arguments as ",[106,522,290],{},", minus the randomness. Got a WIF instead of hex? ",[106,525,526],{},"decodeWIF"," on the ",[529,530,532],"a",{"href":531},"\u002Fguide\u002Fkeys#wif","keys page"," turns it into the hex this call wants, compression flag included.",[90,535,537],{"id":536},"from-a-mnemonic","From a mnemonic",[95,539,540,543],{},[106,541,542],{},"deriveHDWallet"," walks a BIP39 mnemonic down a derivation path and returns the wallet at the end:",[99,545,547],{"className":185,"code":546,"language":187,"meta":104,"style":104},"const mnemonic =\n  \"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about\";\n\nchain.deriveHDWallet(mnemonic, \"m\u002F84'\u002F0'\u002F0'\u002F0\u002F0\").address; \u002F\u002F bc1q...\nchain.deriveHDWallet(mnemonic, \"m\u002F44'\u002F0'\u002F0'\u002F0\u002F0\", { passphrase: \"TREZOR\" }, \"p2sh\");\n",[106,548,549,559,571,575,609],{"__ignoreMap":104},[109,550,551,553,556],{"class":111,"line":112},[109,552,250],{"class":115},[109,554,555],{"class":253}," mnemonic",[109,557,558],{"class":115}," =\n",[109,560,561,564,567,569],{"class":111,"line":135},[109,562,563],{"class":211},"  \"",[109,565,566],{"class":215},"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",[109,568,219],{"class":211},[109,570,149],{"class":131},[109,572,573],{"class":111,"line":152},[109,574,245],{"emptyLinePlaceholder":244},[109,576,577,579,581,583,585,588,591,593,596,598,601,603,606],{"class":111,"line":169},[109,578,364],{"class":284},[109,580,287],{"class":131},[109,582,542],{"class":260},[109,584,263],{"class":131},[109,586,587],{"class":284},"mnemonic",[109,589,590],{"class":131},", ",[109,592,219],{"class":211},[109,594,595],{"class":215},"m\u002F84'\u002F0'\u002F0'\u002F0\u002F0",[109,597,219],{"class":211},[109,599,600],{"class":131},").",[109,602,342],{"class":284},[109,604,605],{"class":131},"; ",[109,607,608],{"class":386},"\u002F\u002F bc1q...\n",[109,610,611,613,615,617,619,621,623,625,628,630,633,636,638,640,643,645,648,650,652,654],{"class":111,"line":274},[109,612,364],{"class":284},[109,614,287],{"class":131},[109,616,542],{"class":260},[109,618,263],{"class":131},[109,620,587],{"class":284},[109,622,590],{"class":131},[109,624,219],{"class":211},[109,626,627],{"class":215},"m\u002F44'\u002F0'\u002F0'\u002F0\u002F0",[109,629,219],{"class":211},[109,631,632],{"class":131},", {",[109,634,635],{"class":200}," passphrase",[109,637,142],{"class":131},[109,639,212],{"class":211},[109,641,642],{"class":215},"TREZOR",[109,644,219],{"class":211},[109,646,647],{"class":131}," }, ",[109,649,219],{"class":211},[109,651,403],{"class":215},[109,653,219],{"class":211},[109,655,486],{"class":131},[95,657,658],{},"Things that will bite you:",[660,661,662,666,677,696,699],"ul",{},[663,664,665],"li",{},"The mnemonic has to be English BIP39 words, 12, 15, 18, 21 or 24 of them, and the checksum has to hold. A typo in word eleven fails before any derivation happens. The checksum part is negotiable, see the next section.",[663,667,668,669,672,673,676],{},"secp256k1 chains derive with BIP32, ed25519 chains with SLIP-10. SLIP-10 only has hardened children, so Solana, Stellar, Aptos, and Sui on ed25519 need every segment hardened: ",[106,670,671],{},"m\u002F44'\u002F501'\u002F0'\u002F0'",". ",[106,674,675],{},"chain.getDerivationPath(account)"," writes the path that chain's wallets use, hardened where it has to be and no deeper than the chain goes, so you don't have to remember which one stops where.",[663,678,679,680,683,684,687,688,691,692,695],{},"Bitcoin and Litecoin read the purpose when you don't pass an address type. ",[106,681,682],{},"m\u002F44'"," gives legacy, ",[106,685,686],{},"m\u002F49'"," p2sh, ",[106,689,690],{},"m\u002F84'"," segwit, ",[106,693,694],{},"m\u002F86'"," taproot. An explicit type wins.",[663,697,698],{},"Cardano throws. CIP-1852 starts from the entropy, not from the BIP39 seed, and pretending otherwise would hand you addresses that no Cardano wallet recognises.",[663,700,701,702,704],{},"Decred throws too. Its HD derivation strips leading zero bytes where BIP32 keeps them, so a plain BIP32 walk lands on the wrong key for some paths and looks fine doing it. ",[106,703,478],{}," with a private key works on both.",[95,706,707],{},"The mnemonic above is the public BIP39 test vector. It's fine for docs and tests and for nothing else.",[90,709,711],{"id":710},"puzzle-mnemonics","Puzzle mnemonics",[95,713,714,715,717],{},"A puzzle phrase with a broken checksum isn't a wrong answer, it's Tuesday. Without a flag ",[106,716,542],{}," throws on it. With the flag you get the wallet and a warning, the words exactly as given, nothing repaired:",[99,719,721],{"className":185,"code":720,"language":187,"meta":104,"style":104},"const puzzle =\n  \"path mad alien apology escape spare miss goddess leopard crime visit clock start first blade guard close barrel term screen matrix toy ghost shine\";\n\nconst wallet = chain.deriveHDWallet(puzzle, \"m\u002F84'\u002F0'\u002F0'\u002F0\u002F0\", { allowInvalidChecksum: true });\n\nwallet.address; \u002F\u002F bc1q94ecsn0qk8lap2gefrycnms3ruepy889z969a6\nwallet.warnings;\n\u002F\u002F [ 'BIP39 checksum is invalid. Derived from the supplied words without repairing the checksum.' ]\n",[106,722,723,732,743,747,788,792,805,815],{"__ignoreMap":104},[109,724,725,727,730],{"class":111,"line":112},[109,726,250],{"class":115},[109,728,729],{"class":253}," puzzle",[109,731,558],{"class":115},[109,733,734,736,739,741],{"class":111,"line":135},[109,735,563],{"class":211},[109,737,738],{"class":215},"path mad alien apology escape spare miss goddess leopard crime visit clock start first blade guard close barrel term screen matrix toy ghost shine",[109,740,219],{"class":211},[109,742,149],{"class":131},[109,744,745],{"class":111,"line":152},[109,746,245],{"emptyLinePlaceholder":244},[109,748,749,751,753,755,757,759,761,763,766,768,770,772,774,776,779,781,785],{"class":111,"line":169},[109,750,250],{"class":115},[109,752,279],{"class":253},[109,754,257],{"class":115},[109,756,254],{"class":284},[109,758,287],{"class":131},[109,760,542],{"class":260},[109,762,263],{"class":131},[109,764,765],{"class":284},"puzzle",[109,767,590],{"class":131},[109,769,219],{"class":211},[109,771,595],{"class":215},[109,773,219],{"class":211},[109,775,632],{"class":131},[109,777,778],{"class":200}," allowInvalidChecksum",[109,780,142],{"class":131},[109,782,784],{"class":783},"siHFe"," true",[109,786,787],{"class":131}," });\n",[109,789,790],{"class":111,"line":274},[109,791,245],{"emptyLinePlaceholder":244},[109,793,794,796,798,800,802],{"class":111,"line":296},[109,795,304],{"class":284},[109,797,287],{"class":131},[109,799,342],{"class":284},[109,801,605],{"class":131},[109,803,804],{"class":386},"\u002F\u002F bc1q94ecsn0qk8lap2gefrycnms3ruepy889z969a6\n",[109,806,807,809,811,813],{"class":111,"line":301},[109,808,304],{"class":284},[109,810,287],{"class":131},[109,812,177],{"class":284},[109,814,149],{"class":131},[109,816,817],{"class":111,"line":319},[109,818,819],{"class":386},"\u002F\u002F [ 'BIP39 checksum is invalid. Derived from the supplied words without repairing the checksum.' ]\n",[95,821,822],{},"The flag only relaxes the checksum. Word count and dictionary are still enforced, whitespace still collapses and NFKD still applies, so it isn't a back door for arbitrary text. Valid phrases give the same result with or without it.",[95,824,825],{},"To see which check failed, ask before deriving:",[99,827,829],{"className":185,"code":828,"language":187,"meta":104,"style":104},"import { inspectBIP39Mnemonic, getMnemonicWordCandidates } from \"@agntn\u002Fkeys\u002Fbip39\";\n\ninspectBIP39Mnemonic(puzzle);\n\u002F\u002F { valid: false, words: 24, wordCountValid: true, wordlistValid: true, checksumValid: false }\n\ngetMnemonicWordCandidates(puzzle.replace(\u002Fshine$\u002F, \"?\"));\n\u002F\u002F [ 'aware', 'divide', 'embark', 'globe', 'pact', 'roof', 'solve', 'today' ]\n",[106,830,831,859,863,874,879,883,923],{"__ignoreMap":104},[109,832,833,835,837,840,843,846,848,850,852,855,857],{"class":111,"line":112},[109,834,194],{"class":123},[109,836,197],{"class":131},[109,838,839],{"class":200}," inspectBIP39Mnemonic",[109,841,842],{"class":131},",",[109,844,845],{"class":200}," getMnemonicWordCandidates",[109,847,204],{"class":131},[109,849,208],{"class":207},[109,851,212],{"class":211},[109,853,854],{"class":215},"@agntn\u002Fkeys\u002Fbip39",[109,856,219],{"class":211},[109,858,149],{"class":131},[109,860,861],{"class":111,"line":135},[109,862,245],{"emptyLinePlaceholder":244},[109,864,865,868,870,872],{"class":111,"line":152},[109,866,867],{"class":260},"inspectBIP39Mnemonic",[109,869,263],{"class":131},[109,871,765],{"class":284},[109,873,486],{"class":131},[109,875,876],{"class":111,"line":169},[109,877,878],{"class":386},"\u002F\u002F { valid: false, words: 24, wordCountValid: true, wordlistValid: true, checksumValid: false }\n",[109,880,881],{"class":111,"line":274},[109,882,245],{"emptyLinePlaceholder":244},[109,884,885,888,890,892,894,897,899,902,906,909,911,913,915,918,920],{"class":111,"line":296},[109,886,887],{"class":260},"getMnemonicWordCandidates",[109,889,263],{"class":131},[109,891,765],{"class":284},[109,893,287],{"class":131},[109,895,896],{"class":260},"replace",[109,898,263],{"class":131},[109,900,901],{"class":211},"\u002F",[109,903,905],{"class":904},"sLrG9","shine",[109,907,908],{"class":207},"$",[109,910,901],{"class":211},[109,912,590],{"class":131},[109,914,219],{"class":211},[109,916,917],{"class":215},"?",[109,919,219],{"class":211},[109,921,922],{"class":131},"));\n",[109,924,925],{"class":111,"line":301},[109,926,927],{"class":386},"\u002F\u002F [ 'aware', 'divide', 'embark', 'globe', 'pact', 'roof', 'solve', 'today' ]\n",[95,929,930,932,933,936,937,940,941,943,944,946,947,949],{},[106,931,867],{}," splits the verdict three ways and never echoes the phrase. ",[106,934,935],{},"checksumValid"," is ",[106,938,939],{},"null"," when the count or the dictionary already failed, because there's nothing to check yet. ",[106,942,887],{}," takes a phrase with exactly one ",[106,945,917],{}," and returns every English word that makes the checksum pass, in list order. ",[106,948,905],{}," isn't one of the eight, and each of the eight opens a different wallet, so the library won't pick one for you. That's how a \"fixed\" mnemonic loses a puzzle.",[95,951,952,953,956,957,960],{},"Both helpers and the flag are English only. The other nine word lists are there for lookups and generation, ",[106,954,955],{},"lookupBIP39Words"," and ",[106,958,959],{},"loadBIP39Wordlist"," on the same import. The MCP and Pi tools expose the same flag and the same diagnostics.",[90,962,964],{"id":963},"electrum-is-a-different-scheme","Electrum is a different scheme",[95,966,967,970,971,974],{},[106,968,969],{},"allowInvalidChecksum"," doesn't turn BIP39 into Electrum. Use ",[106,972,973],{},"deriveElectrumSeed"," explicitly:",[99,976,978],{"className":185,"code":977,"language":187,"meta":104,"style":104},"import { deriveElectrumSeed, inspectElectrumMnemonic } from \"@agntn\u002Fkeys\";\nimport { getMasterKeyFromSeed } from \"@agntn\u002Fkeys\u002Fbip32\";\nimport Bitcoin from \"@agntn\u002Fkeys\u002Fblockchains\u002Fbitcoin\";\n\nconst phrase = \"wild father tree among universe such mobile favorite target dynamic credit identify\";\ninspectElectrumMnemonic(phrase);\nconst { seed, seedType, scheme } = deriveElectrumSeed(phrase);\nconst child = getMasterKeyFromSeed(seed).derive(\"m\u002F0'\u002F0\u002F0\");\nconst privateKey = Buffer.from(child.privateKey).toString(\"hex\");\nconst bitcoin = new Bitcoin();\nconst addressType = seedType === \"segwit\" ? \"segwit\" : \"legacy\";\nconst wallet = bitcoin.deriveWallet(privateKey, { compressed: true }, addressType);\nwallet.address;\n",[106,979,980,1006,1028,1044,1048,1066,1078,1112,1143,1184,1201,1244,1278],{"__ignoreMap":104},[109,981,982,984,986,989,991,994,996,998,1000,1002,1004],{"class":111,"line":112},[109,983,194],{"class":123},[109,985,197],{"class":131},[109,987,988],{"class":200}," deriveElectrumSeed",[109,990,842],{"class":131},[109,992,993],{"class":200}," inspectElectrumMnemonic",[109,995,204],{"class":131},[109,997,208],{"class":207},[109,999,212],{"class":211},[109,1001,216],{"class":215},[109,1003,219],{"class":211},[109,1005,149],{"class":131},[109,1007,1008,1010,1012,1015,1017,1019,1021,1024,1026],{"class":111,"line":135},[109,1009,194],{"class":123},[109,1011,197],{"class":131},[109,1013,1014],{"class":200}," getMasterKeyFromSeed",[109,1016,204],{"class":131},[109,1018,208],{"class":207},[109,1020,212],{"class":211},[109,1022,1023],{"class":215},"@agntn\u002Fkeys\u002Fbip32",[109,1025,219],{"class":211},[109,1027,149],{"class":131},[109,1029,1030,1032,1034,1036,1038,1040,1042],{"class":111,"line":152},[109,1031,194],{"class":123},[109,1033,228],{"class":200},[109,1035,208],{"class":207},[109,1037,212],{"class":211},[109,1039,235],{"class":215},[109,1041,219],{"class":211},[109,1043,149],{"class":131},[109,1045,1046],{"class":111,"line":169},[109,1047,245],{"emptyLinePlaceholder":244},[109,1049,1050,1052,1055,1057,1059,1062,1064],{"class":111,"line":274},[109,1051,250],{"class":115},[109,1053,1054],{"class":253}," phrase",[109,1056,257],{"class":115},[109,1058,212],{"class":211},[109,1060,1061],{"class":215},"wild father tree among universe such mobile favorite target dynamic credit identify",[109,1063,219],{"class":211},[109,1065,149],{"class":131},[109,1067,1068,1071,1073,1076],{"class":111,"line":296},[109,1069,1070],{"class":260},"inspectElectrumMnemonic",[109,1072,263],{"class":131},[109,1074,1075],{"class":284},"phrase",[109,1077,486],{"class":131},[109,1079,1080,1082,1085,1088,1090,1093,1095,1098,1101,1104,1106,1108,1110],{"class":111,"line":301},[109,1081,250],{"class":115},[109,1083,1084],{"class":131}," { ",[109,1086,1087],{"class":253},"seed",[109,1089,590],{"class":131},[109,1091,1092],{"class":253},"seedType",[109,1094,590],{"class":131},[109,1096,1097],{"class":253},"scheme",[109,1099,1100],{"class":131}," } ",[109,1102,1103],{"class":115},"=",[109,1105,988],{"class":260},[109,1107,263],{"class":131},[109,1109,1075],{"class":284},[109,1111,486],{"class":131},[109,1113,1114,1116,1119,1121,1123,1125,1127,1129,1132,1134,1136,1139,1141],{"class":111,"line":319},[109,1115,250],{"class":115},[109,1117,1118],{"class":253}," child",[109,1120,257],{"class":115},[109,1122,1014],{"class":260},[109,1124,263],{"class":131},[109,1126,1087],{"class":284},[109,1128,600],{"class":131},[109,1130,1131],{"class":260},"derive",[109,1133,263],{"class":131},[109,1135,219],{"class":211},[109,1137,1138],{"class":215},"m\u002F0'\u002F0\u002F0",[109,1140,219],{"class":211},[109,1142,486],{"class":131},[109,1144,1145,1147,1149,1151,1154,1156,1159,1161,1164,1166,1168,1170,1173,1175,1177,1180,1182],{"class":111,"line":335},[109,1146,250],{"class":115},[109,1148,452],{"class":253},[109,1150,257],{"class":115},[109,1152,1153],{"class":284}," Buffer",[109,1155,287],{"class":131},[109,1157,1158],{"class":260},"from",[109,1160,263],{"class":131},[109,1162,1163],{"class":284},"child",[109,1165,287],{"class":131},[109,1167,483],{"class":284},[109,1169,600],{"class":131},[109,1171,1172],{"class":260},"toString",[109,1174,263],{"class":131},[109,1176,219],{"class":211},[109,1178,1179],{"class":215},"hex",[109,1181,219],{"class":211},[109,1183,486],{"class":131},[109,1185,1187,1189,1192,1194,1197,1199],{"class":111,"line":1186},10,[109,1188,250],{"class":115},[109,1190,1191],{"class":253}," bitcoin",[109,1193,257],{"class":115},[109,1195,1196],{"class":123}," new",[109,1198,228],{"class":260},[109,1200,293],{"class":131},[109,1202,1204,1206,1209,1211,1214,1217,1219,1221,1223,1226,1228,1230,1232,1235,1237,1240,1242],{"class":111,"line":1203},11,[109,1205,250],{"class":115},[109,1207,1208],{"class":253}," addressType",[109,1210,257],{"class":115},[109,1212,1213],{"class":284}," seedType",[109,1215,1216],{"class":115}," ===",[109,1218,212],{"class":211},[109,1220,513],{"class":215},[109,1222,219],{"class":211},[109,1224,1225],{"class":115}," ?",[109,1227,212],{"class":211},[109,1229,513],{"class":215},[109,1231,219],{"class":211},[109,1233,1234],{"class":115}," :",[109,1236,212],{"class":211},[109,1238,1239],{"class":215},"legacy",[109,1241,219],{"class":211},[109,1243,149],{"class":131},[109,1245,1247,1249,1251,1253,1255,1257,1259,1261,1263,1265,1267,1269,1271,1273,1276],{"class":111,"line":1246},12,[109,1248,250],{"class":115},[109,1250,279],{"class":253},[109,1252,257],{"class":115},[109,1254,1191],{"class":284},[109,1256,287],{"class":131},[109,1258,478],{"class":260},[109,1260,263],{"class":131},[109,1262,483],{"class":284},[109,1264,632],{"class":131},[109,1266,374],{"class":200},[109,1268,142],{"class":131},[109,1270,784],{"class":783},[109,1272,647],{"class":131},[109,1274,1275],{"class":284},"addressType",[109,1277,486],{"class":131},[109,1279,1281,1283,1285,1287],{"class":111,"line":1280},13,[109,1282,304],{"class":284},[109,1284,287],{"class":131},[109,1286,342],{"class":284},[109,1288,149],{"class":131},[95,1290,1291,1292,1295,1296,1298,1299,956,1302,1298,1304,1306,1307,590,1310,956,1313,1316,1317,287],{},"This public Electrum test vector gives ",[106,1293,1294],{},"bc1q4794m2uuw9jmjszmplfj4wvvr5j272fpnx2cse",". The result identifies ",[106,1297,1097],{}," as ",[106,1300,1301],{},"electrum",[106,1303,1092],{},[106,1305,513],{},". The seed is 64 bytes, not a master private key. Standard seeds work too. Supply the exact path for the wallet being imported, not necessarily the SegWit path in this example. Inspection also recognizes ",[106,1308,1309],{},"old",[106,1311,1312],{},"2fa",[106,1314,1315],{},"2fa_segwit",", but derivation rejects them, along with ",[106,1318,1319],{},"unknown",[95,1321,1322],{},"The optional second argument is an Electrum passphrase. Both inputs undergo NFKD, lowercasing, removal of nonzero combining classes, whitespace collapsing and removal of spaces between Electrum's CJK characters. Unlike BIP39, passphrase case, accents and surrounding spaces don't distinguish wallets here. Unicode normalization uses the JavaScript runtime's Unicode tables, so newly assigned characters can differ from older Python\u002FElectrum runtimes.",[95,1324,1325,1326,1329],{},"MCP and Pi expose ",[106,1327,1328],{},"keys_derive_electrum_wallet"," for the same derivation. Supply the full phrase and exact path. The tool chooses P2PKH for standard seeds and P2WPKH for SegWit, and returns only public wallet material plus the scheme and seed type. It doesn't search paths, repair phrases or check balances. Use only public or disposable inputs. Real wallet secrets don't belong in an agent transcript.",[90,1331,1333],{"id":1332},"security-again","Security, again",[95,1335,1336],{},"The library doesn't store keys, encrypt keys, or forget keys. Whatever calls it holds the private key in memory as a plain string, and so does every log line that prints a wallet object. Generate throwaway keys for tests, keep real ones on hardware, and be twice as careful in a browser tab where an extension can read the page.",[90,1338,1340],{"id":1339},"the-whole-method","The whole method",[95,1342,1343,1344,1346],{},"This is all ",[106,1345,290],{}," is:",[99,1348,1352],{"className":1349,"code":1350,"language":1351,"meta":104,"style":104},"language-ts shiki shiki-themes github-light github-light poimandres","generateWallet(options?: KeyOptions, addressType?: AddressType): Wallet {\n  const keys = this.generateKeys(options);\n  const address = this.getAddress(keys.keys.public, addressType);\n\n  return { ...keys, address };\n}\n","ts",[106,1353,1354,1385,1409,1442,1446,1466],{"__ignoreMap":104},[109,1355,1356,1358,1360,1363,1365,1368,1370,1372,1374,1377,1380,1383],{"class":111,"line":112},[109,1357,290],{"class":260},[109,1359,263],{"class":131},[109,1361,1362],{"class":284},"options",[109,1364,158],{"class":115},[109,1366,1367],{"class":284}," KeyOptions",[109,1369,590],{"class":131},[109,1371,1275],{"class":284},[109,1373,158],{"class":115},[109,1375,1376],{"class":284}," AddressType",[109,1378,1379],{"class":131},"): ",[109,1381,1382],{"class":284},"Wallet",[109,1384,132],{"class":131},[109,1386,1387,1390,1393,1395,1399,1401,1403,1405,1407],{"class":111,"line":135},[109,1388,1389],{"class":115},"  const",[109,1391,1392],{"class":253}," keys",[109,1394,257],{"class":115},[109,1396,1398],{"class":1397},"s-lox"," this",[109,1400,287],{"class":131},[109,1402,350],{"class":260},[109,1404,263],{"class":131},[109,1406,1362],{"class":284},[109,1408,486],{"class":131},[109,1410,1411,1413,1416,1418,1420,1422,1424,1426,1428,1430,1432,1434,1436,1438,1440],{"class":111,"line":152},[109,1412,1389],{"class":115},[109,1414,1415],{"class":253}," address",[109,1417,257],{"class":115},[109,1419,1398],{"class":1397},[109,1421,287],{"class":131},[109,1423,354],{"class":260},[109,1425,263],{"class":131},[109,1427,309],{"class":284},[109,1429,287],{"class":131},[109,1431,309],{"class":284},[109,1433,287],{"class":131},[109,1435,330],{"class":284},[109,1437,590],{"class":131},[109,1439,1275],{"class":284},[109,1441,486],{"class":131},[109,1443,1444],{"class":111,"line":169},[109,1445,245],{"emptyLinePlaceholder":244},[109,1447,1448,1452,1454,1457,1459,1461,1463],{"class":111,"line":274},[109,1449,1451],{"class":1450},"sZW6a","  return",[109,1453,197],{"class":131},[109,1455,1456],{"class":115}," ...",[109,1458,309],{"class":284},[109,1460,842],{"class":131},[109,1462,1415],{"class":284},[109,1464,1465],{"class":131}," };\n",[109,1467,1468],{"class":111,"line":296},[109,1469,172],{"class":131},[95,1471,1472,1473,1476],{},"It lives on ",[106,1474,1475],{},"AbstractBlockchain",", so every chain, including one you write yourself, gets it for free.",[1478,1479,1480],"style",{},"html pre.shiki code .s1TYA, html code.shiki .s1TYA{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#91B4D5}html pre.shiki code .sCrqT, html code.shiki .sCrqT{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#A6ACCDC0}html pre.shiki code .sP0CR, html code.shiki .sP0CR{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#5DE4C7}html pre.shiki code .scZRh, html code.shiki .scZRh{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#ADD7FF}html pre.shiki code .sKlNE, html code.shiki .sKlNE{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#A6ACCD}html pre.shiki code .s0VbO, html code.shiki .s0VbO{--shiki-light:#E36209;--shiki-default:#E36209;--shiki-dark:#A6ACCD}html pre.shiki code .s8yaW, html code.shiki .s8yaW{--shiki-light:#005CC5;--shiki-default:#005CC5;--shiki-dark:#A6ACCDC0}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 .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 .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 .spVlQ, html code.shiki .spVlQ{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#E4F0FB}html pre.shiki code .sNe8j, html code.shiki .sNe8j{--shiki-light:#005CC5;--shiki-default:#005CC5;--shiki-dark:#D0679D}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}html pre.shiki code .siHFe, html code.shiki .siHFe{--shiki-light:#005CC5;--shiki-default:#005CC5;--shiki-dark:#5DE4C7}html pre.shiki code .sLrG9, html code.shiki .sLrG9{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#5FB3A1}html pre.shiki code .s-lox, html code.shiki .s-lox{--shiki-light:#005CC5;--shiki-light-font-style:inherit;--shiki-default:#005CC5;--shiki-default-font-style:inherit;--shiki-dark:#5DE4C7;--shiki-dark-font-style:italic}html pre.shiki code .sZW6a, html code.shiki .sZW6a{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#5DE4C7C0}",{"title":104,"searchDepth":135,"depth":135,"links":1482},[1483,1484,1485,1486,1487,1488,1489,1490],{"id":92,"depth":135,"text":93},{"id":181,"depth":135,"text":182},{"id":439,"depth":135,"text":440},{"id":536,"depth":135,"text":537},{"id":710,"depth":135,"text":711},{"id":963,"depth":135,"text":964},{"id":1332,"depth":135,"text":1333},{"id":1339,"depth":135,"text":1340},"One call for keys plus address. Import a key you already have. Walk a mnemonic down a path with a broken checksum if you must.","md",null,{"icon":1495},"i-lucide-wallet",{"title":20,"description":1491},"2cAhyeUjkzfe2cdL_pbbGfDlAkIDeUzXFGfPFkp1mBs",[1499,1501],{"title":16,"path":17,"stem":18,"description":1500,"children":-1},"Turn a public key into an address. Pick a format. Check one you were given.",{"title":24,"path":25,"stem":26,"description":1502,"children":-1},"Ethereum and Base share one implementation. One address and one signing scheme.",1789938975649]