Post
Topic
Board Bitcoin Technical Support
Re: Pubkey/address help needed (Python)
by
ETFbitcoin
on 09/01/2022, 12:06:48 UTC
Since it's only for testing purpose, this code should do the job. Don't forget to install https://github.com/ofek/bit first.

Code:
>>> from bit import Key
>>> key = Key()
>>> key.address
'1GCfsCqwdtM3BSxj1iXKRE4RpK4qMvZZQn'
>>> key.segwit_address
'3Gkt8rYpVuDKxCDM3dDHGUaaFEeANfqbQo'

I want to generate a P2SH address from the pubkey instead.

If you don't need any specific feature (e.g. timelock or multi-signature), you don't really need P2SH address.