]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
Merge pull request #466 from RitoProject/ritocoin
authoriancoleman <1281387+iancoleman@users.noreply.github.com>
Thu, 11 Feb 2021 01:58:49 +0000 (12:58 +1100)
committerGitHub <noreply@github.com>
Thu, 11 Feb 2021 01:58:49 +0000 (12:58 +1100)
Add Ritocoin (RITO)

1  2 
src/js/bitcoinjs-extensions.js
src/js/index.js
tests/spec/tests.js

index e4996ed9dc0a337ae67122013f48ff421846f58a,84363f60968a059f30b506e867cb95e4ac390cbd..84de8da579680b83e0bd9ddf2e1a07edcb3f7322
@@@ -1219,6 -1219,17 +1219,17 @@@ libs.bitcoin.networks.revolutionvr = 
    wif: 0xc6,
  };
  
+ libs.bitcoin.networks.ritocoin = {
+   messagePrefix: '\x15Rito Signed Message:\n',
+   bip32: {
+     public: 0x0488B21E,
+     private: 0x0488ADE4,
+   },
+   pubKeyHash: 0x19,
+   scriptHash: 0x69,
+   wif: 0x8b,
+ };
  libs.bitcoin.networks.rsk = {
    messagePrefix: '\x18RSK Signed Message:\n',
    bip32: {
@@@ -1553,18 -1564,6 +1564,18 @@@ libs.bitcoin.networks.hush3 = 
    wif: 0xBC,
  };
  
 +libs.bitcoin.networks.zoobc = {
 +  messagePrefix: '\x18ZooBC Signed Message:\n',
 +  bech32: 'bc',
 +  bip32: {
 +    public: 0x0488b21e,
 +    private: 0x0488ade4,
 +  },
 +  pubKeyHash: 0x00,
 +  scriptHash: 0x05,
 +  wif: 0x80,
 +};
 +
  libs.bitcoin.networks.zclassic = {
    messagePrefix: '\x18Zcash Signed Message:\n',
    bip32: {
diff --combined src/js/index.js
index 1f4cc1fe12ab203ff39474804ac1e63c44c1463b,f7835fa9f92e208ddccfb7e31d8deb077cd3dc25..713b5e847c1a5da4046d89fccd790ca03e58c425
                           address = libs.bchaddrSlp.toSlpAddress(address);
                       }
                   }
 +
 +                // ZooBC address format may vary
 +                if (networks[DOM.network.val()].name == "ZBC - ZooBlockchain") {  
 +                    
 +                    var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44);
 +                    var coin = parseIntNoNaN(DOM.bip44coin.val(), 0);
 +                    var path = "m/";
 +                        path += purpose + "'/";
 +                        path += coin + "'/" + index + "'";
 +                    var result = libs.zoobcUtil.getKeypair(path, seed);
 +    
 +                    let publicKey = result.pubKey.slice(1, 33);
 +                    let privateKey = result.key;
 +    
 +                    privkey = privateKey.toString('hex');
 +                    pubkey = publicKey.toString('hex');
 +    
 +                    indexText = path;
 +                    address = libs.zoobcUtil.getZBCAddress(publicKey, 'ZBC');
 +                }
 +
                  // Segwit addresses are different
                  if (isSegwit) {
                      if (!segwitAvailable) {
                  setHdCoin(4);
              },
          },
+         {
+             name: "RITO - Ritocoin",
+             onSelect: function() {
+                 network = libs.bitcoin.networks.ritocoin;
+                 setHdCoin(19169);
+             },
+         },
          {
              name: "RVR - RevolutionVR",
              onSelect: function() {
                  setHdCoin(136);
              },
          },
 +        {
 +            name: "ZBC - ZooBlockchain",
 +            onSelect: function () {
 +            network = libs.bitcoin.networks.zoobc;
 +            setHdCoin(883);
 +            },
 +        },
          {
              name: "ZCL - Zclassic",
              onSelect: function() {
diff --combined tests/spec/tests.js
index ca5b1bbc2e496bfbbe2f6fb27dce75a1927e245e,9c3eb6abe7bf136a9635d80cff226cef9595f82b..f350fa7a3d60db80a1d60138f54b97fa7db4f964
@@@ -1635,6 -1635,16 +1635,16 @@@ it('Allows selection of RevolutionVR', 
      };
      testNetwork(done, params);
  });
+ it('Allows selection of Ritocoin', function(done) {
+     var params = {
+         selectText: "RITO - Ritocoin",
+         phrase: "abandon abandon ability",
+         firstAddress: "BMbHdwDiuaZh4ATp8Xapf4srv3swzAGgkf",
+         firstPubKey: "036f5f55dc37fa97294a2a5ae4d92735d4392d4405cbbebebf2d70d5d6781be622",
+         firstPrivKey: "L1CyVD5ADNgSUxZn6kRpJe9e17FDuAZzRGwNjvDBnEqRWjo4SEAX",
+     };
+     testNetwork(done, params);
+ });
  it('Allows selection of Rubycoin', function(done) {
      var params = {
          selectText: "RBY - Rubycoin",
@@@ -2328,17 -2338,6 +2338,17 @@@ it('Allows selection of TRX on Tron', f
      testNetwork(done, params);
  });
  
 +it('Allows selection of ZooBlockchain', function(done) {
 +    var params = {
 +        selectText: "ZBC - ZooBlockchain",
 +        phrase: "shy invest oxygen real lunar moral merge corn program air affair amazing dove imitate combine solve library fresh case alcohol pole question act thing",
 +        firstAddress: "ZBC_MGEZVH3U_SXPCBHTU_KSWDPQ4X_K6MSI3VR_CQAYMTLC_RXUMM3DJ_LFABCAXA",
 +        firstPubKey: "61899a9f7495de209e7454ac37c3975799246eb11401864d628de8c66c695940",
 +        firstPrivKey: "adb11e79068fa7366ec4f5963ad57115d666b1ad2b369b92d962563adf7dd48b",
 +    };
 +    testNetwork(done, params);
 +});
 +
  // BIP39 seed is set from phrase
  it('Sets the bip39 seed from the prhase', function(done) {
      driver.findElement(By.css('.phrase'))