aegis/lib/dgb/core/network.js

74 lines
2.8 KiB
JavaScript
Raw Normal View History

// DigiByte mainnet parameters. Sourced from
// github.com/DigiByte-Core/digibyte src/kernel/chainparams.cpp CMainParams.
//
// Note on scriptHash: DGB Core defines BOTH SCRIPT_ADDRESS = 0x3f ("S..."
// addresses, the current default) and SCRIPT_ADDRESS2 = 0x05 ("3..."
// addresses, kept for Bitcoin compatibility). Older BIP39 tools and
// wallets that forked bitcoinjs-lib params generate 3-addresses; current
// DGB Core generates S-addresses. `digibyte` below uses the current
// default; use `digibyteLegacyP2SH` when recovering from Ian Coleman's
// BIP39 tool, older Atomic/Exodus vintages, or anything else that
// inherited Bitcoin's 0x05 P2SH byte. Both are valid on-chain.
export const digibyte = {
messagePrefix: '\x19DigiByte Signed Message:\n',
bech32: 'dgb',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4,
},
pubKeyHash: 0x1e,
scriptHash: 0x3f,
wif: 0x80,
};
// Same as `digibyte`, but with the legacy Bitcoin-compatible P2SH
// version byte. Use for producing/scanning "3..."-style P2SH addresses
// during seed recovery from tools that predate the 0x3f switch.
// DGB Core keeps SCRIPT_ADDRESS_OLD = 5 for backward compatibility.
export const digibyteLegacyP2SH = {
...digibyte,
scriptHash: 0x05,
};
// Same as `digibyte`, but with the legacy WIF version byte.
// DGB Core keeps SECRET_KEY_OLD = 158 (0x9e) for backward compatibility.
// Older DGB tools may have exported private keys with this prefix.
// The wallet's WIF-import path should try both `digibyte` and this
// variant before rejecting a key.
export const digibyteLegacyWIF = {
...digibyte,
wif: 0x9e,
};
// DigiByte testnet parameters. From CTestNetParams in chainparams.cpp.
export const digibyteTestnet = {
messagePrefix: '\x19DigiByte Signed Message:\n',
bech32: 'dgbt',
bip32: {
public: 0x043587cf,
private: 0x04358394,
},
pubKeyHash: 0x7e,
scriptHash: 0x8c,
wif: 0xef,
};
// SLIP-0044 registered coin type.
export const DGB_COIN_TYPE = 20;
// P2P network constants (unused by @dgb-wallet/core itself, exposed for
// the P2P client package that will consume them).
export const DGB_P2P = {
// pchMessageStart in DGB Core chainparams.cpp is the byte sequence
// 0xFA 0xC3 0xB6 0xDA on the wire. `writeUInt32LE(magic)` writes
// least-significant-byte first, so the integer value stored here must
// be the LE-reading: 0xDAB6C3FA (byte 0 = 0xFA, byte 3 = 0xDA).
// Getting this wrong means peers see wrong-network frames and close
// immediately at handshake.
magic: 0xdab6c3fa,
defaultPort: 12024,
rpcPort: 14022,
dnsSeeds: [
'seed.digibyte.io',
'seed.diginode.tools',
'seed.digibyte.link',
'seed.aroundtheblock.app',
'seed.tuyul.cc',
],
};
//# sourceMappingURL=network.js.map