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
269 270 271 272 273 274 275 276 277 278 279 | |
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
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | |
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
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
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
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | |
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
440 441 442 443 444 445 446 447 448 449 450 451 | |