stealth


This module is used for stealth addresses for Bitcoin and other crypto currencies.
Usage
First, you should really read this excellent resource: https://gist.github.com/ryanxcharles/1c0f95d0892b4a92d70a
This module depends upon ecurve and may change to
elliptic in the future. However, this is just an implementation detail
that shouldn't affect your code.
Example
If you're the payer (sender)
var Stealth = require('stealth')
var addr = 'vJmtuUb8ysKiM1HtHQF23FGfjGAKu5sM94UyyjknqhJHNdj5CZzwtpGzeyaATQ2HvuzomNVtiwsTJSWzzCBgCTtUZbRFpzKVq9MAUr'
var stealth = Stealth.fromString(addr)
var keypair = require('coinkey').createRandom()
var payToAddress = stealth.genPaymentAddress(keypair.privateKey)
If you're the payee (recipient)
var Stealth = require('stealth')
var payloadKeyPair = require('coinkey').createRandom()
var scanKeyPair = require('coinkey').createRandom()
var stealth = new Stealth({
payloadPrivKey: payloadKeyPair.privateKey,
payloadPubKey: payloadKeyPair.publicKey,
scanPrivKey: scanKeyPair.privateKey,
scanPubKey: scanKeyPair.publicKey
})
var addr = stealth.toString()
var opReturnPubKey =
var pubKeyHashWithPayment =
var keypair = stealth.checkPaymentPubKeyHash(opReturnPubKey, pubKeyHashWithPayment)
if (keypair == null) {
console.log('payment is not mine')
} else {
console.log('payment is mine')
console.log(keypair.privKey)
}
API
(TODO)
+ fromRandom([config])
Class method to create a stealth key from a random entropy. Optionally pass in config with the following:
rng: A function that should accept a number n and return a Buffer/Array with length n.
version: Version code for stealth string.
Resources
Credits
The creation of this module owes a lot of credit to the prior work of Ryan X. Charles, specifically the following
resources:
Additional Resources
License
MIT