-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use bitcoinjs-lib for bitcoin address generation
See: oleganza/btcruby#32
- Loading branch information
1 parent
420e593
commit 2913a46
Showing
10 changed files
with
442 additions
and
24 deletions.
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 |
---|---|---|
|
@@ -430,4 +430,4 @@ DEPENDENCIES | |
webmock | ||
|
||
BUNDLED WITH | ||
1.16.1 | ||
1.16.2 |
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
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,10 @@ | ||
let bitcoin = require('bitcoinjs-lib') | ||
|
||
let pubKeys = process.argv[2].split(",").sort().map(function (hex) { return Buffer.from(hex, 'hex') }) | ||
let signaturesRequired = parseInt(process.argv[3]) | ||
|
||
var redeemScript = bitcoin.script.multisig.output.encode(signaturesRequired, pubKeys) | ||
var scriptPubKey = bitcoin.script.scriptHash.output.encode(bitcoin.crypto.hash160(redeemScript)) | ||
var address = bitcoin.address.fromOutputScript(scriptPubKey) | ||
|
||
console.log(address) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"name": "crypto_cold_store", | ||
"private": true, | ||
"dependencies": {} | ||
"dependencies": { | ||
"bitcoinjs-lib": "^3.3.2" | ||
} | ||
} |
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,8 @@ | ||
require "btcruby" | ||
|
||
def receiving_mpk_for(parent_mpk) | ||
keychain = BTC::Keychain.new(extended_key: parent_mpk) | ||
keychain.derived_keychain("0").xpub | ||
end | ||
|
||
puts receiving_mpk_for(ARGV[0]) |
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
Oops, something went wrong.