MultiversX Tracker is Live!

p2sh addresses in elements

Bitcoin Stack Exchange

Bitcoin News / Bitcoin Stack Exchange 159 Views

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.


Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments