blackchain-addressgen 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +149 -0
- package/bin/blackchain-addressgen-linux +0 -0
- package/bin/blackchain-addressgen-macos +0 -0
- package/bin/blackchain-addressgen-win.exe +0 -0
- package/bin/index.js +29 -0
- package/package.json +17 -0
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# BlackChain Address Generator
|
|
2
|
+
|
|
3
|
+
A simple CLI tool to generate mnemonics and derive deterministic wallet addresses using the BlackChain Crypto Library.
|
|
4
|
+
|
|
5
|
+
## NPM Usage
|
|
6
|
+
|
|
7
|
+
This tool is also available as an npm package.
|
|
8
|
+
|
|
9
|
+
### Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g blackchain-addressgen
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Usage
|
|
16
|
+
|
|
17
|
+
Run via `npx` or installed global command:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
blackchain-addressgen --show-mnemonic --count 10
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Build
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
cd examples/address-generator
|
|
29
|
+
go build -o blackchain-addressgen main.go
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Install as a Global CLI Tool (No `./` Required)
|
|
35
|
+
|
|
36
|
+
After installation, you’ll be able to run:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
blackchain-addressgen
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
from **any directory**.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### macOS / Linux
|
|
47
|
+
|
|
48
|
+
#### 1️⃣ Build the binary
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
go build -o blackchain-addressgen main.go
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### 2️⃣ Make it executable
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
chmod +x blackchain-addressgen
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
#### 3️⃣ Move it to a directory in your PATH
|
|
61
|
+
|
|
62
|
+
Recommended location:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
sudo mv blackchain-addressgen /usr/local/bin/
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
> `/usr/local/bin` is included in `PATH` by default on most systems.
|
|
69
|
+
|
|
70
|
+
#### 4️⃣ (macOS only) Remove Gatekeeper quarantine
|
|
71
|
+
|
|
72
|
+
If macOS blocks the binary:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
sudo xattr -d com.apple.quarantine /usr/local/bin/blackchain-addressgen
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
#### 5️⃣ Verify installation
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
which blackchain-addressgen
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Expected output:
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
/usr/local/bin/blackchain-addressgen
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
You can now run:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
blackchain-addressgen
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
from anywhere 🚀
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Usage
|
|
101
|
+
|
|
102
|
+
### Generate a new mnemonic and addresses
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
blackchain-addressgen
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Show the generated mnemonic
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
blackchain-addressgen --show-mnemonic
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Use an existing mnemonic
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
blackchain-addressgen \
|
|
118
|
+
--mnemonic "your twelve word mnemonic phrase goes here ..." \
|
|
119
|
+
--show-mnemonic
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Custom Derivation Path
|
|
123
|
+
|
|
124
|
+
To avoid shell quoting issues, always wrap the path in double quotes:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
blackchain-addressgen --path "m/44'/60'/0'/1'"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Options
|
|
133
|
+
|
|
134
|
+
* `--words` — Mnemonic length (12 or 24). Default: `12`
|
|
135
|
+
* `--count` — Number of addresses to derive. Default: `5`
|
|
136
|
+
* `--path` — Base derivation path. Default: `m/44'/60'/0'/0'`
|
|
137
|
+
* `--mnemonic` — Use an existing mnemonic string
|
|
138
|
+
* `--show-mnemonic` — Display the mnemonic in the output
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Uninstall
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
sudo rm /usr/local/bin/blackchain-addressgen
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
const supportedPlatforms = {
|
|
8
|
+
'darwin': 'blackchain-addressgen-macos',
|
|
9
|
+
'linux': 'blackchain-addressgen-linux',
|
|
10
|
+
'win32': 'blackchain-addressgen-win.exe'
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const platform = os.platform();
|
|
14
|
+
const binaryName = supportedPlatforms[platform];
|
|
15
|
+
|
|
16
|
+
if (!binaryName) {
|
|
17
|
+
console.error(`Unsupported platform: ${platform}`);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const binaryPath = path.join(__dirname, binaryName);
|
|
22
|
+
|
|
23
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
24
|
+
stdio: 'inherit'
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
child.on('exit', (code) => {
|
|
28
|
+
process.exit(code);
|
|
29
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "blackchain-addressgen",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "BlackChain Address Generator CLI",
|
|
5
|
+
"bin": {
|
|
6
|
+
"blackchain-addressgen": "./bin/index.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "mkdir -p bin && GOOS=darwin GOARCH=arm64 go build -o bin/blackchain-addressgen-macos main.go && GOOS=linux GOARCH=amd64 go build -o bin/blackchain-addressgen-linux main.go && GOOS=windows GOARCH=amd64 go build -o bin/blackchain-addressgen-win.exe main.go",
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"author": "",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"files": [
|
|
15
|
+
"bin"
|
|
16
|
+
]
|
|
17
|
+
}
|