[{"data":1,"prerenderedAt":665},["ShallowReactive",2],{"navigation_docs":3,"-blockchains-near":124,"-blockchains-near-surround":660},[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":123},"Blockchains","\u002Fblockchains","2.blockchains\u002F0.index",[37,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119],{"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},"Cosmos","\u002Fblockchains\u002Fcosmos","2.blockchains\u002Fcosmos",{"title":72,"path":73,"stem":74},"Dash","\u002Fblockchains\u002Fdash","2.blockchains\u002Fdash",{"title":76,"path":77,"stem":78},"Decred","\u002Fblockchains\u002Fdecred","2.blockchains\u002Fdecred",{"title":80,"path":81,"stem":82},"Dogecoin","\u002Fblockchains\u002Fdogecoin","2.blockchains\u002Fdogecoin",{"title":84,"path":85,"stem":86},"eCash","\u002Fblockchains\u002Fecash","2.blockchains\u002Fecash",{"title":88,"path":89,"stem":90},"Ethereum","\u002Fblockchains\u002Fethereum","2.blockchains\u002Fethereum",{"title":92,"path":93,"stem":94},"Litecoin","\u002Fblockchains\u002Flitecoin","2.blockchains\u002Flitecoin",{"title":96,"path":97,"stem":98},"NEAR","\u002Fblockchains\u002Fnear","2.blockchains\u002Fnear",{"title":100,"path":101,"stem":102},"Solana","\u002Fblockchains\u002Fsolana","2.blockchains\u002Fsolana",{"title":104,"path":105,"stem":106},"Stellar","\u002Fblockchains\u002Fstellar","2.blockchains\u002Fstellar",{"title":108,"path":109,"stem":110},"Sui","\u002Fblockchains\u002Fsui","2.blockchains\u002Fsui",{"title":112,"path":113,"stem":114},"TRON","\u002Fblockchains\u002Ftron","2.blockchains\u002Ftron",{"title":116,"path":117,"stem":118},"XRP Ledger","\u002Fblockchains\u002Fxrpl","2.blockchains\u002Fxrpl",{"title":120,"path":121,"stem":122},"Zcash","\u002Fblockchains\u002Fzcash","2.blockchains\u002Fzcash","i-lucide-boxes",{"id":125,"title":96,"body":126,"description":652,"extension":653,"links":654,"meta":655,"navigation":179,"path":97,"seo":657,"stem":98,"__hash__":659},"docs\u002F2.blockchains\u002Fnear.md",{"type":127,"value":128,"toc":641},"minimark",[129,136,141,211,219,223,226,286,289,296,304,317,340,347,363,371,374,413,429,436,440,458,518,528,551,566,570,576,617,620,624,637],[130,131],"chain-facts",{"coin":132,"curve":133,"driver":134,"formats":135},"397","ed25519","near","implicit account (hex)",[137,138,140],"h2",{"id":139},"load-it","Load it",[142,143,148],"pre",{"className":144,"code":145,"language":146,"meta":147,"style":147},"language-js shiki shiki-themes keys keys keys","import { useBlockchain, blockchains } from \"@agntn\u002Fkeys\";\n\nconst nearChain = useBlockchain(await blockchains.near()());\n","js","",[149,150,151,174,181],"code",{"__ignoreMap":147},[152,153,156,160,164,167,171],"span",{"class":154,"line":155},"line",1,[152,157,159],{"class":158},"skH_V","import",[152,161,163],{"class":162},"s38Sx"," { useBlockchain, blockchains } ",[152,165,166],{"class":158},"from",[152,168,170],{"class":169},"shU9J"," \"@agntn\u002Fkeys\"",[152,172,173],{"class":162},";\n",[152,175,177],{"class":154,"line":176},2,[152,178,180],{"emptyLinePlaceholder":179},true,"\n",[152,182,184,187,190,193,197,200,203,206,208],{"class":154,"line":183},3,[152,185,186],{"class":158},"const",[152,188,189],{"class":162}," nearChain ",[152,191,192],{"class":158},"=",[152,194,196],{"class":195},"sK71F"," useBlockchain",[152,198,199],{"class":162},"(",[152,201,202],{"class":158},"await",[152,204,205],{"class":162}," blockchains.",[152,207,134],{"class":195},[152,209,210],{"class":162},"()());\n",[212,213,214,215,218],"p",{},"Mainnet and testnet write the same accounts. The ",[149,216,217],{},"network"," option changes nothing here.",[137,220,222],{"id":221},"whats-an-implicit-account","What's an implicit account?",[212,224,225],{},"The public key. In hex. That's the whole recipe.",[142,227,229],{"className":144,"code":228,"language":146,"meta":147,"style":147},"const privateKey = \"0000000000000000000000000000000000000000000000000000000000000001\";\nconst publicKey = nearChain.getKeyPublic(privateKey);\n\nnearChain.getAddress(publicKey);\n\u002F\u002F 4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29\n",[149,230,231,245,263,267,279],{"__ignoreMap":147},[152,232,233,235,238,240,243],{"class":154,"line":155},[152,234,186],{"class":158},[152,236,237],{"class":162}," privateKey ",[152,239,192],{"class":158},[152,241,242],{"class":169}," \"0000000000000000000000000000000000000000000000000000000000000001\"",[152,244,173],{"class":162},[152,246,247,249,252,254,257,260],{"class":154,"line":176},[152,248,186],{"class":158},[152,250,251],{"class":162}," publicKey ",[152,253,192],{"class":158},[152,255,256],{"class":162}," nearChain.",[152,258,259],{"class":195},"getKeyPublic",[152,261,262],{"class":162},"(privateKey);\n",[152,264,265],{"class":154,"line":183},[152,266,180],{"emptyLinePlaceholder":179},[152,268,270,273,276],{"class":154,"line":269},4,[152,271,272],{"class":162},"nearChain.",[152,274,275],{"class":195},"getAddress",[152,277,278],{"class":162},"(publicKey);\n",[152,280,282],{"class":154,"line":281},5,[152,283,285],{"class":284},"scIB-","\u002F\u002F 4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29\n",[212,287,288],{},"No hash, no checksum, not even base58. Even Solana bothers with base58. NEAR looked at 32 bytes and said, good enough.",[212,290,291,292,295],{},"The hex is lowercase. NEAR refuses uppercase in account IDs, so ",[149,293,294],{},"validateAddress"," does too.",[137,297,299,300,303],{"id":298},"and-the-ed25519-thing","And the ",[149,301,302],{},"ed25519:"," thing?",[212,305,306,307,309,310,312,313,316],{},"That's how NEAR prints a key: ",[149,308,302],{}," and the 32 bytes in base58. Wallets, near-cli and the RPC all show it this way. ",[149,311,275],{}," and ",[149,314,315],{},"verifyMessage"," take it as is.",[142,318,320],{"className":144,"code":319,"language":146,"meta":147,"style":147},"nearChain.getAddress(\"ed25519:6ASf5EcmmEHTgDJ4X4ZT5vT6iHVJBXPg5AN5YoTCpGWt\");\n\u002F\u002F 4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29\n",[149,321,322,336],{"__ignoreMap":147},[152,323,324,326,328,330,333],{"class":154,"line":155},[152,325,272],{"class":162},[152,327,275],{"class":195},[152,329,199],{"class":162},[152,331,332],{"class":169},"\"ed25519:6ASf5EcmmEHTgDJ4X4ZT5vT6iHVJBXPg5AN5YoTCpGWt\"",[152,334,335],{"class":162},");\n",[152,337,338],{"class":154,"line":176},[152,339,285],{"class":284},[212,341,342,343,346],{},"Look at that base58 again. Seen it before? It's the ",[344,345,100],"a",{"href":101}," address of the same private key. Solana's address is base58 of the key, NEAR's key is base58 of the key. One chain calls it an address, the other a key with a label on it.",[212,348,349,350,312,353,356,357,359,360,362],{},"Agents get the same deal. ",[149,351,352],{},"keys_address_get",[149,354,355],{},"keys_message_verify"," take the ",[149,358,302],{}," form on ",[149,361,134],{},", and every other chain asks for hex instead.",[137,364,366,367,370],{"id":365},"what-about-alicenear","What about ",[149,368,369],{},"alice.near","?",[212,372,373],{},"Named accounts are made by a transaction on chain. No key derives one, so nothing here writes them.",[142,375,377],{"className":144,"code":376,"language":146,"meta":147,"style":147},"nearChain.validateAddress(nearChain.getAddress(publicKey)); \u002F\u002F true\nnearChain.validateAddress(\"alice.near\"); \u002F\u002F false\n",[149,378,379,396],{"__ignoreMap":147},[152,380,381,383,385,388,390,393],{"class":154,"line":155},[152,382,272],{"class":162},[152,384,294],{"class":195},[152,386,387],{"class":162},"(nearChain.",[152,389,275],{"class":195},[152,391,392],{"class":162},"(publicKey)); ",[152,394,395],{"class":284},"\u002F\u002F true\n",[152,397,398,400,402,404,407,410],{"class":154,"line":176},[152,399,272],{"class":162},[152,401,294],{"class":195},[152,403,199],{"class":162},[152,405,406],{"class":169},"\"alice.near\"",[152,408,409],{"class":162},"); ",[152,411,412],{"class":284},"\u002F\u002F false\n",[212,414,415,418,419,421,422,425,426,428],{},[149,416,417],{},"false"," doesn't mean ",[149,420,369],{}," is broken. It means no key leads there. The ",[149,423,424],{},"0x"," ETH-implicit accounts get ",[149,427,417],{}," for the same reason, they come from secp256k1 keys.",[212,430,431,432,435],{},"One more trap. The account ID names the key that created it, not the key that holds it today. Owners add keys and delete the first one, and the account keeps its name. It happens on mainnet, not just in theory. So a key that matches the ID tells you who opened the account. Who can sign now is on chain, in ",[149,433,434],{},"view_access_key_list",".",[137,437,439],{"id":438},"mnemonics","Mnemonics",[212,441,442,443,446,447,450,451,453,454,457],{},"SLIP-10 on ed25519, every level hardened. near-seed-phrase stops at ",[149,444,445],{},"m\u002F44'\u002F397'\u002F0'",", and that's what ",[149,448,449],{},"getDerivationPath"," writes. Account ",[149,452,344],{}," is ",[149,455,456],{},"m\u002F44'\u002F397'\u002Fa'",", and there's no change branch or index below it.",[142,459,461],{"className":144,"code":460,"language":146,"meta":147,"style":147},"const mnemonic =\n  \"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about\";\n\nnearChain.getDerivationPath(); \u002F\u002F \"m\u002F44'\u002F397'\u002F0'\"\nnearChain.deriveHDWallet(mnemonic, \"m\u002F44'\u002F397'\u002F0'\").address;\n\u002F\u002F 5510e2b44cae6eb807e3e0e45d579dda058c274abcba15e5cb84636f5d1ee412\n",[149,462,463,473,480,484,496,512],{"__ignoreMap":147},[152,464,465,467,470],{"class":154,"line":155},[152,466,186],{"class":158},[152,468,469],{"class":162}," mnemonic ",[152,471,472],{"class":158},"=\n",[152,474,475,478],{"class":154,"line":176},[152,476,477],{"class":169},"  \"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about\"",[152,479,173],{"class":162},[152,481,482],{"class":154,"line":183},[152,483,180],{"emptyLinePlaceholder":179},[152,485,486,488,490,493],{"class":154,"line":269},[152,487,272],{"class":162},[152,489,449],{"class":195},[152,491,492],{"class":162},"(); ",[152,494,495],{"class":284},"\u002F\u002F \"m\u002F44'\u002F397'\u002F0'\"\n",[152,497,498,500,503,506,509],{"class":154,"line":281},[152,499,272],{"class":162},[152,501,502],{"class":195},"deriveHDWallet",[152,504,505],{"class":162},"(mnemonic, ",[152,507,508],{"class":169},"\"m\u002F44'\u002F397'\u002F0'\"",[152,510,511],{"class":162},").address;\n",[152,513,515],{"class":154,"line":514},6,[152,516,517],{"class":284},"\u002F\u002F 5510e2b44cae6eb807e3e0e45d579dda058c274abcba15e5cb84636f5d1ee412\n",[212,519,520,521,524,525,527],{},"Ledger went its own way, of course. Its NEAR app defaults to ",[149,522,523],{},"m\u002F44'\u002F397'\u002F0'\u002F0'\u002F1'",", five levels deep. Pass that path to ",[149,526,502],{}," as it is.",[142,529,531],{"className":144,"code":530,"language":146,"meta":147,"style":147},"nearChain.deriveHDWallet(mnemonic, \"m\u002F44'\u002F397'\u002F0'\u002F0'\u002F1'\").address;\n\u002F\u002F c571e33e2e36c2c728d617ea77a88e2320c8697eac8b463adfc0128b96825cbf\n",[149,532,533,546],{"__ignoreMap":147},[152,534,535,537,539,541,544],{"class":154,"line":155},[152,536,272],{"class":162},[152,538,502],{"class":195},[152,540,505],{"class":162},[152,542,543],{"class":169},"\"m\u002F44'\u002F397'\u002F0'\u002F0'\u002F1'\"",[152,545,511],{"class":162},[152,547,548],{"class":154,"line":176},[152,549,550],{"class":284},"\u002F\u002F c571e33e2e36c2c728d617ea77a88e2320c8697eac8b463adfc0128b96825cbf\n",[212,552,553,554,557,558,561,562,565],{},"Not sure which wallet made the phrase? ",[149,555,556],{},"keys_hd_wallet_scan"," walks both, ",[149,559,560],{},"bip44"," over the account level and ",[149,563,564],{},"ledger"," over the last one.",[137,567,569],{"id":568},"signing","Signing",[212,571,572,575],{},[149,573,574],{},"signMessage"," signs the raw message bytes with ed25519, like Solana and Aptos.",[142,577,579],{"className":144,"code":578,"language":146,"meta":147,"style":147},"const signature = nearChain.signMessage(\"Hello, NEAR!\", privateKey);\nnearChain.verifyMessage(\"Hello, NEAR!\", signature, publicKey); \u002F\u002F true\n",[149,580,581,602],{"__ignoreMap":147},[152,582,583,585,588,590,592,594,596,599],{"class":154,"line":155},[152,584,186],{"class":158},[152,586,587],{"class":162}," signature ",[152,589,192],{"class":158},[152,591,256],{"class":162},[152,593,574],{"class":195},[152,595,199],{"class":162},[152,597,598],{"class":169},"\"Hello, NEAR!\"",[152,600,601],{"class":162},", privateKey);\n",[152,603,604,606,608,610,612,615],{"class":154,"line":176},[152,605,272],{"class":162},[152,607,315],{"class":195},[152,609,199],{"class":162},[152,611,598],{"class":169},[152,613,614],{"class":162},", signature, publicKey); ",[152,616,395],{"class":284},[212,618,619],{},"Wallets that sign under NEP-413 won't match this. They wrap a nonce and a recipient around the message first and sign the hash of that. Different bytes, different signature.",[137,621,623],{"id":622},"where-it-lives","Where it lives",[212,625,626,629,630,633,634,435],{},[149,627,628],{},"src\u002Fblockchains\u002Fnear.ts",", and it's short. The curve comes from ",[149,631,632],{},"@noble\u002Fcurves",", base58 from ",[149,635,636],{},"@agntn\u002Fencodings",[638,639,640],"style",{},"html pre.shiki code .skH_V, html code.shiki .skH_V{--shiki-light:var(--shiki-token-keyword);--shiki-default:var(--shiki-token-keyword);--shiki-dark:var(--shiki-token-keyword)}html pre.shiki code .s38Sx, html code.shiki .s38Sx{--shiki-light:var(--ui-text-highlighted);--shiki-default:var(--ui-text-highlighted);--shiki-dark:var(--ui-text-highlighted)}html pre.shiki code .shU9J, html code.shiki .shU9J{--shiki-light:var(--shiki-token-string);--shiki-default:var(--shiki-token-string);--shiki-dark:var(--shiki-token-string)}html pre.shiki code .sK71F, html code.shiki .sK71F{--shiki-light:var(--shiki-token-function);--shiki-default:var(--shiki-token-function);--shiki-dark:var(--shiki-token-function)}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 .scIB-, html code.shiki .scIB-{--shiki-light:var(--shiki-token-comment);--shiki-default:var(--shiki-token-comment);--shiki-dark:var(--shiki-token-comment)}",{"title":147,"searchDepth":176,"depth":176,"links":642},[643,644,645,647,649,650,651],{"id":139,"depth":176,"text":140},{"id":221,"depth":176,"text":222},{"id":298,"depth":176,"text":646},"And the ed25519: thing?",{"id":365,"depth":176,"text":648},"What about alice.near?",{"id":438,"depth":176,"text":439},{"id":568,"depth":176,"text":569},{"id":622,"depth":176,"text":623},"ed25519 keys and BIP39 words to NEAR implicit accounts. The account ID is the public key in hex. Named accounts stay on chain.","md",null,{"icon":656},"i-token-near",{"title":658,"description":652},"NEAR implicit accounts from keys and BIP39 words","518nWsp8SyauzDvhwoxhoPRupBYFyoXtTAN2FuLFYuY",[661,663],{"title":92,"path":93,"stem":94,"description":662,"children":-1},"Bitcoin's driver with Litecoin's prefixes. Five address formats on mainnet and testnet and its own signed message preamble.",{"title":100,"path":101,"stem":102,"description":664,"children":-1},"ed25519. The address is the public key itself in base58 with nothing hashed.",1791332321680]