-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30ea763
commit f96542b
Showing
9 changed files
with
510 additions
and
419 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
PRIVATE_KEY1_BIP32= | ||
PRIVATE_KEY2= | ||
DESTINATION_ADDR= | ||
N= | ||
NETWORK= | ||
DERIVATION_PATH= | ||
DERIVATION_PATH= | ||
N= |
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,3 +1,5 @@ | ||
# Address | ||
addresses.json | ||
# Logs | ||
logs | ||
*.log | ||
|
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,17 +1,29 @@ | ||
* **THIS IS BETA SOFTWARE. BE CAREFUL!** | ||
* Reference sweep script for Basic (2-of-2) MultiSig wallets. NodeJS. | ||
* Uses [SoChain's Free API](https://sochain.com/api) by default for blockchain data and for broadcasting transactions. You can implement your own backends yourself. | ||
* NEVER SHARE YOUR PRIVATE KEYS. NEVER USE PRIVATE KEYS ON INSECURE SYSTEMS. | ||
- Reference sweep script for Basic (2-of-2) MultiSig wallets. NodeJS. | ||
- This repository was originally cloned from [BlockIo Sweep](https://github.com/BlockIo/blockio-basic-multisig-sweep) Using [SoChain API](https://sochain.com/api) by default. It became imperative to move on from their Sochain API after more customers started complaining about account getting frozen for no clear reason on BlockIo and the Sochain Became a paid service. | ||
|
||
- This project now leverages [Blockchain.com Free Service](https://blockchain.com) and [Blockcypher](https://blockcypher.com/) for data and for broadcasting transactions. You can certainly implement your own backends yourself. | ||
|
||
- Ensure you've backed up your Keys from BlockIo | ||
|
||
- NEVER SHARE YOUR PRIVATE KEYS. NEVER USE PRIVATE KEYS ON INSECURE SYSTEMS. | ||
|
||
#### HOW TO RUN | ||
|
||
Command-line Usage: | ||
``` | ||
$ git clone <repository URL> | ||
$ cd <dir> && npm install | ||
$ N= PRIVATE_KEY1_BIP32= PRIVATE_KEY2= DESTINATION_ADDR= NETWORK= DERIVATION_PATH= node example.js | ||
``` | ||
|
||
Create your `.env` file in the root directory using the `.env.example` format. | ||
|
||
- N is the number of addresses you've generated on the given network | ||
- PRIVATE_KEY1_BIP32 is the BIP32 extended private key you backed up | ||
- PRIVATE_KEY2 is the second private key you backed up | ||
- DESTINATION_ADDR is where you want the swept coins to go | ||
- NETWORK is the network for which you're sweeping coins | ||
- DERIVATION_PATH is the derivation path shown when you back up your private keys | ||
|
||
``` | ||
$ node index.js | ||
``` | ||
* N is the number of addresses you've generated on the given network | ||
* PRIVATE_KEY1_BIP32 is the BIP32 extended private key you backed up | ||
* PRIVATE_KEY2 is the second private key you backed up | ||
* DESTINATION_ADDR is where you want the swept coins to go | ||
* NETWORK is the network for which you're sweeping coins | ||
* DERIVATION_PATH is the derivation path shown when you back up your private keys |
This file was deleted.
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const Sweeper = require("./src/sweeper"); | ||
|
||
require("dotenv").config({ debug: true }); | ||
const n = process.env.N; | ||
const bip32 = process.env.PRIVATE_KEY1_BIP32; | ||
const privkey2 = process.env.PRIVATE_KEY2; | ||
const toAddr = process.env.DESTINATION_ADDR; | ||
const network = process.env.NETWORK; | ||
const derivationPath = process.env.DERIVATION_PATH; | ||
|
||
console.log({ n }); | ||
|
||
if (!n || !bip32 || !privkey2 || !toAddr || !network || !derivationPath) { | ||
console.log("One or more required arguments are missing"); | ||
process.exit(0); | ||
} | ||
|
||
const sweep = new Sweeper(network, bip32, privkey2, toAddr, n, derivationPath); | ||
|
||
Sweep(); | ||
|
||
async function Sweep() { | ||
try { | ||
await sweep.begin(); | ||
} catch (err) { | ||
console.log(err); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,64 +1,69 @@ | ||
module.exports = { | ||
P2WSH_P2SH: 'P2WSH-P2SH', | ||
P2SH: 'P2SH', | ||
P2WSH: 'WITNESS_V0', | ||
COIN: '100000000', | ||
P2WSH_P2SH: "P2WSH-P2SH", | ||
P2SH: "P2SH", | ||
P2WSH: "WITNESS_V0", | ||
COIN: "100000000", | ||
N: 100, | ||
MAX_TX_INPUTS: 500, | ||
BLOCKCHAIN_PROVIDER_DEFAULT: 'sochain', | ||
BLOCKCHAIN_PROVIDER_URL_DEFAULT: 'https://sochain.com/api/v2/', | ||
BLOCKCHAIN_PROVIDER_DEFAULT: "blockchaincom", | ||
BLOCKCHAIN_PROVIDER_URL_DEFAULT: "https://blockchain.info", | ||
// the order of provider names matters in PROVIDERS and PROVIDER_URLS | ||
// the order needs to be the same | ||
PROVIDERS: { | ||
SOCHAIN: 'sochain', | ||
MEMPOOLSPACE: 'mempoolspace', | ||
BLOCKCHAINCOM: 'blockchaincom' | ||
MEMPOOLSPACE: "mempoolspace", | ||
BLOCKCHAINCOM: "blockchaincom", | ||
BLOCKCYPHER: "blockcypher", | ||
SOCHAIN: "sochain", | ||
}, | ||
PROVIDER_URLS: { | ||
SOCHAIN: { | ||
URL: 'https://sochain.com/api/v2', | ||
SUPPORT: ['BTC', 'LTC', 'DOGE', 'BTCTEST', 'DOGETEST', 'LTCTEST'] | ||
}, | ||
MEMPOOLSPACE: { | ||
URL: 'https://mempool.space', | ||
SUPPORT: ['BTC', 'BTCTEST'] | ||
URL: "https://mempool.space", | ||
SUPPORT: ["BTC", "BTCTEST"], | ||
}, | ||
BLOCKCHAINCOM: { | ||
URL: 'https://blockchain.info', | ||
SUPPORT: ['BTC'] | ||
} | ||
URL: "https://blockchain.info", | ||
SUPPORT: ["BTC"], | ||
}, | ||
BLOCKCYPHER: { | ||
URL: "https://api.blockcypher.com/v1/btc/main", | ||
SUPPORT: ["BTC"], | ||
}, | ||
SOCHAIN: { | ||
URL: "https://sochain.com/api/v2", | ||
SUPPORT: ["BTC", "LTC", "DOGE", "BTCTEST", "DOGETEST", "LTCTEST"], | ||
}, | ||
}, | ||
NETWORKS: { | ||
BTC: 'BTC', | ||
BTCTEST: 'BTCTEST', | ||
LTC: 'LTC', | ||
LTCTEST: 'LTCTEST', | ||
DOGE: 'DOGE', | ||
DOGETEST: 'DOGETEST' | ||
BTC: "BTC", | ||
BTCTEST: "BTCTEST", | ||
LTC: "LTC", | ||
LTCTEST: "LTCTEST", | ||
DOGE: "DOGE", | ||
DOGETEST: "DOGETEST", | ||
}, | ||
FEE_RATE: { | ||
BTC: 20, | ||
LTC: 20, | ||
DOGE: 2000, | ||
BTCTEST: 20, | ||
LTCTEST: 20, | ||
DOGETEST: 2000 | ||
DOGETEST: 2000, | ||
}, | ||
DUST: { | ||
BTC: 546, | ||
LTC: 1000, | ||
DOGE: 1000000, // https://github.com/dogecoin/dogecoin/blob/v1.14.5/doc/fee-recommendation.md | ||
BTCTEST: 546, | ||
LTCTEST: 1000, | ||
DOGETEST: 1000000 // https://github.com/dogecoin/dogecoin/blob/v1.14.5/doc/fee-recommendation.md | ||
DOGETEST: 1000000, // https://github.com/dogecoin/dogecoin/blob/v1.14.5/doc/fee-recommendation.md | ||
}, | ||
NETWORK_FEE_MAX: { | ||
BTC: (250 * 100000), // 0.25 BTC | ||
BTCTEST: (250 * 100000), // 0.25 BTCTEST | ||
LTC: (50 * 100000), // 0.05 LTC | ||
LTCTEST: (50 * 100000), // 0.05 LTCTEST | ||
DOGE: (2 * 100000000), // 2.00 DOGE | ||
DOGETEST: (2 * 100000000) // 2.00 DOGETEST | ||
BTC: 250 * 100000, // 0.25 BTC | ||
BTCTEST: 250 * 100000, // 0.25 BTCTEST | ||
LTC: 50 * 100000, // 0.05 LTC | ||
LTCTEST: 50 * 100000, // 0.05 LTCTEST | ||
DOGE: 2 * 100000000, // 2.00 DOGE | ||
DOGETEST: 2 * 100000000, // 2.00 DOGETEST | ||
}, | ||
TX_BROADCAST_APPROVAL_TEXT: 'I have verified this transaction, and I want to broadcast it now' | ||
} | ||
TX_BROADCAST_APPROVAL_TEXT: "I have verified this transaction, and I want to broadcast it now", | ||
}; |
Oops, something went wrong.