jmwallet.wallet.address
jmwallet.wallet.address
Bitcoin address utilities.
Re-exports address helpers from jmcore.bitcoin.
Attributes
__all__ = ['hash160', 'pubkey_to_p2wpkh_address', 'pubkey_to_p2wpkh_script', 'script_to_p2wsh_address', 'script_to_p2wsh_scriptpubkey']
module-attribute
Functions
hash160(data: bytes) -> bytes
RIPEMD160(SHA256(data)) - Used for Bitcoin addresses.
Args: data: Input data to hash
Returns: 20-byte hash
Source code in jmcore/src/jmcore/bitcoin.py
233 234 235 236 237 238 239 240 241 242 243 | |
pubkey_to_p2wpkh_address(pubkey: bytes | str, network: str | NetworkType = 'mainnet') -> str
Convert compressed public key to P2WPKH (native SegWit) address.
Args: pubkey: 33-byte compressed public key (bytes or hex string) network: Network type
Returns: Bech32 P2WPKH address
Source code in jmcore/src/jmcore/bitcoin.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
pubkey_to_p2wpkh_script(pubkey: bytes | str) -> bytes
Create P2WPKH scriptPubKey from public key.
Args: pubkey: 33-byte compressed public key (bytes or hex string)
Returns: 22-byte P2WPKH scriptPubKey (OP_0 <20-byte-hash>)
Source code in jmcore/src/jmcore/bitcoin.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | |
script_to_p2wsh_address(script: bytes, network: str | NetworkType = 'mainnet') -> str
Convert witness script to P2WSH address.
Args: script: Witness script bytes network: Network type
Returns: Bech32 P2WSH address
Source code in jmcore/src/jmcore/bitcoin.py
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | |
script_to_p2wsh_scriptpubkey(script: bytes) -> bytes
Create P2WSH scriptPubKey from witness script.
Args: script: Witness script bytes
Returns: 34-byte P2WSH scriptPubKey (OP_0 <32-byte-hash>)
Source code in jmcore/src/jmcore/bitcoin.py
404 405 406 407 408 409 410 411 412 413 414 415 | |