Skip to content
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
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