New answers tagged


You can use bitcoinjs Lib. function generateAddress('P2WSH', publicKeyHash, network) { return redeemScript = bitcoin.script.witnessPubKeyHash.output.encode(publicKeyHash); let redeemScriptHash = bitcoin.script.scriptHash.output.encode(bitcoin.crypto.hash160(redeemScript)); address = bitcoin.address....


Hashing Redeeem script to use in SCRIPTPUBKEY uses the wrong hash algorithm. RIPEMD160(Redscript) = f23bde7eee22aabca28164cb4b8a977834e5441b but we want HASH160 which is RIPEMD160(SHA256(Redscript)) = c39f7f611a844bd7118dac9166fa9c1398676c30 (I used this script to calculate it)


Bech32 encoding, apart from the checksum, is a simple matter of converting base-256 (8-bits) to base-32 (5-bits). Base-256 is the byte array (octet string) that you get from a hash function. Only focusing on first 3 bytes of the hash: as hex = 0x18 0x63 0x14 as bytes = 24 99 20 as binary = 00011000 01100011 00010100 In order to ...

Top 50 recent answers are included