Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Network

Class Network describes an extended key prefix of 4 bytes. This object is defined by public and private fields containing the unsigned integer value of the prefix.

For the BITCOIN protocol, the prefixes result to xprv and xpub for the mainnet network. The master secret used is "Bitcoin seed".

For the SYMBOL protocol, we will be using the same prefixes and extended key sizes and formats but use a custom "ed25519 seed" master secret.

For the ETHEREUM protocol, we also use the same prefixes for xprv and xpub and use the same master secret as used in Bitcoin.

see

https://github.com/bitcoinjs/bip32/blob/master/src/bip32.js#L19

see

https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

see

https://github.com/bitcoinjs/bip32

see

https://github.com/nemtech/NIP/issues/12

since

0.1.0

Hierarchy

  • Network

Index

Constructors

constructor

  • Construct an Network object out of its' base58 payload.

    Result in Base58 notation to xpub and xprv.

    Parameters

    • publicKeyPrefix: number
    • privateKeyPrefix: number
    • Default value curve: CurveAlgorithm = CurveAlgorithm.secp256k1
    • Default value seedPrefix: string = "Bitcoin seed"
    • Default value publicKeyEnc: KeyEncoding = KeyEncoding.ENC_HEX

    Returns Network

Properties

curve

The ellyptic curve algorithm

var

{CurveAlgorithm}

privateKeyPrefix

privateKeyPrefix: number

Prefix for extended private key (4 bytes unsigned integer)

var

{number}

publicKeyEnc

publicKeyEnc: KeyEncoding

The public key encoding. Ethereum uses uncompressed public keys, Bitcoin and Symbol use compressed public keys.

var

{KeyEncoding}

publicKeyPrefix

publicKeyPrefix: number

Prefix for extended public key (4 bytes unsigned integer)

var

{number}

seedPrefix

seedPrefix: string

The "master secret" used as a prefix for derived curve nodes.

var

{string}

Static BITCOIN

BITCOIN: Network = new Network(0x0488b21e, // base58 'xpub'0x0488ade4, // base58 'xprv'CurveAlgorithm.secp256k1,'Bitcoin seed',KeyEncoding.ENC_HEX,)

BITCOIN protocol extended key prefixes

Result in Base58 notation to xpub and xprv.

see

https://github.com/bitcoinjs/bip32/blob/master/src/bip32.js#L19

var

{Network}

Static ETHEREUM

ETHEREUM: Network = new Network(0x0488b21e, // base58 'xpub'0x0488ade4, // base58 'xprv'CurveAlgorithm.ed25519,'Bitcoin seed',KeyEncoding.ENC_UCP, // uncompressed public keys)

ETHEREUM public network protocol extended key prefixes

Result in Base58 notation to xpub and xprv.

var

{Network}

Static SYMBOL

SYMBOL: Network = new Network(0x0488b21e, // base58 'xpub'0x0488ade4, // base58 'xprv'CurveAlgorithm.ed25519,'ed25519 seed',KeyEncoding.ENC_HEX,)

SYMBOL public network protocol extended key prefixes

Result in Base58 notation to xpub and xprv.

var

{Network}

Methods

equals

  • Checks whether current network instance is identical to given b network instance.

    Parameters

    • b: Network

      The network object to compare against

    Returns boolean

    Returns whether the two objects are identical

Generated using TypeDoc