-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Adamant-im/dev
v1.3.0
- Loading branch information
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters