[{"data":1,"prerenderedAt":708},["ShallowReactive",2],{"navigation_docs":3,"-guide-balances":96,"-guide-balances-surround":703},[4,48],{"title":5,"path":6,"stem":7,"children":8,"icon":47},"Guide","\u002Fguide","1.guide\u002F01.index",[9,11,15,19,23,27,31,35,39,43],{"title":10,"path":6,"stem":7},"Getting Started",{"title":12,"path":13,"stem":14},"Puzzle records","\u002Fguide\u002Frecords","1.guide\u002F02.records",{"title":16,"path":17,"stem":18},"Registry","\u002Fguide\u002Fregistry","1.guide\u002F03.registry",{"title":20,"path":21,"stem":22},"Lookups and views","\u002Fguide\u002Flookups","1.guide\u002F04.lookups",{"title":24,"path":25,"stem":26},"Verification","\u002Fguide\u002Fverification","1.guide\u002F05.verification",{"title":28,"path":29,"stem":30},"Balances","\u002Fguide\u002Fbalances","1.guide\u002F06.balances",{"title":32,"path":33,"stem":34},"CLI","\u002Fguide\u002Fcli","1.guide\u002F07.cli",{"title":36,"path":37,"stem":38},"Agents","\u002Fguide\u002Fagents","1.guide\u002F08.agents",{"title":40,"path":41,"stem":42},"Custom collections","\u002Fguide\u002Fcustom","1.guide\u002F09.custom",{"title":44,"path":45,"stem":46},"Playground","\u002Fguide\u002Fplayground","1.guide\u002F10.playground","i-lucide-book-open",{"title":49,"path":50,"stem":51,"children":52,"icon":95},"Collections","\u002Fcollections","2.collections\u002F00.index",[53,55,59,63,67,71,75,79,83,87,91],{"title":54,"path":50,"stem":51},"Overview",{"title":56,"path":57,"stem":58},"Bitcoin puzzle transaction","\u002Fcollections\u002Fb1000","2.collections\u002F01.b1000",{"title":60,"path":61,"stem":62},"RushWallet contest","\u002Fcollections\u002Frushwallet","2.collections\u002F02.rushwallet",{"title":64,"path":65,"stem":66},"Zden's puzzles","\u002Fcollections\u002Fzden","2.collections\u002F03.zden",{"title":68,"path":69,"stem":70},"Arweave bounties","\u002Fcollections\u002Farweave","2.collections\u002F04.arweave",{"title":72,"path":73,"stem":74},"WarpWallet challenges","\u002Fcollections\u002Fwarp","2.collections\u002F05.warp",{"title":76,"path":77,"stem":78},"Hash collision bounties","\u002Fcollections\u002Fhash_collision","2.collections\u002F06.hash_collision",{"title":80,"path":81,"stem":82},"Ballet wallets","\u002Fcollections\u002Fballet","2.collections\u002F07.ballet",{"title":84,"path":85,"stem":86},"Bitimage","\u002Fcollections\u002Fbitimage","2.collections\u002F08.bitimage",{"title":88,"path":89,"stem":90},"Bitaps mnemonic challenge","\u002Fcollections\u002Fbitaps","2.collections\u002F09.bitaps",{"title":92,"path":93,"stem":94},"GSMG.io puzzle","\u002Fcollections\u002Fgsmg","2.collections\u002F10.gsmg","i-lucide-layers",{"id":97,"title":28,"body":98,"description":696,"extension":697,"links":698,"meta":699,"navigation":158,"path":29,"seo":701,"stem":30,"__hash__":702},"docs\u002F1.guide\u002F06.balances.md",{"type":99,"value":100,"toc":689},"minimark",[101,106,301,327,408,412,491,506,510,566,599,603,656,662,666,685],[102,103,105],"h2",{"id":104},"the-call","The call",[107,108,113],"pre",{"className":109,"code":110,"language":111,"meta":112,"style":112},"language-ts shiki shiki-themes github-light github-light vitesse-dark","import { b1000 } from \"@agntn\u002Fpuzzles\u002Fcollections\u002Fb1000\";\n\nconst balance = await b1000.require(71).balance();\n\nbalance.chain; \u002F\u002F \"bitcoin\"\nbalance.confirmed; \u002F\u002F 710022600n, base units\nbalance.unconfirmed; \u002F\u002F 0n, a signed mempool delta when the provider reports one\nbalance.total(); \u002F\u002F 710022600n\nbalance.totalUnits(); \u002F\u002F 7.100226\nbalance.decimals; \u002F\u002F 8, from @agntn\u002Fchains\n","ts","",[114,115,116,153,160,203,208,225,240,255,271,286],"code",{"__ignoreMap":112},[117,118,121,125,129,133,136,139,143,147,150],"span",{"class":119,"line":120},"line",1,[117,122,124],{"class":123},"sds8u","import",[117,126,128],{"class":127},"s14qF"," {",[117,130,132],{"class":131},"s9qSu"," b1000",[117,134,135],{"class":127}," }",[117,137,138],{"class":123}," from",[117,140,142],{"class":141},"s2tGe"," \"",[117,144,146],{"class":145},"skmWX","@agntn\u002Fpuzzles\u002Fcollections\u002Fb1000",[117,148,149],{"class":141},"\"",[117,151,152],{"class":127},";\n",[117,154,156],{"class":119,"line":155},2,[117,157,159],{"emptyLinePlaceholder":158},true,"\n",[117,161,163,167,171,175,178,180,183,187,190,194,197,200],{"class":119,"line":162},3,[117,164,166],{"class":165},"sO_1p","const",[117,168,170],{"class":169},"sHhh0"," balance",[117,172,174],{"class":173},"sLuFV"," =",[117,176,177],{"class":123}," await",[117,179,132],{"class":131},[117,181,182],{"class":127},".",[117,184,186],{"class":185},"sTnI0","require",[117,188,189],{"class":127},"(",[117,191,193],{"class":192},"sw1C9","71",[117,195,196],{"class":127},").",[117,198,199],{"class":185},"balance",[117,201,202],{"class":127},"();\n",[117,204,206],{"class":119,"line":205},4,[117,207,159],{"emptyLinePlaceholder":158},[117,209,211,213,215,218,221],{"class":119,"line":210},5,[117,212,199],{"class":131},[117,214,182],{"class":127},[117,216,217],{"class":131},"chain",[117,219,220],{"class":127},";",[117,222,224],{"class":223},"sjj-T"," \u002F\u002F \"bitcoin\"\n",[117,226,228,230,232,235,237],{"class":119,"line":227},6,[117,229,199],{"class":131},[117,231,182],{"class":127},[117,233,234],{"class":131},"confirmed",[117,236,220],{"class":127},[117,238,239],{"class":223}," \u002F\u002F 710022600n, base units\n",[117,241,243,245,247,250,252],{"class":119,"line":242},7,[117,244,199],{"class":131},[117,246,182],{"class":127},[117,248,249],{"class":131},"unconfirmed",[117,251,220],{"class":127},[117,253,254],{"class":223}," \u002F\u002F 0n, a signed mempool delta when the provider reports one\n",[117,256,258,260,262,265,268],{"class":119,"line":257},8,[117,259,199],{"class":131},[117,261,182],{"class":127},[117,263,264],{"class":185},"total",[117,266,267],{"class":127},"();",[117,269,270],{"class":223}," \u002F\u002F 710022600n\n",[117,272,274,276,278,281,283],{"class":119,"line":273},9,[117,275,199],{"class":131},[117,277,182],{"class":127},[117,279,280],{"class":185},"totalUnits",[117,282,267],{"class":127},[117,284,285],{"class":223}," \u002F\u002F 7.100226\n",[117,287,289,291,293,296,298],{"class":119,"line":288},10,[117,290,199],{"class":131},[117,292,182],{"class":127},[117,294,295],{"class":131},"decimals",[117,297,220],{"class":127},[117,299,300],{"class":223}," \u002F\u002F 8, from @agntn\u002Fchains\n",[302,303,304,305,308,309,312,313,316,317,326],"p",{},"Every puzzle answers ",[114,306,307],{},"balance()",". Collections forward ",[114,310,311],{},"balance(query)"," and ",[114,314,315],{},"balanceById(id)"," to it. The providers come from ",[318,319,323],"a",{"href":320,"rel":321},"https:\u002F\u002Fexplorers.agntn.dev",[322],"nofollow",[114,324,325],{},"@agntn\u002Fexplorers"," and load on the first call, so importing the package carries no network code.",[328,329,330,346],"table",{},[331,332,333],"thead",{},[334,335,336,340,343],"tr",{},[337,338,339],"th",{},"Chain",[337,341,342],{},"Provider",[337,344,345],{},"Needs",[347,348,349,361,372,383,393],"tbody",{},[334,350,351,355,358],{},[352,353,354],"td",{},"Bitcoin, Litecoin",[352,356,357],{},"Mempool, mempool.space and litecoinspace.org",[352,359,360],{},"nothing",[334,362,363,366,369],{},[352,364,365],{},"Ethereum",[352,367,368],{},"Etherscan V2",[352,370,371],{},"an API key",[334,373,374,377,380],{},[352,375,376],{},"Decred",[352,378,379],{},"Dcrdata",[352,381,382],{},"nothing, and patience: dcrdata answers a fresh address in 6 to 11 seconds",[334,384,385,388,391],{},[352,386,387],{},"Arweave",[352,389,390],{},"the arweave.net gateway",[352,392,360],{},[334,394,395,398,401],{},[352,396,397],{},"Monero",[352,399,400],{},"none",[352,402,403,404,407],{},"rejects with ",[114,405,406],{},"UnsupportedChainError"," before any request",[102,409,411],{"id":410},"options","Options",[107,413,415],{"className":109,"code":414,"language":111,"meta":112,"style":112},"await puzzle.balance({\n  apiKey: \"your-etherscan-key\",\n  baseUrl: \"https:\u002F\u002Fmempool.example\", \u002F\u002F another instance of the same provider\n  timeout: 30_000, \u002F\u002F milliseconds, the providers default to 15 seconds\n});\n",[114,416,417,432,451,471,486],{"__ignoreMap":112},[117,418,419,422,425,427,429],{"class":119,"line":120},[117,420,421],{"class":123},"await",[117,423,424],{"class":131}," puzzle",[117,426,182],{"class":127},[117,428,199],{"class":185},[117,430,431],{"class":127},"({\n",[117,433,434,438,441,443,446,448],{"class":119,"line":155},[117,435,437],{"class":436},"sC822","  apiKey",[117,439,440],{"class":127},": ",[117,442,149],{"class":141},[117,444,445],{"class":145},"your-etherscan-key",[117,447,149],{"class":141},[117,449,450],{"class":127},",\n",[117,452,453,456,458,460,463,465,468],{"class":119,"line":162},[117,454,455],{"class":436},"  baseUrl",[117,457,440],{"class":127},[117,459,149],{"class":141},[117,461,462],{"class":145},"https:\u002F\u002Fmempool.example",[117,464,149],{"class":141},[117,466,467],{"class":127},", ",[117,469,470],{"class":223},"\u002F\u002F another instance of the same provider\n",[117,472,473,476,478,481,483],{"class":119,"line":205},[117,474,475],{"class":436},"  timeout",[117,477,440],{"class":127},[117,479,480],{"class":192},"30_000",[117,482,467],{"class":127},[117,484,485],{"class":223},"\u002F\u002F milliseconds, the providers default to 15 seconds\n",[117,487,488],{"class":119,"line":210},[117,489,490],{"class":127},"});\n",[302,492,493,494,497,498,501,502,505],{},"That's the whole options object. There's no ",[114,495,496],{},"fetch"," to inject. The providers read ",[114,499,500],{},"globalThis.fetch"," when they run, so a test stubs the global and a runtime brings its own. Ethereum without a key rejects with ",[114,503,504],{},"BalanceProviderError"," before it touches the network. Etherscan would reject it anyway, just slower.",[102,507,509],{"id":508},"errors","Errors",[107,511,513],{"className":109,"code":512,"language":111,"meta":112,"style":112},"import {\n  BalanceError,\n  BalanceProviderError,\n  InvalidAddressError,\n  UnsupportedChainError,\n} from \"@agntn\u002Fpuzzles\";\n",[114,514,515,522,529,536,543,550],{"__ignoreMap":112},[117,516,517,519],{"class":119,"line":120},[117,518,124],{"class":123},[117,520,521],{"class":127}," {\n",[117,523,524,527],{"class":119,"line":155},[117,525,526],{"class":131},"  BalanceError",[117,528,450],{"class":127},[117,530,531,534],{"class":119,"line":162},[117,532,533],{"class":131},"  BalanceProviderError",[117,535,450],{"class":127},[117,537,538,541],{"class":119,"line":205},[117,539,540],{"class":131},"  InvalidAddressError",[117,542,450],{"class":127},[117,544,545,548],{"class":119,"line":210},[117,546,547],{"class":131},"  UnsupportedChainError",[117,549,450],{"class":127},[117,551,552,555,557,559,562,564],{"class":119,"line":227},[117,553,554],{"class":127},"}",[117,556,138],{"class":123},[117,558,142],{"class":141},[117,560,561],{"class":145},"@agntn\u002Fpuzzles",[117,563,149],{"class":141},[117,565,152],{"class":127},[302,567,568,569,572,573,576,577,580,581,584,585,587,588,590,591,594,595,598],{},"All three descend from ",[114,570,571],{},"BalanceError",", which descends from ",[114,574,575],{},"PuzzlesError",". ",[114,578,579],{},"InvalidAddressError"," is a provider or ",[114,582,583],{},"@agntn\u002Fchains"," saying the address doesn't fit. ",[114,586,406],{}," is Monero. ",[114,589,504],{}," is everything else: a transport failure, a not numeric balance, a rejected key. An API key never appears in an error message. It's replaced with ",[114,592,593],{},"REDACTED",", and the original error isn't attached as ",[114,596,597],{},"cause",", so it can't leak through a logger either.",[102,600,602],{"id":601},"cli-and-tools","CLI and tools",[107,604,608],{"className":605,"code":606,"language":607,"meta":112,"style":112},"language-bash shiki shiki-themes github-light github-light vitesse-dark","puzzles balance b1000\u002F71                       # b1000\u002F71: 7.100226 BTC\npuzzles balance arweave\u002Fweave11 --api-key …    # Ethereum, or set ETHERSCAN_API_KEY\npuzzles balance b1000\u002F71 --json                # { chain, confirmed, unconfirmed, decimals }\n","bash",[114,609,610,623,642],{"__ignoreMap":112},[117,611,612,615,617,620],{"class":119,"line":120},[117,613,614],{"class":185},"puzzles",[117,616,170],{"class":145},[117,618,619],{"class":145}," b1000\u002F71",[117,621,622],{"class":223},"                       # b1000\u002F71: 7.100226 BTC\n",[117,624,625,627,629,632,636,639],{"class":119,"line":155},[117,626,614],{"class":185},[117,628,170],{"class":145},[117,630,631],{"class":145}," arweave\u002Fweave11",[117,633,635],{"class":634},"sAsIS"," --api-key",[117,637,638],{"class":145}," …",[117,640,641],{"class":223},"    # Ethereum, or set ETHERSCAN_API_KEY\n",[117,643,644,646,648,650,653],{"class":119,"line":162},[117,645,614],{"class":185},[117,647,170],{"class":145},[117,649,619],{"class":145},[117,651,652],{"class":634}," --json",[117,654,655],{"class":223},"                # { chain, confirmed, unconfirmed, decimals }\n",[302,657,658,661],{},[114,659,660],{},"puzzles_balance"," is the same call for a model. It's the only tool annotated as open world, because it's the only one that reaches beyond the bundled dataset.",[102,663,665],{"id":664},"on-this-site","On this site",[302,667,668,669,672,673,676,677,680,681,684],{},"Every puzzle page and the playground show a live balance. The browser doesn't call the explorers itself. The docs worker does, through ",[114,670,671],{},"\u002Fapi\u002Fbalance\u002F\u003Cid>",", with the same ",[114,674,675],{},"puzzle.balance()"," call and its own Etherscan key. Each answer is cached for five minutes, so a busy page is one request to mempool.space, not a thousand. A failure comes back as the library's own message, ",[114,678,679],{},"Balance lookup failed: …",", under the same status code the tool would set ",[114,682,683],{},"isError"," for.",[686,687,688],"style",{},"html pre.shiki code .sds8u, html code.shiki .sds8u{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#4D9375}html pre.shiki code .s14qF, html code.shiki .s14qF{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#666666}html pre.shiki code .s9qSu, html code.shiki .s9qSu{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#BD976A}html pre.shiki code .s2tGe, html code.shiki .s2tGe{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#C98A7D77}html pre.shiki code .skmWX, html code.shiki .skmWX{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#C98A7D}html pre.shiki code .sO_1p, html code.shiki .sO_1p{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#CB7676}html pre.shiki code .sHhh0, html code.shiki .sHhh0{--shiki-light:#005CC5;--shiki-default:#005CC5;--shiki-dark:#BD976A}html pre.shiki code .sLuFV, html code.shiki .sLuFV{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#666666}html pre.shiki code .sTnI0, html code.shiki .sTnI0{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#80A665}html pre.shiki code .sw1C9, html code.shiki .sw1C9{--shiki-light:#005CC5;--shiki-default:#005CC5;--shiki-dark:#4C9A91}html pre.shiki code .sjj-T, html code.shiki .sjj-T{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#758575DD}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 .sC822, html code.shiki .sC822{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#B8A965}html pre.shiki code .sAsIS, html code.shiki .sAsIS{--shiki-light:#005CC5;--shiki-default:#005CC5;--shiki-dark:#C99076}",{"title":112,"searchDepth":155,"depth":155,"links":690},[691,692,693,694,695],{"id":104,"depth":155,"text":105},{"id":410,"depth":155,"text":411},{"id":508,"depth":155,"text":509},{"id":601,"depth":155,"text":602},{"id":664,"depth":155,"text":665},"puzzle.balance() through the explorers provider for its chain. The one call that leaves the process. Base units as bigint. API keys never reach an error.","md",null,{"icon":700},"i-lucide-coins",{"title":28,"description":696},"Xy5b7OY1CteGcsqkaDrzY2pOjLX8vesLKv-KxO0tyiM",[704,706],{"title":24,"path":25,"stem":26,"description":705,"children":-1},"verifyPuzzle derives the address from the one secret a record exposes and compares. Expected failures are values. What can and can't be checked.",{"title":32,"path":33,"stem":34,"description":707,"children":-1},"The puzzles command. Eight subcommands and what each prints. Which ones exit 1 and what --json gives a script.",1789737888966]