Repository navigation
Look up TEX addresses (ZIP 320) by the P2PKH address they encode - #137
Open
Anirudh-712 wants to merge 2 commits into
Open
Anirudh-712 wants to merge 2 commits into
Anirudh-712 wants to merge 2 commits into
Conversation
A TEX address is a Bech32m re-encoding (HRP tex, or textest on testnet) of a 20-byte P2PKH key hash, and payments to it are ordinary P2PKH outputs. The address API decoded none of them and answered 404 "Invalid transparent address". The address and graph routes now decode TEX with the existing bech32 dependency and look up the P2PKH address. The response keeps the TEX string as address and adds transparentAddress. A TEX string with a bad checksum, another HRP, a payload that is not 20 bytes, mixed case or a Bech32 checksum returns 404 "Invalid TEX address". The address page accepts the TEX syntax, labels the page as the TEX form of its t-address with a link to it, and leaves indexing to the t-address page, which shows the same history. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Anirudh-712 is attempting to deploy a commit to the kenbak's projects Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #136.
Searching for a TEX address returns not found. For the ZIP 320 example,
GET https://api.zecblock.com/api/address/tex1s2rt77ggv6q989lr49rkgzmh5slsksa9khdgtereturns 404{"error":"Invalid transparent address"}(19 Oct 2026, 05:17 UTC). Its P2PKH form,t1VmmGiyjVNeCjxDZzg7vZmd99WyzVby9yC, returns 200.A TEX address is the 20-byte P2PKH key hash re-encoded as Bech32m with the HRP
tex(texteston testnet). Payments to it are ordinary P2PKH outputs, so its history is the t-address history (ZIP 320, Specification). ZIP 320 asks every consumer of Zcash addresses to support it.Changes
server/api/lib/zcash-address.js:texToTransparentAddress()decodes Bech32m with thebech32package the API already uses. It checks the HRP and the 20-byte length, then re-encodes Base58Check with lead bytes0x1CB8(t1) or0x1D25(tm), as in the ZIP 320 reference code. It returns null for a bad checksum, another HRP, a payload that is not 20 bytes, mixed case, or a Bech32 (not Bech32m) checksum.server/api/routes/address.js:/api/address/:addressand/api/address/:address/graphlook up the t-address fortex1...andtextest1.... The response keeps the TEX string asaddress, so the page'sdata.address !== addresscheck still matches, and addstransparentAddress. An invalid TEX string returns 404Invalid TEX address./v1/addresses/:addresspasses through as before.lib/zcash.ts, the addresspage.tsxandlayout.tsx:detectAddressTypereturnstexfor those prefixes, so search goes to/address/tex1.... BothisValidAddressSyntaxcopies accept the 38-character data part. The header reads "TEX form (ZIP 320) of transparent address t1..." and links that page.Please check
noindex, follow. They repeat the t-address page, which stays the indexed copy. A canonical link to the t-address page would be a one-line change ingenerateMetadataif you prefer that.Tests
server/api/test/zcash-address.test.js: three mainnet pairs from zcash-test-vectorszip_0320.json, the testnet pair from librustzcash'stex_testnettest, and the five rejection cases.server/tests/address-pagination.test.js: a TEX request returns the P2PKH summary, page and graph, every query uses the t-address, and invalid TEX strings return 404.server/tests/address-pagination-client.test.js:detectAddressTypefor both HRPs, and the layout links the t-address and setsindex: false.I ran these red, then green, with Node's test runner. I did not run
npm ci, sobech32,express,zod,reactandreact-domwere local stand-ins. All 15zip_0320.jsonpairs also map correctly in a scratch run.tsc --noEmit, ESLint,next buildand the route-cache build did not run here. CI runs them.The WASM
zcash_addressdecoder only exposesdecode_unified_address, so TEX does not go through it. Using it would need a WASM rebuild.🤖 Generated with Claude Code