I'm building a script and have it's hex representation, then I convert it to a pubkey and address, which results in something like: 3NqNAUBEWarVjKerLcCnPrTGbaQ4QFcAfr or 2N7aFmKeUXbTSowccnkzJ44BZj8HFqLUUdm (when I set testnet parameters)
in elements when I try to build a transaction with
createrawtransaction to put some coin to that address I get:
Invalid prefix for Base58-encoded address
I've tried to build a descriptor with sh() and import it but that won't work because custom scripts are not supported.
Is it possible to use P2SH in elements? How do you generate the address from the script hex (it looks like it's different from bitcoin)?
PS: the script is built with python bitcoinlib like this
redeemScript = CScript([winner_key, OP_CHECKSIG, OP_IFDUP, OP_NOTIF, cashback_key, OP_CHECKSIGVERIFY, blocks_b, OP_CHECKSEQUENCEVERIFY, OP_ENDIF ])
where keys are hex representation of bytes, blocks_b is an int represented in bytes.hex(), I'm not really sure this is working, but I think there is something I'm missing on how to generate the address first.