Skip to content

Commit

Permalink
Merge pull request #9 from Adamant-im/dev
Browse files Browse the repository at this point in the history
v1.3.0
  • Loading branch information
adamant-al authored Oct 23, 2021
2 parents 45bab0d + 564cc83 commit 8a1cbcc
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
27 changes: 27 additions & 0 deletions groups/doge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
var bitcoin = require('bitcoinjs-lib');
var coinNetworks = require('./coinNetworks');
const doge = { }

/**
* Generates a DOGE account from the passphrase specified.
* @param {string} passphrase ADAMANT account passphrase
* @returns {object} network info, keyPair, privateKey, privateKeyWIF
*/

doge.keys = passphrase => {
const network = coinNetworks.DOGE;
const pwHash = bitcoin.crypto.sha256(Buffer.from(passphrase));
const keyPair = bitcoin.ECPair.fromPrivateKey(pwHash, { network });

return {
network,
keyPair,
address: bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey, network }).address,
// DOGE private key is a regular 256-bit key
privateKey: keyPair.privateKey.toString('hex'), // regular 256-bit (32 bytes, 64 characters) private key
privateKeyWIF: keyPair.toWIF() // Wallet Import Format (52 base58 characters)
}

};

module.exports = doge;
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const healthCheck = require('./helpers/healthCheck');
const eth = require('./groups/eth');
const dash = require('./groups/dash');
const btc = require('./groups/btc');
const doge = require('./groups/doge');
const transactionFormer = require('./helpers/transactionFormer');
const keys = require('./helpers/keys');
const encryptor = require('./helpers/encryptor');
Expand All @@ -28,6 +29,7 @@ module.exports = (params, log) => {
eth,
dash,
btc,
doge,
transactionFormer,
keys,
encryptor,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adamant-api",
"version": "1.2.0",
"version": "1.3.0",
"description": "REST API for ADAMANT Blockchain",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 8a1cbcc

Please sign in to comment.