Skip to content

feat: add ITransactionTransformer for Liquid network support - #892

Open
dangershony wants to merge 1 commit into
mainfrom
feat/liquid-transaction-transformer
Open

feat: add ITransactionTransformer for Liquid network support#892
dangershony wants to merge 1 commit into
mainfrom
feat/liquid-transaction-transformer

Conversation

@dangershony

Copy link
Copy Markdown
Member

Summary

Adds an abstraction layer for network-specific transaction transformations, enabling Liquid (Elements) network support alongside Bitcoin.

New files

  • *\ITransactionTransformer* — interface for wrapping P2WPKH, Taproot, and P2WSH transactions for the target network. Also provides \GetSighashTransaction\ / \GetSighashSpentOutputs\ for computing sighashes on the correct network representation.

  • *\BitcoinTransactionTransformer* — no-op implementation for Bitcoin. All methods return their inputs unchanged.

  • *\LiquidTransactionTransformer* — Elements implementation that rebuilds transactions with explicit L-BTC asset tags, adds an explicit fee output, and re-signs using the Liquid network parameters.

Modified files

  • *\TransactionInfo* — added \TransactionHex\ and \TransactionId\ properties so network-specific representations (e.g. Elements hex) can be carried alongside the Blockcore \Transaction\ object.

Add an abstraction layer for network-specific transaction transformations:

- ITransactionTransformer: interface for wrapping P2WPKH, Taproot, and
  P2WSH transactions for the target network
- BitcoinTransactionTransformer: no-op implementation for Bitcoin
  (returns inputs unchanged)
- LiquidTransactionTransformer: rebuilds transactions as Elements
  format with explicit L-BTC asset tags, fee outputs, and re-signs
- TransactionInfo: add TransactionHex and TransactionId properties
  so network-specific representations can be carried alongside the
  Blockcore Transaction object
@dangershony

Copy link
Copy Markdown
Member Author

Integration assessment ? what's left to make Liquid work end-to-end

This PR adds the cryptographic conversion layer only; nothing calls the transformer yet. Here's an assessment of the remaining work to get Liquid working on mainnet.

Already done on main

  • AngorNetwork.Liquid() exists (src/shared/Angor.Shared/Networks/AngorNetwork.cs) wrapping NBitcoin's Liquid mainnet
  • Network selection UI (Avalonia, design app, webapp) already lists Liquid
  • Per-network indexer/explorer config with Liquid defaults (https://liquid.angor.online) and genesis-hash validation
  • Unblinded ex1 address generation works via NBitcoin's Liquid network object

Remaining code work

Task Notes
Wire the transformer into ~10 sign/broadcast sites WalletOperations.cs (4 spots), InvestorTransactionActions.cs, FounderTransactionActions.cs, SeederTransactionActions.cs, SpendingTransactionBuilder.cs, InvestmentTransactionBuilder.cs + per-network DI registration ? largest task
Broadcast paths must send TransactionInfo.TransactionHex (Elements hex) instead of .ToHex() WalletOperations.cs, MempoolSpaceIndexerApi.PublishTransactionAsync
Fee logic Liquid fees ~0.1 sat/vB, fee is an explicit output, Elements txs are larger than the Bitcoin vsize math assumes
L-BTC asset filtering in client-side Esplora parsing Elements vouts carry an asset field; without filtering, any non-L-BTC asset sent to a wallet address would be counted as sats
Tests No transformer or Liquid tests exist yet
Confidential lq1 addresses / blinded UTXOs Out of scope here ? separate, larger phase

Infrastructure

Since Angor project scanning is now computed client-side against generic Esplora endpoints, no custom indexer is needed ? just:

  1. An Elements node (mainnet for prod; liquidtestnet or local Elements regtest for dev ? the docker/boltz/ stack already includes Elements regtest)
  2. A stock Esplora-Elements instance at liquid.angor.online (doubles as the explorer)

Risk concentration

The riskiest part is the Elements taproot sighash logic in this PR ? it needs validation by broadcasting real invest ? recover ? founder-spend ? penalty flows on liquidtestnet before mainnet.

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.

1 participant