From d1d8699fc4f1599de39e643acc1d8be52114dd58 Mon Sep 17 00:00:00 2001 From: Shawn Arney Date: Wed, 29 Apr 2020 16:48:00 -0600 Subject: Adding FIO -Foundation for Interwallet Operability FIO - Foundation for Interwallet Operability. https://fioprotocol.io --- src/js/fio-util.js | 19 +++++++++++++++++++ src/js/index.js | 13 +++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/js/fio-util.js (limited to 'src/js') diff --git a/src/js/fio-util.js b/src/js/fio-util.js new file mode 100644 index 0000000..35cb1ba --- /dev/null +++ b/src/js/fio-util.js @@ -0,0 +1,19 @@ +function FIObufferToPublic(pubBuf) { + const Buffer = libs.buffer.Buffer; + const FIO_PUBLIC_PREFIX = "FIO"; + + let checksum = libs.createHash("rmd160").update(pubBuf).digest("hex").slice(0, 8); + pubBuf = Buffer.concat([pubBuf, Buffer.from(checksum, "hex")]); + return FIO_PUBLIC_PREFIX.concat(libs.bs58.encode(pubBuf)); +} + +function FIObufferToPrivate(privBuf) { + const Buffer = libs.buffer.Buffer; + const FIO_PRIVATE_PREFIX = "80"; + + privBuf = Buffer.concat([Buffer.from(FIO_PRIVATE_PREFIX, "hex"), privBuf]); + let tmp = libs.createHash("sha256").update(privBuf).digest(); + let checksum = libs.createHash("sha256").update(tmp).digest("hex").slice(0, 8); + privBuf = Buffer.concat([privBuf, Buffer.from(checksum, "hex")]); + return libs.bs58.encode(privBuf); +} \ No newline at end of file diff --git a/src/js/index.js b/src/js/index.js index 32825b2..e8072e4 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -1241,6 +1241,12 @@ privkey = eosUtil.bufferToPrivate(keyPair.d.toBuffer(32)); } + if (networks[DOM.network.val()].name == "FIO - Foundation for Interwallet Operability") { + address = "" + pubkey = FIObufferToPublic(keyPair.getPublicKeyBuffer()); + privkey = FIObufferToPrivate(keyPair.d.toBuffer(32)); + } + //Groestlcoin Addresses are different if(isGRS()) { @@ -2498,6 +2504,13 @@ setHdCoin(40); }, }, + { + name: "FIO - Foundation for Interwallet Operability", + onSelect: function() { + network = libs.bitcoin.networks.bitcoin; + setHdCoin(235); + }, + }, { name: "FIX - FIX", onSelect: function() { -- cgit v1.2.3