[{"data":1,"prerenderedAt":819},["ShallowReactive",2],{"navigation_docs":3,"-guide":72,"-guide-surround":816},[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":71},"Blockchains","\u002Fblockchains","2.blockchains\u002F0.index",[37,39,43,47,51,55,59,63,67],{"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},"Ethereum","\u002Fblockchains\u002Fethereum","2.blockchains\u002Fethereum",{"title":60,"path":61,"stem":62},"Solana","\u002Fblockchains\u002Fsolana","2.blockchains\u002Fsolana",{"title":64,"path":65,"stem":66},"Sui","\u002Fblockchains\u002Fsui","2.blockchains\u002Fsui",{"title":68,"path":69,"stem":70},"TRON","\u002Fblockchains\u002Ftron","2.blockchains\u002Ftron","i-lucide-boxes",{"id":73,"title":10,"body":74,"description":810,"extension":811,"links":812,"meta":813,"navigation":194,"path":6,"seo":814,"stem":7,"__hash__":815},"docs\u002F1.guide\u002F1.index.md",{"type":75,"value":76,"toc":797},"minimark",[77,85,92,97,101,108,112,137,141,396,407,411,517,524,528,531,536,559,566,570,620,627,631,690,693,702,706,735,738,742,790,793],[78,79,80,84],"warning",{},[81,82,83],"strong",{},"Still experimental."," Package name, public API, the lazy loader, and the MCP tool surface can all change before 1.0. Pin exact versions if you build on it now.",[86,87,88,91],"caution",{},[81,89,90],{},"Never point this at real funds."," Every key that passes through the library, the explorer, or the MCP server is plaintext in a process, a log, or an agent transcript. Treat it as burned the moment it exists. Real money belongs on a hardware wallet.",[93,94,96],"h2",{"id":95},"why-this-exists","Why this exists",[98,99,100],"p",{},"Every chain has its own idea of a key, an address, and a signature. Bitcoin hashes twice and encodes in base58, Ethereum takes the tail of a Keccak hash, Solana just base58 encodes the public key, Cardano wants bech32 with a header byte. Pulling one library per chain into a project means five APIs, five option shapes, and five ways to get an address wrong.",[98,102,103,107],{},[104,105,106],"code",{},"@agntn\u002Fkeys"," puts eight chains behind one class shape. Same calls, same option object, same wallet type. The chain decides the rules, you decide the key.",[93,109,111],{"id":110},"install","Install",[113,114,119],"pre",{"className":115,"code":116,"language":117,"meta":118,"style":118},"language-bash shiki shiki-themes github-light github-light poimandres","pnpm add @agntn\u002Fkeys\n","bash","",[104,120,121],{"__ignoreMap":118},[122,123,126,130,134],"span",{"class":124,"line":125},"line",1,[122,127,129],{"class":128},"sseY5","pnpm",[122,131,133],{"class":132},"sX7Zv"," add",[122,135,136],{"class":132}," @agntn\u002Fkeys\n",[93,138,140],{"id":139},"first-wallet","First wallet",[113,142,147],{"className":143,"code":144,"filename":145,"language":146,"meta":118,"style":118},"language-js shiki shiki-themes github-light github-light poimandres","import { useBlockchain, blockchains } from \"@agntn\u002Fkeys\";\n\n\u002F\u002F Concrete classes load on demand. First call takes options, second call imports and constructs.\nconst bitcoin = await blockchains.bitcoin()();\nconst ethereum = await blockchains.ethereum()();\n\nconst bitcoinChain = useBlockchain(bitcoin);\nconst ethereumChain = useBlockchain(ethereum);\n\nconst btcWallet = bitcoinChain.generateWallet();\nconst ethWallet = ethereumChain.generateWallet();\n\nconsole.log(btcWallet.address); \u002F\u002F 1...\nconsole.log(ethWallet.address); \u002F\u002F 0x...\n","my-wallet.js","js",[104,148,149,189,196,203,234,255,260,280,298,303,323,341,346,373],{"__ignoreMap":118},[122,150,151,155,159,163,166,169,172,176,180,183,186],{"class":124,"line":125},[122,152,154],{"class":153},"sP0CR","import",[122,156,158],{"class":157},"sKlNE"," {",[122,160,162],{"class":161},"snHMy"," useBlockchain",[122,164,165],{"class":157},",",[122,167,168],{"class":161}," blockchains",[122,170,171],{"class":157}," }",[122,173,175],{"class":174},"stCPd"," from",[122,177,179],{"class":178},"scVjq"," \"",[122,181,106],{"class":182},"sQ7BG",[122,184,185],{"class":178},"\"",[122,187,188],{"class":157},";\n",[122,190,192],{"class":124,"line":191},2,[122,193,195],{"emptyLinePlaceholder":194},true,"\n",[122,197,199],{"class":124,"line":198},3,[122,200,202],{"class":201},"sjhu3","\u002F\u002F Concrete classes load on demand. First call takes options, second call imports and constructs.\n",[122,204,206,210,214,217,221,224,227,231],{"class":124,"line":205},4,[122,207,209],{"class":208},"s1TYA","const",[122,211,213],{"class":212},"saoiD"," bitcoin",[122,215,216],{"class":208}," =",[122,218,220],{"class":219},"sZW6a"," await",[122,222,168],{"class":223},"spVlQ",[122,225,226],{"class":157},".",[122,228,230],{"class":229},"sULi6","bitcoin",[122,232,233],{"class":157},"()();\n",[122,235,237,239,242,244,246,248,250,253],{"class":124,"line":236},5,[122,238,209],{"class":208},[122,240,241],{"class":212}," ethereum",[122,243,216],{"class":208},[122,245,220],{"class":219},[122,247,168],{"class":223},[122,249,226],{"class":157},[122,251,252],{"class":229},"ethereum",[122,254,233],{"class":157},[122,256,258],{"class":124,"line":257},6,[122,259,195],{"emptyLinePlaceholder":194},[122,261,263,265,268,270,272,275,277],{"class":124,"line":262},7,[122,264,209],{"class":208},[122,266,267],{"class":212}," bitcoinChain",[122,269,216],{"class":208},[122,271,162],{"class":229},[122,273,274],{"class":157},"(",[122,276,230],{"class":223},[122,278,279],{"class":157},");\n",[122,281,283,285,288,290,292,294,296],{"class":124,"line":282},8,[122,284,209],{"class":208},[122,286,287],{"class":212}," ethereumChain",[122,289,216],{"class":208},[122,291,162],{"class":229},[122,293,274],{"class":157},[122,295,252],{"class":223},[122,297,279],{"class":157},[122,299,301],{"class":124,"line":300},9,[122,302,195],{"emptyLinePlaceholder":194},[122,304,306,308,311,313,315,317,320],{"class":124,"line":305},10,[122,307,209],{"class":208},[122,309,310],{"class":212}," btcWallet",[122,312,216],{"class":208},[122,314,267],{"class":223},[122,316,226],{"class":157},[122,318,319],{"class":229},"generateWallet",[122,321,322],{"class":157},"();\n",[122,324,326,328,331,333,335,337,339],{"class":124,"line":325},11,[122,327,209],{"class":208},[122,329,330],{"class":212}," ethWallet",[122,332,216],{"class":208},[122,334,287],{"class":223},[122,336,226],{"class":157},[122,338,319],{"class":229},[122,340,322],{"class":157},[122,342,344],{"class":124,"line":343},12,[122,345,195],{"emptyLinePlaceholder":194},[122,347,349,352,354,357,359,362,364,367,370],{"class":124,"line":348},13,[122,350,351],{"class":223},"console",[122,353,226],{"class":157},[122,355,356],{"class":229},"log",[122,358,274],{"class":157},[122,360,361],{"class":223},"btcWallet",[122,363,226],{"class":157},[122,365,366],{"class":223},"address",[122,368,369],{"class":157},"); ",[122,371,372],{"class":201},"\u002F\u002F 1...\n",[122,374,376,378,380,382,384,387,389,391,393],{"class":124,"line":375},14,[122,377,351],{"class":223},[122,379,226],{"class":157},[122,381,356],{"class":229},[122,383,274],{"class":157},[122,385,386],{"class":223},"ethWallet",[122,388,226],{"class":157},[122,390,366],{"class":223},[122,392,369],{"class":157},[122,394,395],{"class":201},"\u002F\u002F 0x...\n",[98,397,398,399,402,403,406],{},"The double call looks odd the first time. It is deliberate: ",[104,400,401],{},"blockchains.bitcoin({ network: \"testnet\" })"," only records the options, and the second ",[104,404,405],{},"()"," is the moment the chain module actually gets imported. Nothing you never call ends up in your bundle.",[93,408,410],{"id":409},"what-ships","What ships",[412,413,414,430],"table",{},[415,416,417],"thead",{},[418,419,420,424,427],"tr",{},[421,422,423],"th",{},"Chain",[421,425,426],{},"Curve",[421,428,429],{},"Addresses",[431,432,433,444,453,462,474,484,496,508],"tbody",{},[418,434,435,438,441],{},[436,437,48],"td",{},[436,439,440],{},"secp256k1",[436,442,443],{},"legacy, p2sh, segwit, p2wsh, taproot",[418,445,446,448,450],{},[436,447,56],{},[436,449,440],{},[436,451,452],{},"EIP-55 hex",[418,454,455,457,459],{},[436,456,44],{},[436,458,440],{},[436,460,461],{},"EIP-55 hex, same as Ethereum",[418,463,464,466,468],{},[436,465,68],{},[436,467,440],{},[436,469,470,471],{},"base58check, starts with ",[104,472,473],{},"T",[418,475,476,478,481],{},[436,477,60],{},[436,479,480],{},"ed25519",[436,482,483],{},"base58 public key",[418,485,486,488,490],{},[436,487,40],{},[436,489,480],{},[436,491,492,495],{},[104,493,494],{},"0x"," hex, SHA3-256",[418,497,498,500,503],{},[436,499,64],{},[436,501,502],{},"ed25519 or secp256k1",[436,504,505,507],{},[104,506,494],{}," hex, Blake2b",[418,509,510,512,514],{},[436,511,52],{},[436,513,480],{},[436,515,516],{},"bech32 base, enterprise, stake",[98,518,519,520,523],{},"Each chain has its own page under ",[521,522,33],"a",{"href":34}," with the exact rules and the gotchas.",[93,525,527],{"id":526},"the-three-steps","The three steps",[98,529,530],{},"Every chain does the same three things, with different rules for each.",[532,533,535],"h3",{"id":534},"_1-a-private-key-is-32-random-bytes","1. A private key is 32 random bytes",[113,537,539],{"className":143,"code":538,"language":146,"meta":118,"style":118},"const privateKey = bitcoinChain.generateKeyPrivate();\n",[104,540,541],{"__ignoreMap":118},[122,542,543,545,548,550,552,554,557],{"class":124,"line":125},[122,544,209],{"class":208},[122,546,547],{"class":212}," privateKey",[122,549,216],{"class":208},[122,551,267],{"class":223},[122,553,226],{"class":157},[122,555,556],{"class":229},"generateKeyPrivate",[122,558,322],{"class":157},[98,560,561,562,565],{},"A 64 character hex string. secp256k1 chains get it from ",[104,563,564],{},"@noble\u002Fcurves",", ed25519 chains from Web Crypto, so the same code works in Node and in the browser.",[532,567,569],{"id":568},"_2-the-public-key-comes-from-the-curve","2. The public key comes from the curve",[113,571,573],{"className":143,"code":572,"language":146,"meta":118,"style":118},"const publicKey = bitcoinChain.getKeyPublic(privateKey);\nconst keys = bitcoinChain.generateKeys(); \u002F\u002F both at once\n",[104,574,575,598],{"__ignoreMap":118},[122,576,577,579,582,584,586,588,591,593,596],{"class":124,"line":125},[122,578,209],{"class":208},[122,580,581],{"class":212}," publicKey",[122,583,216],{"class":208},[122,585,267],{"class":223},[122,587,226],{"class":157},[122,589,590],{"class":229},"getKeyPublic",[122,592,274],{"class":157},[122,594,595],{"class":223},"privateKey",[122,597,279],{"class":157},[122,599,600,602,605,607,609,611,614,617],{"class":124,"line":191},[122,601,209],{"class":208},[122,603,604],{"class":212}," keys",[122,606,216],{"class":208},[122,608,267],{"class":223},[122,610,226],{"class":157},[122,612,613],{"class":229},"generateKeys",[122,615,616],{"class":157},"(); ",[122,618,619],{"class":201},"\u002F\u002F both at once\n",[98,621,622,623,626],{},"secp256k1 chains give you a compressed 33 byte key by default. Pass ",[104,624,625],{},"{ compressed: false }"," for the 65 byte one. ed25519 keys are always 32 bytes.",[532,628,630],{"id":629},"_3-the-address-is-a-hash-then-an-encoding","3. The address is a hash, then an encoding",[113,632,634],{"className":143,"code":633,"language":146,"meta":118,"style":118},"const address = bitcoinChain.getAddress(publicKey);\nconst segwit = bitcoinChain.getAddress(publicKey, \"segwit\");\n",[104,635,636,659],{"__ignoreMap":118},[122,637,638,640,643,645,647,649,652,654,657],{"class":124,"line":125},[122,639,209],{"class":208},[122,641,642],{"class":212}," address",[122,644,216],{"class":208},[122,646,267],{"class":223},[122,648,226],{"class":157},[122,650,651],{"class":229},"getAddress",[122,653,274],{"class":157},[122,655,656],{"class":223},"publicKey",[122,658,279],{"class":157},[122,660,661,663,666,668,670,672,674,676,678,681,683,686,688],{"class":124,"line":191},[122,662,209],{"class":208},[122,664,665],{"class":212}," segwit",[122,667,216],{"class":208},[122,669,267],{"class":223},[122,671,226],{"class":157},[122,673,651],{"class":229},[122,675,274],{"class":157},[122,677,656],{"class":223},[122,679,680],{"class":157},", ",[122,682,185],{"class":178},[122,684,685],{"class":182},"segwit",[122,687,185],{"class":178},[122,689,279],{"class":157},[98,691,692],{},"The second argument is the address type. Chains with one format ignore it, chains with several use it to pick.",[98,694,695,698,699,226],{},[104,696,697],{},"generateWallet()"," runs all three and hands back ",[104,700,701],{},"{ keys: { private, public }, address }",[93,703,705],{"id":704},"checking-an-address","Checking an address",[113,707,709],{"className":143,"code":708,"language":146,"meta":118,"style":118},"bitcoinChain.validateAddress(\"1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa\"); \u002F\u002F true\n",[104,710,711],{"__ignoreMap":118},[122,712,713,716,718,721,723,725,728,730,732],{"class":124,"line":125},[122,714,715],{"class":223},"bitcoinChain",[122,717,226],{"class":157},[122,719,720],{"class":229},"validateAddress",[122,722,274],{"class":157},[122,724,185],{"class":178},[122,726,727],{"class":182},"1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",[122,729,185],{"class":178},[122,731,369],{"class":157},[122,733,734],{"class":201},"\u002F\u002F true\n",[98,736,737],{},"Every built in chain validates its own formats, including checksums where the format has one. It is a format check, not a lookup: a valid address can still have zero history on chain.",[93,739,741],{"id":740},"which-curve-am-i-on","Which curve am I on",[113,743,745],{"className":143,"code":744,"language":146,"meta":118,"style":118},"bitcoinChain.curve; \u002F\u002F 'secp256k1'\nsolanaChain.curve; \u002F\u002F 'ed25519'\nsuiChain.curve; \u002F\u002F ['ed25519', 'secp256k1']\n",[104,746,747,762,776],{"__ignoreMap":118},[122,748,749,751,753,756,759],{"class":124,"line":125},[122,750,715],{"class":223},[122,752,226],{"class":157},[122,754,755],{"class":223},"curve",[122,757,758],{"class":157},"; ",[122,760,761],{"class":201},"\u002F\u002F 'secp256k1'\n",[122,763,764,767,769,771,773],{"class":124,"line":191},[122,765,766],{"class":223},"solanaChain",[122,768,226],{"class":157},[122,770,755],{"class":223},[122,772,758],{"class":157},[122,774,775],{"class":201},"\u002F\u002F 'ed25519'\n",[122,777,778,781,783,785,787],{"class":124,"line":198},[122,779,780],{"class":223},"suiChain",[122,782,226],{"class":157},[122,784,755],{"class":223},[122,786,758],{"class":157},[122,788,789],{"class":201},"\u002F\u002F ['ed25519', 'secp256k1']\n",[98,791,792],{},"Sui is the only chain that answers with a list. Its pages explain how to pick one.",[794,795,796],"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 .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 .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 .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 pre.shiki code .sULi6, html code.shiki .sULi6{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#E4F0FBD0}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 .sseY5, html code.shiki .sseY5{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#91B4D5}html pre.shiki code .sX7Zv, html code.shiki .sX7Zv{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#ADD7FF}",{"title":118,"searchDepth":191,"depth":191,"links":798},[799,800,801,802,803,808,809],{"id":95,"depth":191,"text":96},{"id":110,"depth":191,"text":111},{"id":139,"depth":191,"text":140},{"id":409,"depth":191,"text":410},{"id":526,"depth":191,"text":527,"children":804},[805,806,807],{"id":534,"depth":198,"text":535},{"id":568,"depth":198,"text":569},{"id":629,"depth":198,"text":630},{"id":704,"depth":191,"text":705},{"id":740,"depth":191,"text":741},"Install the package, load a chain, and get a wallet out in five lines.","md",null,{"icon":31},{"title":10,"description":810},"1BFrAzCNN_x5op6vj5dlzdqAn_5lOE2C8mzvHexmxD0",[812,817],{"title":12,"path":13,"stem":14,"description":818,"children":-1},"Private keys, public keys, compression, and the one chain that speaks two curves.",1788428715658]