/** * Bitcoin Address Module * * Provides Bitcoin address derivation from PKP public keys. * Supports P2WPKH (SegWit v0) addresses for mainnet, testnet, and regtest networks. * * IMPORTANT: Changed from P2PKH to P2WPKH to support witness transactions. * P2WPKH requires witness (SegWit) and produces bech32 addresses. */ /** * Derive Bitcoin P2WPKH (SegWit v0) address from PKP public key * * This is the DEFAULT address type used by vault PKPs. * Uses bech32 encoding (bc1... for mainnet, bcrt1... for regtest, tb1... for testnet). * * @param pkpPublicKey - Uncompressed public key (130 hex chars: 04 + 32 bytes X + 32 bytes Y) * @param network - Bitcoin network ("mainnet" | "testnet" | "regtest") * @returns Bitcoin Bech32 address (P2WPKH) */ export declare function deriveBitcoinAddress(pkpPublicKey: string, network: "mainnet" | "testnet" | "regtest"): Promise; /** * Derive Bitcoin P2PKH (legacy) address from PKP public key * * DEPRECATED: Use deriveBitcoinAddress() for P2WPKH instead. * This function is kept for backward compatibility only. * * @param pkpPublicKey - Uncompressed public key (130 hex chars: 04 + 32 bytes X + 32 bytes Y) * @param network - Bitcoin network ("mainnet" | "testnet" | "regtest") * @returns Bitcoin address (Base58 encoded) */ export declare function deriveBitcoinAddressP2PKH(pkpPublicKey: string, network: "mainnet" | "testnet" | "regtest"): Promise; /** * Convert a Bitcoin address to its canonical output script (scriptPubKey). * * Supports every standard mainnet/testnet/regtest output type. The produced * script MUST match `bitcoinjs-lib` `address.toOutputScript` byte-for-byte: the * BTC withdrawal broadcaster (`lit-ops/src/utils/bitcoin-broadcast.ts`) builds * the broadcast transaction with bitcoinjs, while this function feeds the BIP143 * sighash the PKP signs. Any divergence yields a different `hashOutputs`, so the * signature fails `OP_CHECKSIG` on-chain (BIP146 NULLFAIL) and the network * rejects the transaction. Historically this only emitted P2PKH for base58 and * hardcoded `0014` for bech32, so P2SH / P2WSH / Taproot destinations broke. * * Address type → scriptPubKey: * - P2PKH (base58 v0x00 / v0x6f): OP_DUP OP_HASH160 <20> OP_EQUALVERIFY OP_CHECKSIG * - P2SH (base58 v0x05 / v0xc4): OP_HASH160 <20> OP_EQUAL * - SegWit (bech32/bech32m): OP_ PUSH * v0/20 = P2WPKH, v0/32 = P2WSH, v1/32 = P2TR (taproot), v2..v16 future * * Any unsupported version byte / witness version / malformed checksum THROWS — * a doomed spend is never silently encoded to the wrong script. * * @param address - Bitcoin address (Base58Check or Bech32/Bech32m encoded) * @returns ScriptPubKey hex string (no 0x prefix) */ export declare function addressToScriptPubKey(address: string): string; //# sourceMappingURL=address.d.ts.map