Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Slimcoin #69

Merged
merged 3 commits into from
May 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions bip39-standalone.html
Original file line number Diff line number Diff line change
Expand Up @@ -17926,6 +17926,26 @@ <h3 data-translate>Libraries</h3>
wif: 0xb7,
};

bitcoin.networks.slimcoin = {
bip32: {
public: 0xef6adf10,
private: 0xef69ea80
},
pubKeyHash: 0x3f,
scriptHash: 0x7d,
wif: 0x46,
};

bitcoin.networks.slimcointn = {
bip32: {
public: 0x043587CF,
private: 0x04358394
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0x57,
};

</script>
<script>(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethUtil = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){
Expand Down Expand Up @@ -42839,6 +42859,20 @@ <h3 data-translate>Libraries</h3>
DOM.bip44coin.val(1);
},
},
{
name: "Slimcoin",
onSelect: function() {
network = bitcoin.networks.slimcoin;
DOM.bip44coin.val(63);
},
},
{
name: "Slimcoin Testnet",
onSelect: function() {
network = bitcoin.networks.slimcointn;
DOM.bip44coin.val(111);
},
},
{
name: "Viacoin",
onSelect: function() {
Expand Down
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ A tool for converting BIP39 mnemonic phrases to addresses and private keys.

## Online Version

https://iancoleman.github.io/bip39/
Upstream demo: https://iancoleman.github.io/bip39/

Slimcoin: TBD

## Standalone offline version

Expand Down
20 changes: 20 additions & 0 deletions src/js/bitcoinjs-extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,23 @@ bitcoin.networks.peercoin = {
wif: 0xb7,
};

bitcoin.networks.slimcoin = {
bip32: {
public: 0xef6adf10,
private: 0xef69ea80
},
pubKeyHash: 0x3f,
scriptHash: 0x7d,
wif: 0x46,
};

bitcoin.networks.slimcointn = {
bip32: {
public: 0x043587CF,
private: 0x04358394
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0x57,
};

14 changes: 14 additions & 0 deletions src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,20 @@
DOM.bip44coin.val(1);
},
},
{
name: "Slimcoin",
onSelect: function() {
network = bitcoin.networks.slimcoin;
DOM.bip44coin.val(63);
},
},
{
name: "Slimcoin Testnet",
onSelect: function() {
network = bitcoin.networks.slimcointn;
DOM.bip44coin.val(111);
},
},
{
name: "Viacoin",
onSelect: function() {
Expand Down
60 changes: 60 additions & 0 deletions tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,66 @@ page.open(url, function(status) {
});
},

// Network can be set to Slimcoin
function() {
page.open(url, function(status) {
// set the phrase and coin
var expected = "SNzPi1CafHFm3WWjRo43aMgiaEEj3ogjww";
page.evaluate(function() {
$(".phrase").val("abandon abandon ability");
$(".phrase").trigger("input");
$(".network option[selected]").removeAttr("selected");
$(".network option").filter(function() {
return $(this).html() == "Slimcoin";
}).prop("selected", true);
$(".network").trigger("change");
});
// check the address is generated correctly
waitForGenerate(function() {
var actual = page.evaluate(function() {
return $(".address:first").text();
});
if (actual != expected) {
console.log("Slimcoin address is incorrect");
console.log("Expected: " + expected);
console.log("Actual: " + actual);
fail();
}
next();
});
});
},

// Network can be set to Slimcointn
function() {
page.open(url, function(status) {
// set the phrase and coin
var expected = "n3nMgWufTek5QQAr6uwMhg5xbzj8xqc4Dq";
page.evaluate(function() {
$(".phrase").val("abandon abandon ability");
$(".phrase").trigger("input");
$(".network option[selected]").removeAttr("selected");
$(".network option").filter(function() {
return $(this).html() == "Slimcoin Testnet";
}).prop("selected", true);
$(".network").trigger("change");
});
// check the address is generated correctly
waitForGenerate(function() {
var actual = page.evaluate(function() {
return $(".address:first").text();
});
if (actual != expected) {
console.log("Slimcoin testnet address is incorrect");
console.log("Expected: " + expected);
console.log("Actual: " + actual);
fail();
}
next();
});
});
},

// BIP39 seed is set from phrase
function() {
page.open(url, function(status) {
Expand Down