Skip to content

Conversation

@BullishNode
Copy link
Contributor

Summary

Add new Cyphernode endpoint to construct Liquid explorer URLs with unblinded transaction data.

Changes

  • Add elements_getunblindedurl() function to elements_blockchainrpc.sh
  • Register endpoint handler in requesthandler.sh
  • Add watcher-level permission in api.properties

Endpoint

GET /elements_getunblindedurl/{txid}
GET /elements_getunblindedurl/{txid}/{base_url}

Response:

{
  "url": "https://liquid.network/tx/{txid}#blinded={amount},{asset},{amountblinder},{assetblinder},...",
  "txid": "{txid}"
}

URL Format

The #blinded= fragment contains comma-separated values for each output:

  • amount (in satoshis)
  • asset ID
  • amount blinder (value blinding factor)
  • asset blinder (asset blinding factor)

Multiple outputs are concatenated with commas.

Implementation Details

  1. Calls gettransaction RPC on spender node to get blinding data
  2. Filters outputs with valid (non-zero) blinding factors
  3. Converts amounts from BTC to satoshis
  4. Constructs URL with blinding fragment

Related

@BullishNode BullishNode force-pushed the features/liquid-unblinded-url branch from 824a691 to f4ea32e Compare December 21, 2025 18:16
Add new function to construct Liquid explorer URLs with unblinding data.

The function:
- Takes txid and optional base_url as parameters
- Calls gettransaction to retrieve transaction with blinding factors
- Extracts amountblinder, assetblinder, asset, and amount from details
- Filters out entries with zero blinders (unblinded outputs)
- Converts amounts from BTC to satoshis
- Constructs URL with #blinded= fragment containing comma-separated
  blinding data for each output

URL format:
{base_url}/tx/{txid}#blinded={amount},{asset},{amountblinder},{assetblinder},...

Returns JSON: {"url": "...", "txid": "..."}

Closes #359
Register the new endpoint in requesthandler.sh to expose the
elements_getunblindedurl function via HTTP.

Endpoint: GET /elements_getunblindedurl/{txid}[/{base_url}]

The base_url parameter is URL-encoded and decoded in the handler
to support URLs like https://liquid.bullbitcoin.com

Part of #359
Grant watcher-level access to the new endpoint since it only reads
transaction data and doesn't perform any spending operations.

Part of #359
Security fix: Validate txid parameter before processing to prevent
potential injection or malformed input issues.

- Checks txid is not empty
- Validates txid is exactly 64 hexadecimal characters
- Returns proper error JSON if validation fails

Code review fix for PR #360
@BullishNode BullishNode force-pushed the features/liquid-unblinded-url branch from f4ea32e to 8efc65a Compare December 21, 2025 18:26
@BullishNode BullishNode marked this pull request as ready for review December 21, 2025 18:30
- Add liquid_explorer_url property to schema (required when elements enabled)
- Add prompt in elements prompter for explorer URL
- Add LIQUID_EXPLORER_URL to proxy.env template
- Update elements_getunblindedurl to use env var instead of parameter
- Simplify endpoint to only take txid (base_url from config)
@BullishNode BullishNode force-pushed the features/liquid-unblinded-url branch from aba8ba5 to 95d7d0d Compare December 22, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants