BIP49

BIP49

new BIP49()

Description:
  • BIP49 utilities for wrapped SegWit addresses

Source:

Methods

(static) createRedeemScript(publicKey) → {Buffer}

Description:
  • Create redeem script for P2SH-P2WPKH

Source:
Parameters:
Name Type Description
publicKey Buffer | string

Compressed public key

Returns:

Redeem script (P2WPKH script)

Type
Buffer

(static) createScriptPubKey(publicKey) → {Buffer}

Description:
  • Create scriptPubKey for P2SH-P2WPKH address

Source:
Parameters:
Name Type Description
publicKey Buffer | string

Compressed public key

Returns:

P2SH scriptPubKey

Type
Buffer

(static) getAccountPath(networkopt, accountopt) → {string}

Description:
  • Get account-level derivation path

Source:
Parameters:
Name Type Attributes Default Description
network string <optional>
'main'

Network type

account number <optional>
0

Account index

Returns:

Account path

Type
string

(static) getDerivationPath(networkopt, accountopt, changeopt, indexopt) → {string}

Description:
  • Get derivation path for BIP49

Source:
Parameters:
Name Type Attributes Default Description
network string <optional>
'main'

Network type

account number <optional>
0

Account index

change number <optional>
0

Change (0=external, 1=internal)

index number <optional>
0

Address index

Returns:

Derivation path

Type
string

(static) toAddress(publicKey, networkopt) → {string}

Description:
  • Create P2SH-P2WPKH address from public key

Source:
Parameters:
Name Type Attributes Default Description
publicKey Buffer | string

Compressed public key (33 bytes)

network string <optional>
'main'

Network type

Returns:

P2SH address (3... or 2...)

Type
string