From 4958ea8009e3c950a680bded814994428630b645 Mon Sep 17 00:00:00 2001 From: Jang Chongchan Date: Fri, 24 Apr 2020 10:20:50 +0900 Subject: Add Sugarchain support --- src/js/bitcoinjs-extensions.js | 11 +++++++++++ src/js/index.js | 7 +++++++ src/js/segwit-parameters.js | 26 ++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) (limited to 'src/js') diff --git a/src/js/bitcoinjs-extensions.js b/src/js/bitcoinjs-extensions.js index 17475b1..7446bd7 100644 --- a/src/js/bitcoinjs-extensions.js +++ b/src/js/bitcoinjs-extensions.js @@ -1739,6 +1739,17 @@ libs.bitcoin.networks.elastos = { wif: 0xef // TODO set this correctly, same as BTC for now }; +libs.bitcoin.networks.sugarchain = { + messagePrefix: '\x18Sugarchain Signed Message:\n', + bip32: { + public: 0x0488B21E, + private: 0x0488ADE4, + }, + pubKeyHash: 0x3f, + scriptHash: 0x7d, + wif: 0x80 +}; + // https://github.com/libs.bitcoinjs-lib/blob/3f6f5ef97a1ee1b8337865209282c0095e22b2e7/src/networks.js libs.bitcoin.networks.regtest = { messagePrefix: '\x18Bitcoin Signed Message:\n', diff --git a/src/js/index.js b/src/js/index.js index c2d34a7..841a27f 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -3091,6 +3091,13 @@ setHdCoin(105); }, }, + { + name: "SUGAR - Sugarchain", + onSelect: function() { + network = libs.bitcoin.networks.sugarchain; + setHdCoin(408); + }, + }, { name: "SWTC - Jingtum", onSelect: function() { diff --git a/src/js/segwit-parameters.js b/src/js/segwit-parameters.js index d5ea419..0c41bf7 100644 --- a/src/js/segwit-parameters.js +++ b/src/js/segwit-parameters.js @@ -683,4 +683,30 @@ libs.bitcoin.networks.deeponion.p2wpkhInP2sh = { wif: 0x9f }; +libs.bitcoin.networks.sugarchain.p2wpkh = { + baseNetwork: "sugarchain", + messagePrefix: '\x1DSugarchain Signed Message:\n', + bech32: 'sugar', + bip32: { + public: 0x04b24746, + private: 0x04b2430c + }, + pubKeyHash: 0x3f, + scriptHash: 0x7d, + wif: 0x80 +}; + +libs.bitcoin.networks.sugarchain.p2wpkhInP2sh = { + baseNetwork: "sugarchain", + messagePrefix: '\x1DSugarchain Signed Message:\n', + bech32: 'sugar', + bip32: { + public: 0x049d7cb2, + private: 0x049d7878 + }, + pubKeyHash: 0x3f, + scriptHash: 0x7d, + wif: 0x80 +}; + })(); -- cgit v1.2.3