@beclab/olaresid 0.1.12 → 0.2.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/CLI-TREE.md +107 -0
- package/CLI.md +122 -1329
- package/README.md +30 -12
- package/SDK-TREE.md +151 -0
- package/TAG.md +95 -41
- package/config.json +6 -4
- package/dist/abi/TerminusDIDQueryABI.d.ts +397 -0
- package/dist/abi/TerminusDIDQueryABI.d.ts.map +1 -0
- package/dist/abi/TerminusDIDQueryABI.js +519 -0
- package/dist/abi/TerminusDIDQueryABI.js.map +1 -0
- package/dist/business/index.d.ts +1 -1
- package/dist/business/index.d.ts.map +1 -1
- package/dist/business/index.js +11 -24
- package/dist/business/index.js.map +1 -1
- package/dist/business/tag-context.d.ts +1 -0
- package/dist/business/tag-context.d.ts.map +1 -1
- package/dist/business/tag-context.js +13 -7
- package/dist/business/tag-context.js.map +1 -1
- package/dist/cli.js +238 -107
- package/dist/cli.js.map +1 -1
- package/dist/config/index.d.ts +16 -4
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +28 -14
- package/dist/config/index.js.map +1 -1
- package/dist/domain/core.d.ts +65 -0
- package/dist/domain/core.d.ts.map +1 -0
- package/dist/domain/core.js +317 -0
- package/dist/domain/core.js.map +1 -0
- package/dist/domain/index.d.ts +104 -57
- package/dist/domain/index.d.ts.map +1 -1
- package/dist/domain/index.js +188 -428
- package/dist/domain/index.js.map +1 -1
- package/dist/domain/types.d.ts +56 -0
- package/dist/domain/types.d.ts.map +1 -0
- package/dist/domain/types.js +3 -0
- package/dist/domain/types.js.map +1 -0
- package/dist/index.d.ts +81 -24
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +153 -143
- package/dist/index.js.map +1 -1
- package/dist/utils/crypto-utils.d.ts +124 -0
- package/dist/utils/crypto-utils.d.ts.map +1 -1
- package/dist/utils/crypto-utils.js +156 -8
- package/dist/utils/crypto-utils.js.map +1 -1
- package/dist/utils/error-parser.d.ts.map +1 -1
- package/dist/utils/error-parser.js +2 -1
- package/dist/utils/error-parser.js.map +1 -1
- package/dist/utils/event-parser.d.ts +161 -0
- package/dist/utils/event-parser.d.ts.map +1 -0
- package/dist/utils/event-parser.js +140 -0
- package/dist/utils/event-parser.js.map +1 -0
- package/dist/utils/tag-type-builder.d.ts +43 -0
- package/dist/utils/tag-type-builder.d.ts.map +1 -1
- package/dist/utils/tag-type-builder.js +122 -0
- package/dist/utils/tag-type-builder.js.map +1 -1
- package/dist/utils/tag-type-parser.d.ts +70 -0
- package/dist/utils/tag-type-parser.d.ts.map +1 -0
- package/dist/utils/tag-type-parser.js +190 -0
- package/dist/utils/tag-type-parser.js.map +1 -0
- package/examples/create-with-rpc-demo.ts +142 -0
- package/examples/fetch-all-flat-demo.ts +159 -0
- package/examples/fetch-by-indices-demo.ts +235 -0
- package/examples/fetch-domain-demo.ts +137 -0
- package/examples/fetch-domains-demo.ts +221 -0
- package/examples/frontend-demo/index.html +2 -2
- package/examples/frontend-demo/package-lock.json +4 -1
- package/examples/index.ts +3 -5
- package/jest.config.js +25 -0
- package/package.json +6 -2
- package/src/abi/TerminusDIDQueryABI.ts +516 -0
- package/src/business/index.ts +10 -33
- package/src/business/tag-context.ts +35 -7
- package/src/cli.ts +344 -121
- package/src/config/index.ts +34 -19
- package/src/domain/core.ts +382 -0
- package/src/domain/index.ts +271 -641
- package/src/domain/types.ts +59 -0
- package/src/index.ts +222 -207
- package/src/utils/crypto-utils.ts +239 -2
- package/src/utils/error-parser.ts +2 -1
- package/src/utils/event-parser.ts +353 -0
- package/src/utils/tag-type-builder.ts +138 -0
- package/src/utils/tag-type-parser.ts +246 -0
- package/tests/unit/crypto-utils.test.ts +338 -0
- package/tests/unit/ed25519-jwk.test.ts +201 -0
- package/tests/unit/event-parser.test.ts +690 -0
- package/tests/unit/generate-mnemonic.test.ts +268 -0
- package/tests/unit/olares-id-format.test.ts +321 -0
- package/tests/unit/tag-type-parser.test.ts +802 -0
- package/tests/unit/tag-types.test.ts +821 -0
- package/tsconfig.json +3 -2
- package/dist/abi/ABITypeABI.d.ts +0 -88
- package/dist/abi/ABITypeABI.d.ts.map +0 -1
- package/dist/abi/ABITypeABI.js +0 -382
- package/dist/abi/ABITypeABI.js.map +0 -1
- package/dist/abi/RegistryABI.d.ts +0 -77
- package/dist/abi/RegistryABI.d.ts.map +0 -1
- package/dist/abi/RegistryABI.js +0 -462
- package/dist/abi/RegistryABI.js.map +0 -1
- package/dist/tag/address.d.ts +0 -11
- package/dist/tag/address.d.ts.map +0 -1
- package/dist/tag/address.js +0 -44
- package/dist/tag/address.js.map +0 -1
- package/dist/tag/array.d.ts +0 -14
- package/dist/tag/array.d.ts.map +0 -1
- package/dist/tag/array.js +0 -72
- package/dist/tag/array.js.map +0 -1
- package/dist/tag/bool.d.ts +0 -11
- package/dist/tag/bool.d.ts.map +0 -1
- package/dist/tag/bool.js +0 -43
- package/dist/tag/bool.js.map +0 -1
- package/dist/tag/bytes.d.ts +0 -11
- package/dist/tag/bytes.d.ts.map +0 -1
- package/dist/tag/bytes.js +0 -37
- package/dist/tag/bytes.js.map +0 -1
- package/dist/tag/flarray.d.ts +0 -15
- package/dist/tag/flarray.d.ts.map +0 -1
- package/dist/tag/flarray.js +0 -81
- package/dist/tag/flarray.js.map +0 -1
- package/dist/tag/flbytes.d.ts +0 -11
- package/dist/tag/flbytes.d.ts.map +0 -1
- package/dist/tag/flbytes.js +0 -47
- package/dist/tag/flbytes.js.map +0 -1
- package/dist/tag/index.d.ts +0 -32
- package/dist/tag/index.d.ts.map +0 -1
- package/dist/tag/index.js +0 -121
- package/dist/tag/index.js.map +0 -1
- package/dist/tag/int.d.ts +0 -12
- package/dist/tag/int.d.ts.map +0 -1
- package/dist/tag/int.js +0 -49
- package/dist/tag/int.js.map +0 -1
- package/dist/tag/string.d.ts +0 -11
- package/dist/tag/string.d.ts.map +0 -1
- package/dist/tag/string.js +0 -37
- package/dist/tag/string.js.map +0 -1
- package/dist/tag/tag.d.ts +0 -67
- package/dist/tag/tag.d.ts.map +0 -1
- package/dist/tag/tag.js +0 -157
- package/dist/tag/tag.js.map +0 -1
- package/dist/tag/tuple.d.ts +0 -17
- package/dist/tag/tuple.d.ts.map +0 -1
- package/dist/tag/tuple.js +0 -162
- package/dist/tag/tuple.js.map +0 -1
- package/dist/tag/uint.d.ts +0 -12
- package/dist/tag/uint.d.ts.map +0 -1
- package/dist/tag/uint.js +0 -49
- package/dist/tag/uint.js.map +0 -1
- package/dist/test/did.d.ts +0 -2
- package/dist/test/did.d.ts.map +0 -1
- package/dist/test/did.js +0 -177
- package/dist/test/did.js.map +0 -1
- package/dist/utils/tag-abi-codec.d.ts +0 -69
- package/dist/utils/tag-abi-codec.d.ts.map +0 -1
- package/dist/utils/tag-abi-codec.js +0 -144
- package/dist/utils/tag-abi-codec.js.map +0 -1
- package/examples/crypto-utilities.ts +0 -140
- package/examples/ed25519-jwk.ts +0 -73
- package/examples/generate-mnemonic.ts +0 -149
- package/examples/legacy.ts +0 -33
- package/examples/olares-id-format.ts +0 -197
- package/examples/tag-builder.ts +0 -235
- package/examples/tag-nested-tuple.ts +0 -190
- package/examples/tag-simple.ts +0 -149
- package/examples/tag-tagger.ts +0 -217
- package/examples/test-nested-tuple-conversion.ts +0 -143
- package/examples/test-type-bytes-parser.ts +0 -70
- package/src/abi/ABITypeABI.ts +0 -379
- package/src/abi/RegistryABI.ts +0 -459
- package/src/tag/address.ts +0 -48
- package/src/tag/array.ts +0 -80
- package/src/tag/bool.ts +0 -43
- package/src/tag/bytes.ts +0 -38
- package/src/tag/flarray.ts +0 -99
- package/src/tag/flbytes.ts +0 -48
- package/src/tag/index.ts +0 -170
- package/src/tag/int.ts +0 -51
- package/src/tag/string.ts +0 -38
- package/src/tag/tag.ts +0 -229
- package/src/tag/tuple.ts +0 -193
- package/src/tag/uint.ts +0 -51
- package/src/test/did.ts +0 -346
- package/src/utils/tag-abi-codec.ts +0 -158
package/CLI.md
CHANGED
|
@@ -1,1461 +1,254 @@
|
|
|
1
|
-
# OlaresID CLI
|
|
1
|
+
# OlaresID CLI by Scenarios
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This guide is organized by real usage goals instead of listing every command one by one.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install -g olaresid
|
|
9
|
-
# or use npx
|
|
10
|
-
npx olaresid <command>
|
|
8
|
+
npm install -g @beclab/olaresid
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
##
|
|
11
|
+
## Before You Start
|
|
14
12
|
|
|
15
13
|
```bash
|
|
16
|
-
#
|
|
17
|
-
did-cli help
|
|
14
|
+
# Basic help
|
|
15
|
+
did-cli --help
|
|
18
16
|
|
|
19
|
-
#
|
|
20
|
-
did-cli
|
|
21
|
-
|
|
22
|
-
# Get domain owner
|
|
23
|
-
did-cli owner example.olares.com
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Commands Overview
|
|
27
|
-
|
|
28
|
-
### Query Commands
|
|
29
|
-
|
|
30
|
-
#### Get Domain Metadata
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
did-cli info <domain> [options]
|
|
34
|
-
|
|
35
|
-
# Examples
|
|
36
|
-
did-cli info example.olares.com
|
|
37
|
-
did-cli info example.olares.com --json
|
|
38
|
-
did-cli info example.olares.com --network sepolia
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
#### Get Domain Owner
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
did-cli owner <domain> [options]
|
|
45
|
-
|
|
46
|
-
# Examples
|
|
47
|
-
did-cli owner example.olares.com
|
|
48
|
-
did-cli owner example.olares.com --json
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
#### Check Domain Ownership
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
did-cli is-owner <domain>
|
|
55
|
-
|
|
56
|
-
# Examples
|
|
57
|
-
export PRIVATE_KEY_OR_MNEMONIC=0x1234...
|
|
58
|
-
did-cli is-owner example.olares.com
|
|
59
|
-
did-cli is-owner example.olares.com --json
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### RSA Key Management
|
|
63
|
-
|
|
64
|
-
#### Generate RSA Key Pair
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
did-cli rsa generate [options]
|
|
68
|
-
|
|
69
|
-
# Examples
|
|
70
|
-
did-cli rsa generate
|
|
71
|
-
did-cli rsa generate --output ./my-key.pem
|
|
72
|
-
did-cli rsa generate --key-length 4096 --output ./my-key.pem
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
**Output:**
|
|
76
|
-
|
|
77
|
-
- Public key: `<output-path>.pem` (PEM PKCS#8 format)
|
|
78
|
-
- Private key: `<output-path>-private.pem` (PEM PKCS#8 format)
|
|
79
|
-
|
|
80
|
-
#### Get RSA Public Key
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
did-cli rsa get <domain> [options]
|
|
84
|
-
|
|
85
|
-
# Examples
|
|
86
|
-
did-cli rsa get example.olares.com
|
|
87
|
-
did-cli rsa get example.olares.com --json
|
|
88
|
-
did-cli rsa get example.olares.com --output ./public-key.pem
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
#### Set RSA Public Key
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
did-cli rsa set <domain> <pem-file>
|
|
95
|
-
|
|
96
|
-
# Examples
|
|
97
|
-
export PRIVATE_KEY_OR_MNEMONIC=0x1234...
|
|
98
|
-
did-cli rsa set example.olares.com ./public-key.pem
|
|
99
|
-
did-cli rsa set example.olares.com ./public-key.pem --json
|
|
17
|
+
# Optional: use sepolia for testing
|
|
18
|
+
did-cli fetch olares.com --network sepolia
|
|
100
19
|
```
|
|
101
20
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
did-cli rsa remove <domain>
|
|
106
|
-
|
|
107
|
-
# Examples
|
|
108
|
-
export PRIVATE_KEY_OR_MNEMONIC=0x1234...
|
|
109
|
-
did-cli rsa remove example.olares.com
|
|
110
|
-
did-cli rsa remove example.olares.com --json
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### IP Management
|
|
114
|
-
|
|
115
|
-
#### Get IP Address (DNS A Record)
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
did-cli ip get <domain> [options]
|
|
119
|
-
|
|
120
|
-
# Examples
|
|
121
|
-
did-cli ip get example.olares.com
|
|
122
|
-
did-cli ip get example.olares.com --json
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
#### Set IP Address
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
did-cli ip set <domain> <ipv4-address>
|
|
129
|
-
|
|
130
|
-
# Examples
|
|
131
|
-
export PRIVATE_KEY_OR_MNEMONIC=0x1234...
|
|
132
|
-
did-cli ip set example.olares.com 192.168.1.100
|
|
133
|
-
did-cli ip set example.olares.com 192.168.1.100 --json
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
#### Remove IP Address
|
|
137
|
-
|
|
138
|
-
```bash
|
|
139
|
-
did-cli ip remove <domain>
|
|
140
|
-
|
|
141
|
-
# Examples
|
|
142
|
-
export PRIVATE_KEY_OR_MNEMONIC=0x1234...
|
|
143
|
-
did-cli ip remove example.olares.com
|
|
144
|
-
did-cli ip remove example.olares.com --json
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### Subdomain Management
|
|
148
|
-
|
|
149
|
-
#### Register Subdomain
|
|
21
|
+
Notes:
|
|
150
22
|
|
|
151
|
-
|
|
23
|
+
- The default network is `mainnet`.
|
|
24
|
+
- Use `--json` when you want machine-readable output.
|
|
25
|
+
- For write operations, you usually need `PRIVATE_KEY_OR_MNEMONIC`.
|
|
152
26
|
|
|
153
|
-
|
|
154
|
-
did-cli subdomain register <parent-domain> <subdomain-label> [options]
|
|
155
|
-
|
|
156
|
-
# Examples
|
|
157
|
-
|
|
158
|
-
# Generate a new 12-word mnemonic automatically
|
|
159
|
-
export PRIVATE_KEY_OR_MNEMONIC=0x1234... # Parent domain owner's private key
|
|
160
|
-
did-cli subdomain register parent.com child
|
|
161
|
-
|
|
162
|
-
# Generate a 24-word mnemonic
|
|
163
|
-
did-cli subdomain register parent.com child --words 24
|
|
164
|
-
|
|
165
|
-
# Use an existing mnemonic for subdomain owner
|
|
166
|
-
export SUBDOMAIN_OWNER_MNEMONIC="your twelve word mnemonic phrase here that will derive the keys"
|
|
167
|
-
did-cli subdomain register parent.com child
|
|
168
|
-
|
|
169
|
-
# JSON output
|
|
170
|
-
did-cli subdomain register parent.com child --json
|
|
171
|
-
|
|
172
|
-
# Use sepolia testnet
|
|
173
|
-
did-cli subdomain register parent.com child --network sepolia
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
**Important Notes:**
|
|
177
|
-
|
|
178
|
-
1. **Authentication**: You need the parent domain owner's private key or mnemonic via `PRIVATE_KEY_OR_MNEMONIC` environment variable
|
|
179
|
-
2. **Subdomain Owner Mnemonic**:
|
|
180
|
-
- Set via `SUBDOMAIN_OWNER_MNEMONIC` environment variable to use an existing mnemonic
|
|
181
|
-
- If `SUBDOMAIN_OWNER_MNEMONIC` is not set, a new one will be auto-generated and saved to `./subdomain-mnemonic.txt`
|
|
182
|
-
- The mnemonic derives the subdomain's owner address and DID
|
|
183
|
-
- **Save the mnemonic securely** - it's the only way to control the subdomain
|
|
184
|
-
3. **Full Domain**: If you register `child` under `parent.com`, the full domain will be `child.parent.com`
|
|
185
|
-
4. **Inheritance**: The subdomain inherits `note` and `allowSubdomain` settings from the parent
|
|
186
|
-
|
|
187
|
-
**Output Example:**
|
|
188
|
-
|
|
189
|
-
```
|
|
190
|
-
🔑 Generated 12-word mnemonic:
|
|
191
|
-
abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about
|
|
192
|
-
|
|
193
|
-
⚠️ IMPORTANT: Save this mnemonic securely! It controls the subdomain.
|
|
194
|
-
|
|
195
|
-
📋 Registering subdomain: child.parent.com
|
|
196
|
-
⏳ Submitting transaction...
|
|
197
|
-
|
|
198
|
-
✅ Subdomain registered successfully!
|
|
199
|
-
|
|
200
|
-
════════════════════════════════════════════════════════════
|
|
201
|
-
Registration Details:
|
|
202
|
-
════════════════════════════════════════════════════════════
|
|
203
|
-
Subdomain label: child
|
|
204
|
-
Full domain name: child.parent.com
|
|
205
|
-
Owner address: 0x9858EfFD232B4033E47d90003D41EC34EcaEda94
|
|
206
|
-
DID: did:key:z6MkvARmXmTXnwyJz9uXbzJjEVKVb9PegegGZMqiuQQCHzo2
|
|
207
|
-
Transaction hash: 0xabcd1234...
|
|
208
|
-
Gas used: 150000
|
|
209
|
-
Block number: 12345678
|
|
210
|
-
════════════════════════════════════════════════════════════
|
|
211
|
-
|
|
212
|
-
🔗 View on block explorer:
|
|
213
|
-
https://sepolia-optimism.etherscan.io/tx/0xabcd1234...
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### Domain Transfer
|
|
217
|
-
|
|
218
|
-
Transfer domain ownership to a new owner. This operation involves two transactions:
|
|
219
|
-
|
|
220
|
-
1. Transfer the NFT (domain) ownership
|
|
221
|
-
2. Update the domain's DID to match the new owner's DID
|
|
222
|
-
|
|
223
|
-
#### Transfer Domain Ownership
|
|
224
|
-
|
|
225
|
-
```bash
|
|
226
|
-
did-cli transfer <domain> [options]
|
|
227
|
-
|
|
228
|
-
# Examples
|
|
229
|
-
|
|
230
|
-
# Auto-generate new owner credentials (12-word mnemonic)
|
|
231
|
-
export PRIVATE_KEY_OR_MNEMONIC=0x1234... # Current owner's private key
|
|
232
|
-
did-cli transfer example.com
|
|
233
|
-
|
|
234
|
-
# Auto-generate with 24-word mnemonic
|
|
235
|
-
did-cli transfer example.com --words 24
|
|
236
|
-
|
|
237
|
-
# Use specific mnemonic for new owner
|
|
238
|
-
export TO_MNEMONIC="new owner twelve word mnemonic phrase here"
|
|
239
|
-
did-cli transfer example.com
|
|
240
|
-
|
|
241
|
-
# JSON output
|
|
242
|
-
did-cli transfer example.com --json
|
|
243
|
-
|
|
244
|
-
# Use sepolia testnet
|
|
245
|
-
did-cli transfer example.com --network sepolia
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
**Important Notes:**
|
|
249
|
-
|
|
250
|
-
1. **Authentication**: You need the current owner's private key or mnemonic via `PRIVATE_KEY_OR_MNEMONIC` environment variable
|
|
251
|
-
2. **New Owner Mnemonic**:
|
|
252
|
-
- Set via `TO_MNEMONIC` environment variable to use an existing mnemonic
|
|
253
|
-
- If `TO_MNEMONIC` is not set, a new one will be auto-generated and saved to `./transfer-new-owner-mnemonic.txt`
|
|
254
|
-
- The mnemonic derives the new owner's address and DID
|
|
255
|
-
- **Save the new owner's mnemonic securely** - it's the only way to control the domain after transfer
|
|
256
|
-
3. **Two Transactions**: The operation submits two transactions to the blockchain
|
|
257
|
-
- First: Transfer NFT ownership
|
|
258
|
-
- Second: Update domain DID
|
|
259
|
-
4. **Irreversible**: Once transferred, the domain is controlled by the new owner
|
|
260
|
-
|
|
261
|
-
**Output Example:**
|
|
262
|
-
|
|
263
|
-
```
|
|
264
|
-
🔑 Generated 12-word mnemonic for new owner:
|
|
265
|
-
abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about
|
|
266
|
-
|
|
267
|
-
⚠️ IMPORTANT: Save this mnemonic securely! It controls the domain.
|
|
268
|
-
|
|
269
|
-
📋 Transferring domain: example.com
|
|
270
|
-
⏳ Submitting transactions...
|
|
271
|
-
|
|
272
|
-
✅ Domain transfer successful!
|
|
273
|
-
|
|
274
|
-
Transaction Details:
|
|
275
|
-
Domain: example.com
|
|
276
|
-
New Owner: 0x9858EfFD232B4033E47d90003D41EC34EcaEda94
|
|
277
|
-
New DID: did:key:z6MkvARmXmTXnwyJz9uXbzJjEVKVb9PegegGZMqiuQQCHzo2
|
|
278
|
-
Transfer Tx: 0xabcd1234...
|
|
279
|
-
Set DID Tx: 0xefgh5678...
|
|
280
|
-
|
|
281
|
-
🔑 New Owner Mnemonic (SAVE THIS!):
|
|
282
|
-
abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
### Crypto Utilities
|
|
286
|
-
|
|
287
|
-
Generate and derive cryptographic keys from mnemonic phrases. These utilities work offline and don't require blockchain access.
|
|
288
|
-
|
|
289
|
-
#### Generate Mnemonic
|
|
290
|
-
|
|
291
|
-
Generate a new BIP39 mnemonic phrase. **The mnemonic is automatically saved to a file for security.**
|
|
292
|
-
|
|
293
|
-
```bash
|
|
294
|
-
did-cli crypto generate [options]
|
|
295
|
-
|
|
296
|
-
# Examples
|
|
297
|
-
did-cli crypto generate # 12-word mnemonic (default)
|
|
298
|
-
did-cli crypto generate --words 12 # 12-word mnemonic
|
|
299
|
-
did-cli crypto generate --words 24 # 24-word mnemonic
|
|
300
|
-
did-cli crypto generate --output ./my-mnemonic.txt # Custom output file
|
|
301
|
-
did-cli crypto generate --json # JSON output
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
**Output Example:**
|
|
305
|
-
|
|
306
|
-
```
|
|
307
|
-
🔑 Generated 12-word mnemonic
|
|
308
|
-
📄 Mnemonic saved to: ./mnemonic.txt
|
|
309
|
-
|
|
310
|
-
⚠️ SECURITY WARNING:
|
|
311
|
-
• Keep this mnemonic secure! It controls all derived keys!
|
|
312
|
-
• Store it in a safe place (paper backup, hardware wallet, etc.)
|
|
313
|
-
• Delete the file after copying to a secure location
|
|
314
|
-
• Command: rm ./mnemonic.txt
|
|
315
|
-
|
|
316
|
-
💡 To use the mnemonic:
|
|
317
|
-
export MNEMONIC="$(cat ./mnemonic.txt)"
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
**Note:** The default output file is `./mnemonic.txt`. Use `--output` option to specify a different location.
|
|
321
|
-
|
|
322
|
-
#### Get Ethereum Address from Mnemonic
|
|
27
|
+
---
|
|
323
28
|
|
|
324
|
-
|
|
29
|
+
## Scenario 1: Regular User Queries Olares ID Data
|
|
325
30
|
|
|
326
|
-
|
|
31
|
+
Goal: quickly see metadata and tags for a domain or Olares ID.
|
|
327
32
|
|
|
328
33
|
```bash
|
|
329
|
-
|
|
330
|
-
did-cli
|
|
34
|
+
# Fetch complete domain data (metadata + tags)
|
|
35
|
+
did-cli fetch olares.com
|
|
331
36
|
|
|
332
|
-
#
|
|
333
|
-
did-cli
|
|
334
|
-
```
|
|
37
|
+
# Olares ID format is supported
|
|
38
|
+
did-cli fetch tw7613781@olares.com
|
|
335
39
|
|
|
336
|
-
|
|
40
|
+
# JSON output for scripts
|
|
41
|
+
did-cli fetch olares.com --json
|
|
337
42
|
|
|
43
|
+
# Query owner / basic metadata
|
|
44
|
+
did-cli owner olares.com
|
|
45
|
+
did-cli info olares.com
|
|
338
46
|
```
|
|
339
|
-
🏠 Ethereum Address:
|
|
340
|
-
0x9858EfFD232B4033E47d90003D41EC34EcaEda94
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
#### Get DID from Mnemonic
|
|
344
|
-
|
|
345
|
-
Derive a DID (Decentralized Identifier) from a mnemonic phrase.
|
|
346
47
|
|
|
347
|
-
|
|
48
|
+
What you get:
|
|
348
49
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
50
|
+
- Domain metadata (name, DID, owner, allowSubdomain, etc.)
|
|
51
|
+
- All defined tags for that domain
|
|
52
|
+
- Tags without values are also returned (for example, value is `0x` and `valueFormatted` is `null`)
|
|
352
53
|
|
|
353
|
-
|
|
354
|
-
did-cli crypto did --json
|
|
355
|
-
```
|
|
54
|
+
Practical note:
|
|
356
55
|
|
|
357
|
-
|
|
56
|
+
- If you are building a dashboard, prefer `fetch --json` and parse `tags` directly.
|
|
358
57
|
|
|
359
|
-
|
|
360
|
-
🆔 DID:
|
|
361
|
-
did:key:z6MkvARmXmTXnwyJz9uXbzJjEVKVb9PegegGZMqiuQQCHzo2
|
|
362
|
-
```
|
|
58
|
+
---
|
|
363
59
|
|
|
364
|
-
|
|
60
|
+
## Scenario 2: Developer Registration on Olares OS (Bind RSA Key)
|
|
365
61
|
|
|
366
|
-
|
|
62
|
+
Goal: bind an RSA public key to your domain so your developer identity can be verified by services.
|
|
367
63
|
|
|
368
|
-
|
|
64
|
+
Step 1: prepare signer credentials.
|
|
369
65
|
|
|
370
66
|
```bash
|
|
371
|
-
export
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
# Specify output file
|
|
375
|
-
did-cli crypto privatekey --output ./my-private-key.txt
|
|
376
|
-
|
|
377
|
-
# JSON output
|
|
378
|
-
did-cli crypto privatekey --json
|
|
67
|
+
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_DOMAIN_OWNER_PRIVATE_KEY"
|
|
68
|
+
# or
|
|
69
|
+
export PRIVATE_KEY_OR_MNEMONIC="your twelve word mnemonic phrase"
|
|
379
70
|
```
|
|
380
71
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
```
|
|
384
|
-
🔑 EVM Private Key:
|
|
385
|
-
0x1ab42cc412b618bdea3a599e3c9bae199ebf030895b039e9db1e30dafb12b727
|
|
386
|
-
|
|
387
|
-
📄 Private key saved to: ./private-key.txt
|
|
388
|
-
|
|
389
|
-
⚠️ SECURITY WARNING:
|
|
390
|
-
• Keep this private key secure! Never share it!
|
|
391
|
-
• Delete the file after copying to a secure location
|
|
392
|
-
• Command: rm ./private-key.txt
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
**Note:** The default output file is `./private-key.txt`. Use `--output` option to specify a different location.
|
|
396
|
-
|
|
397
|
-
#### Derive All Keys from Mnemonic
|
|
398
|
-
|
|
399
|
-
Derive all keys (address, DID, and private key) from a mnemonic in one command. **All keys are automatically saved to a file.**
|
|
400
|
-
|
|
401
|
-
**Requirements:** `MNEMONIC` environment variable must be set.
|
|
72
|
+
Step 2: generate key pair locally.
|
|
402
73
|
|
|
403
74
|
```bash
|
|
404
|
-
|
|
405
|
-
did-cli crypto derive
|
|
406
|
-
|
|
407
|
-
# Specify output file
|
|
408
|
-
did-cli crypto derive --output ./my-keys.txt
|
|
409
|
-
|
|
410
|
-
# JSON output
|
|
411
|
-
did-cli crypto derive --json
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
**Output Example:**
|
|
415
|
-
|
|
416
|
-
```
|
|
417
|
-
🔐 Derived Keys:
|
|
418
|
-
Address: 0x9858EfFD232B4033E47d90003D41EC34EcaEda94
|
|
419
|
-
DID: did:key:z6MkvARmXmTXnwyJz9uXbzJjEVKVb9PegegGZMqiuQQCHzo2
|
|
420
|
-
Private Key: 0x1ab42cc412b618bdea3a599e3c9bae199ebf030895b039e9db1e30dafb12b727
|
|
421
|
-
|
|
422
|
-
📄 Keys saved to: ./derived-keys.txt
|
|
423
|
-
|
|
424
|
-
⚠️ SECURITY WARNING:
|
|
425
|
-
• Keep these credentials secure! Never share them!
|
|
426
|
-
• Delete the file after copying to a secure location
|
|
427
|
-
• Command: rm ./derived-keys.txt
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
**File Content Example:**
|
|
431
|
-
|
|
75
|
+
did-cli rsa generate --output ./developer-key.pem
|
|
432
76
|
```
|
|
433
|
-
Ethereum Address: 0x9858EfFD232B4033E47d90003D41EC34EcaEda94
|
|
434
|
-
DID: did:key:z6MkvARmXmTXnwyJz9uXbzJjEVKVb9PegegGZMqiuQQCHzo2
|
|
435
|
-
Private Key: 0x1ab42cc412b618bdea3a599e3c9bae199ebf030895b039e9db1e30dafb12b727
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
**Note:** The default output file is `./derived-keys.txt`. Use `--output` option to specify a different location.
|
|
439
|
-
|
|
440
|
-
**Important Notes:**
|
|
441
|
-
|
|
442
|
-
1. **Offline Operation**: All crypto utilities work offline and don't require network access
|
|
443
|
-
2. **Deterministic**: Same mnemonic always produces the same keys
|
|
444
|
-
3. **BIP39 Standard**: Uses standard BIP39 mnemonic generation
|
|
445
|
-
4. **BIP44 Derivation**: Follows BIP44 standard for Ethereum key derivation (m/44'/60'/0'/0/0)
|
|
446
|
-
5. **Ed25519 for DID**: Uses Ed25519 curve for DID key generation (compatible with TermiPass)
|
|
447
|
-
6. **Security**:
|
|
448
|
-
- Never share your mnemonic or private key
|
|
449
|
-
- Store mnemonics securely (paper backup, hardware wallet, etc.)
|
|
450
|
-
- Be cautious when using `privatekey` and `derive` commands in shared environments
|
|
451
|
-
|
|
452
|
-
### Wallet Management
|
|
453
|
-
|
|
454
|
-
Manage EVM and Solana wallet addresses associated with your domain. These authenticated addresses can be used for various authorization and verification purposes.
|
|
455
77
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
Add an EVM wallet address to your domain's authenticated addresses.
|
|
459
|
-
|
|
460
|
-
**Requirements:**
|
|
461
|
-
|
|
462
|
-
- `PRIVATE_KEY_OR_MNEMONIC` environment variable (domain owner's key for signing)
|
|
463
|
-
- `EVM_PRIVATE_KEY` environment variable (wallet to add)
|
|
78
|
+
Step 3: bind the public key to your domain.
|
|
464
79
|
|
|
465
80
|
```bash
|
|
466
|
-
|
|
467
|
-
export EVM_PRIVATE_KEY="0xWALLET_TO_ADD"
|
|
468
|
-
did-cli wallet evm add example.com
|
|
469
|
-
|
|
470
|
-
# With JSON output
|
|
471
|
-
did-cli wallet evm add example.com --json
|
|
472
|
-
|
|
473
|
-
# On sepolia testnet
|
|
474
|
-
did-cli wallet evm add example.com --network sepolia
|
|
81
|
+
did-cli rsa set olares.com ./developer-key.pem
|
|
475
82
|
```
|
|
476
83
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
```
|
|
480
|
-
💼 Adding EVM wallet to domain: example.com
|
|
481
|
-
|
|
482
|
-
✅ EVM wallet added successfully!
|
|
483
|
-
Address: 0x9858EfFD232B4033E47d90003D41EC34EcaEda94
|
|
484
|
-
Transaction: 0x123abc...
|
|
485
|
-
Gas used: 150000
|
|
486
|
-
```
|
|
487
|
-
|
|
488
|
-
**Important Notes:**
|
|
489
|
-
|
|
490
|
-
- The EVM_PRIVATE_KEY is the wallet you want to add as an authenticated address
|
|
491
|
-
- The PRIVATE_KEY_OR_MNEMONIC is your domain owner's key for authorization
|
|
492
|
-
- The signature is valid for 1 hour from the timestamp
|
|
493
|
-
- Duplicate addresses will be rejected with a friendly error message
|
|
494
|
-
|
|
495
|
-
#### Remove EVM Wallet
|
|
496
|
-
|
|
497
|
-
Remove an EVM wallet address from your domain.
|
|
498
|
-
|
|
499
|
-
**Requirements:**
|
|
500
|
-
|
|
501
|
-
- `PRIVATE_KEY_OR_MNEMONIC` environment variable (domain owner's key)
|
|
502
|
-
- `EVM_PRIVATE_KEY` environment variable (wallet to remove)
|
|
84
|
+
Step 4: verify it.
|
|
503
85
|
|
|
504
86
|
```bash
|
|
505
|
-
|
|
506
|
-
export EVM_PRIVATE_KEY="0xWALLET_TO_REMOVE"
|
|
507
|
-
did-cli wallet evm remove example.com
|
|
508
|
-
|
|
509
|
-
# With JSON output
|
|
510
|
-
did-cli wallet evm remove example.com --json
|
|
87
|
+
did-cli rsa get olares.com
|
|
511
88
|
```
|
|
512
89
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
List all EVM wallet addresses associated with a domain.
|
|
516
|
-
|
|
517
|
-
**No authentication required** (read-only operation)
|
|
90
|
+
Optional rollback:
|
|
518
91
|
|
|
519
92
|
```bash
|
|
520
|
-
did-cli
|
|
521
|
-
|
|
522
|
-
# With JSON output
|
|
523
|
-
did-cli wallet evm list example.com --json
|
|
93
|
+
did-cli rsa remove olares.com
|
|
524
94
|
```
|
|
525
95
|
|
|
526
|
-
|
|
96
|
+
Practical notes:
|
|
527
97
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
Found 2 wallet(s):
|
|
531
|
-
1. 0x9858effd232b4033e47d90003d41ec34ecaeda94
|
|
532
|
-
2. 0x1234567890abcdef1234567890abcdef12345678
|
|
533
|
-
```
|
|
534
|
-
|
|
535
|
-
**JSON Output Example:**
|
|
536
|
-
|
|
537
|
-
```json
|
|
538
|
-
{
|
|
539
|
-
"domain": "example.com",
|
|
540
|
-
"wallets": [
|
|
541
|
-
"0x9858effd232b4033e47d90003d41ec34ecaeda94",
|
|
542
|
-
"0x1234567890abcdef1234567890abcdef12345678"
|
|
543
|
-
],
|
|
544
|
-
"count": 2
|
|
545
|
-
}
|
|
546
|
-
```
|
|
98
|
+
- Keep the private key file secure. Only the public key is uploaded on-chain.
|
|
99
|
+
- The signer must be the domain owner (or an authorized account in your workflow).
|
|
547
100
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
Add a Solana wallet address to your domain's authenticated addresses.
|
|
551
|
-
|
|
552
|
-
**Requirements:**
|
|
101
|
+
---
|
|
553
102
|
|
|
554
|
-
|
|
555
|
-
- `SOLANA_PRIVATE_KEY` environment variable (wallet to add)
|
|
103
|
+
## Scenario 3: OTMOIC LP Binds Authenticated Addresses
|
|
556
104
|
|
|
557
|
-
|
|
105
|
+
Goal: LP account binds EVM and/or Solana addresses as authenticated addresses under a domain.
|
|
558
106
|
|
|
559
|
-
|
|
560
|
-
- **JSON array format**: `"[1,2,3,...]"` (64 bytes)
|
|
107
|
+
### Bind EVM Address
|
|
561
108
|
|
|
562
109
|
```bash
|
|
110
|
+
# Domain owner signer
|
|
563
111
|
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_DOMAIN_OWNER_KEY"
|
|
564
112
|
|
|
565
|
-
#
|
|
566
|
-
export
|
|
567
|
-
did-cli wallet solana add example.com
|
|
568
|
-
|
|
569
|
-
# Using JSON array format
|
|
570
|
-
export SOLANA_PRIVATE_KEY='[174,47,154,...]'
|
|
571
|
-
did-cli wallet solana add example.com
|
|
113
|
+
# Wallet private key to be bound
|
|
114
|
+
export EVM_PRIVATE_KEY="0xWALLET_PRIVATE_KEY"
|
|
572
115
|
|
|
573
|
-
#
|
|
574
|
-
did-cli wallet
|
|
116
|
+
# Add / list / remove
|
|
117
|
+
did-cli wallet evm add olares.com
|
|
118
|
+
did-cli wallet evm list olares.com
|
|
119
|
+
did-cli wallet evm remove olares.com
|
|
575
120
|
```
|
|
576
121
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
```
|
|
580
|
-
💼 Adding Solana wallet to domain: example.com
|
|
581
|
-
|
|
582
|
-
✅ Solana wallet added successfully!
|
|
583
|
-
Address: 8aKDo9WRy9YyJD5ZjL6nF5zEqG1N4mPxB7sU2wVqT3cH
|
|
584
|
-
Transaction: 0x456def...
|
|
585
|
-
Gas used: 180000
|
|
586
|
-
```
|
|
587
|
-
|
|
588
|
-
#### Remove Solana Wallet
|
|
589
|
-
|
|
590
|
-
Remove a Solana wallet address from your domain.
|
|
591
|
-
|
|
592
|
-
**Requirements:**
|
|
593
|
-
|
|
594
|
-
- `PRIVATE_KEY_OR_MNEMONIC` environment variable (domain owner's key)
|
|
595
|
-
- `SOLANA_PRIVATE_KEY` environment variable (wallet to remove)
|
|
122
|
+
### Bind Solana Address
|
|
596
123
|
|
|
597
124
|
```bash
|
|
125
|
+
# Domain owner signer
|
|
598
126
|
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_DOMAIN_OWNER_KEY"
|
|
599
|
-
export SOLANA_PRIVATE_KEY="5J7WpQXHJkD3..."
|
|
600
|
-
did-cli wallet solana remove example.com
|
|
601
|
-
```
|
|
602
|
-
|
|
603
|
-
#### List Solana Wallets
|
|
604
|
-
|
|
605
|
-
List all Solana wallet addresses associated with a domain.
|
|
606
|
-
|
|
607
|
-
**No authentication required** (read-only operation)
|
|
608
|
-
|
|
609
|
-
```bash
|
|
610
|
-
did-cli wallet solana list example.com
|
|
611
127
|
|
|
612
|
-
#
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
**Output Example:**
|
|
128
|
+
# Solana private key (base58 or JSON array)
|
|
129
|
+
export SOLANA_PRIVATE_KEY="5J7WpQX..."
|
|
130
|
+
# or
|
|
131
|
+
# export SOLANA_PRIVATE_KEY='[174,47,154,...]'
|
|
617
132
|
|
|
133
|
+
# Add / list / remove
|
|
134
|
+
did-cli wallet solana add olares.com
|
|
135
|
+
did-cli wallet solana list olares.com
|
|
136
|
+
did-cli wallet solana remove olares.com
|
|
618
137
|
```
|
|
619
|
-
📋 Listing Solana wallets for domain: example.com
|
|
620
|
-
Found 1 wallet(s):
|
|
621
|
-
1. 8aKDo9WRy9YyJD5ZjL6nF5zEqG1N4mPxB7sU2wVqT3cH
|
|
622
|
-
```
|
|
623
|
-
|
|
624
|
-
**Technical Details:**
|
|
625
|
-
|
|
626
|
-
1. **Signature Verification**: Both EVM and Solana wallets use EIP-712 typed data signing for verification
|
|
627
|
-
2. **Ed25519 Signatures**: Solana uses Ed25519 signatures for authentication
|
|
628
|
-
3. **Timestamp Validation**: Signatures must be generated within 1 hour of the current time
|
|
629
|
-
4. **Storage**: Wallet addresses are stored in the RootTagger2 contract
|
|
630
|
-
5. **Backward Compatibility**: `list` command also fetches addresses from legacy RootResolver contract
|
|
631
|
-
|
|
632
|
-
### Admin Commands
|
|
633
|
-
|
|
634
|
-
Manage contract-level administrative functions including ownership and operator management.
|
|
635
138
|
|
|
636
|
-
|
|
139
|
+
Practical notes:
|
|
637
140
|
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
did-cli admin get-owner [options]
|
|
642
|
-
|
|
643
|
-
# Examples
|
|
644
|
-
did-cli admin get-owner
|
|
645
|
-
did-cli admin get-owner --json
|
|
646
|
-
did-cli admin get-owner --network sepolia
|
|
647
|
-
```
|
|
648
|
-
|
|
649
|
-
**Output Example:**
|
|
650
|
-
|
|
651
|
-
```
|
|
652
|
-
👤 Contract Owner: 0x1234567890abcdef...
|
|
653
|
-
```
|
|
654
|
-
|
|
655
|
-
#### Get Total Supply
|
|
656
|
-
|
|
657
|
-
Get the total number of registered domains.
|
|
658
|
-
|
|
659
|
-
```bash
|
|
660
|
-
did-cli admin get-totalsupply [options]
|
|
661
|
-
|
|
662
|
-
# Examples
|
|
663
|
-
did-cli admin get-totalsupply
|
|
664
|
-
did-cli admin get-totalsupply --json
|
|
665
|
-
```
|
|
666
|
-
|
|
667
|
-
**Output Example:**
|
|
668
|
-
|
|
669
|
-
```
|
|
670
|
-
📊 Total Domains: 12345
|
|
671
|
-
```
|
|
672
|
-
|
|
673
|
-
#### Get Operator Address
|
|
674
|
-
|
|
675
|
-
Get the current operator address (super admin).
|
|
676
|
-
|
|
677
|
-
```bash
|
|
678
|
-
did-cli admin get-operator [options]
|
|
679
|
-
|
|
680
|
-
# Examples
|
|
681
|
-
did-cli admin get-operator
|
|
682
|
-
did-cli admin get-operator --json
|
|
683
|
-
did-cli admin get-operator --network sepolia
|
|
684
|
-
```
|
|
685
|
-
|
|
686
|
-
**Output Example:**
|
|
687
|
-
|
|
688
|
-
```
|
|
689
|
-
👔 Operator: 0x5678901234abcdef...
|
|
690
|
-
```
|
|
691
|
-
|
|
692
|
-
#### Set Operator Address
|
|
693
|
-
|
|
694
|
-
Set the operator address. Only the contract owner can call this.
|
|
695
|
-
|
|
696
|
-
```bash
|
|
697
|
-
did-cli admin set-operator <address>
|
|
698
|
-
|
|
699
|
-
# Examples
|
|
700
|
-
export PRIVATE_KEY_OR_MNEMONIC=0x1234...
|
|
701
|
-
did-cli admin set-operator 0x5678...
|
|
702
|
-
did-cli admin set-operator 0x5678... --json
|
|
703
|
-
```
|
|
704
|
-
|
|
705
|
-
**Output Example:**
|
|
706
|
-
|
|
707
|
-
```
|
|
708
|
-
✅ Operator set to 0x5678...
|
|
709
|
-
📝 Transaction: 0xabc123...
|
|
710
|
-
⛽ Gas used: 45000
|
|
711
|
-
```
|
|
712
|
-
|
|
713
|
-
#### Transfer Contract Ownership
|
|
714
|
-
|
|
715
|
-
Initiate transfer of contract ownership to a new address. The new owner must call `accept-ownership` to complete the transfer.
|
|
716
|
-
|
|
717
|
-
```bash
|
|
718
|
-
did-cli admin transfer-ownership <new-owner-address>
|
|
719
|
-
|
|
720
|
-
# Examples
|
|
721
|
-
export PRIVATE_KEY_OR_MNEMONIC=0x1234...
|
|
722
|
-
did-cli admin transfer-ownership 0x9999...
|
|
723
|
-
did-cli admin transfer-ownership 0x9999... --json
|
|
724
|
-
```
|
|
725
|
-
|
|
726
|
-
**Output Example:**
|
|
727
|
-
|
|
728
|
-
```
|
|
729
|
-
✅ Ownership transfer initiated to 0x9999...
|
|
730
|
-
📝 Transaction: 0xdef456...
|
|
731
|
-
⛽ Gas used: 50000
|
|
732
|
-
|
|
733
|
-
⚠️ Note: The new owner must call "admin accept-ownership" to complete the transfer
|
|
734
|
-
```
|
|
735
|
-
|
|
736
|
-
**Important Notes:**
|
|
737
|
-
|
|
738
|
-
- Only the current contract owner can initiate ownership transfer
|
|
739
|
-
- This is a two-step process for safety:
|
|
740
|
-
1. Current owner calls `transfer-ownership`
|
|
741
|
-
2. New owner calls `accept-ownership`
|
|
742
|
-
- The pending owner can be queried from the contract
|
|
743
|
-
|
|
744
|
-
#### Accept Ownership Transfer
|
|
745
|
-
|
|
746
|
-
Accept a pending ownership transfer. Must be called by the pending owner.
|
|
747
|
-
|
|
748
|
-
```bash
|
|
749
|
-
did-cli admin accept-ownership
|
|
750
|
-
|
|
751
|
-
# Examples
|
|
752
|
-
export PRIVATE_KEY_OR_MNEMONIC=0x9999... # New owner's private key
|
|
753
|
-
did-cli admin accept-ownership
|
|
754
|
-
did-cli admin accept-ownership --json
|
|
755
|
-
```
|
|
756
|
-
|
|
757
|
-
**Output Example:**
|
|
758
|
-
|
|
759
|
-
```
|
|
760
|
-
✅ Ownership transfer accepted successfully
|
|
761
|
-
📝 Transaction: 0xghi789...
|
|
762
|
-
⛽ Gas used: 48000
|
|
763
|
-
```
|
|
764
|
-
|
|
765
|
-
**Important Notes:**
|
|
766
|
-
|
|
767
|
-
- Only the pending owner (set by `transfer-ownership`) can accept
|
|
768
|
-
- After acceptance, you become the new contract owner
|
|
769
|
-
- This completes the ownership transfer process
|
|
770
|
-
|
|
771
|
-
### Utility Commands
|
|
772
|
-
|
|
773
|
-
#### Convert PEM to DER
|
|
774
|
-
|
|
775
|
-
```bash
|
|
776
|
-
did-cli convert pem-to-der <pem-file> [options]
|
|
777
|
-
|
|
778
|
-
# Examples
|
|
779
|
-
did-cli convert pem-to-der ./public-key.pem
|
|
780
|
-
did-cli convert pem-to-der ./public-key.pem --json
|
|
781
|
-
did-cli convert pem-to-der ./public-key.pem --output ./key.der
|
|
782
|
-
```
|
|
783
|
-
|
|
784
|
-
#### Convert DER to PEM
|
|
785
|
-
|
|
786
|
-
```bash
|
|
787
|
-
did-cli convert der-to-pem <der-hex> [options]
|
|
788
|
-
|
|
789
|
-
# Examples
|
|
790
|
-
did-cli convert der-to-pem 0x3082010a...
|
|
791
|
-
did-cli convert der-to-pem 0x3082010a... --json
|
|
792
|
-
did-cli convert der-to-pem 0x3082010a... --output ./key.pem
|
|
793
|
-
```
|
|
794
|
-
|
|
795
|
-
#### Convert IPv4 to Bytes4
|
|
796
|
-
|
|
797
|
-
```bash
|
|
798
|
-
did-cli convert ip-to-bytes <ipv4-address> [options]
|
|
799
|
-
|
|
800
|
-
# Examples
|
|
801
|
-
did-cli convert ip-to-bytes 192.168.1.1
|
|
802
|
-
did-cli convert ip-to-bytes 192.168.1.1 --json
|
|
803
|
-
```
|
|
804
|
-
|
|
805
|
-
#### Convert Bytes4 to IPv4
|
|
806
|
-
|
|
807
|
-
```bash
|
|
808
|
-
did-cli convert bytes-to-ip <bytes4-hex> [options]
|
|
809
|
-
|
|
810
|
-
# Examples
|
|
811
|
-
did-cli convert bytes-to-ip 0xc0a80101
|
|
812
|
-
did-cli convert bytes-to-ip 0xc0a80101 --json
|
|
813
|
-
```
|
|
141
|
+
- `PRIVATE_KEY_OR_MNEMONIC` is the domain authorization key.
|
|
142
|
+
- `EVM_PRIVATE_KEY` or `SOLANA_PRIVATE_KEY` is the wallet being bound.
|
|
143
|
+
- If add fails because the address already exists, check with `wallet ... list` first.
|
|
814
144
|
|
|
815
145
|
---
|
|
816
146
|
|
|
817
|
-
##
|
|
818
|
-
|
|
819
|
-
Tags are typed key-value pairs that can be attached to domains for storing structured metadata on-chain. The CLI provides simple commands for basic tag operations with common types.
|
|
820
|
-
|
|
821
|
-
> **📖 For Advanced Usage**: For complex types (tuples/structs), array element operations, and detailed API documentation, see the [Tag System Documentation](./docs/TAG_SYSTEM.md) and check the [examples](./examples/) directory.
|
|
147
|
+
## Scenario 4: Org Admin Creates Subdomain and Manages Subdomain Tags
|
|
822
148
|
|
|
823
|
-
|
|
149
|
+
Goal: org admin creates a subdomain, defines tag type on the org domain, sets self as tagger, then writes tag values for the subdomain object.
|
|
824
150
|
|
|
825
|
-
|
|
151
|
+
### Step A: Org Admin Creates Subdomain
|
|
826
152
|
|
|
827
153
|
```bash
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
**Supported Types:**
|
|
832
|
-
|
|
833
|
-
- Simple types: `string`, `uint8`, `uint256`, `int8`, `int256`, `bool`, `address`, `bytes`, `bytes32`
|
|
834
|
-
- Array types: `"string[]"`, `"uint8[]"`, `"address[]"`, etc. (must be quoted!)
|
|
835
|
-
|
|
836
|
-
**Requirements:** `PRIVATE_KEY_OR_MNEMONIC` environment variable
|
|
837
|
-
|
|
838
|
-
**Examples:**
|
|
839
|
-
|
|
840
|
-
```bash
|
|
841
|
-
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_PRIVATE_KEY"
|
|
842
|
-
|
|
843
|
-
# Define simple types
|
|
844
|
-
did-cli tag define example.com email string
|
|
845
|
-
did-cli tag define example.com age uint8
|
|
846
|
-
did-cli tag define example.com verified bool
|
|
847
|
-
did-cli tag define example.com owner address
|
|
848
|
-
|
|
849
|
-
# Define array types (MUST be quoted!)
|
|
850
|
-
did-cli tag define example.com wallets "address[]"
|
|
851
|
-
did-cli tag define example.com socialLinks "string[]"
|
|
852
|
-
|
|
853
|
-
# With JSON output
|
|
854
|
-
did-cli tag define example.com followers uint256 --json
|
|
855
|
-
```
|
|
856
|
-
|
|
857
|
-
**Output Example:**
|
|
858
|
-
|
|
859
|
-
```
|
|
860
|
-
📝 Defining tag "email" for domain: example.com
|
|
861
|
-
Type: string
|
|
862
|
-
|
|
863
|
-
✅ Tag "email" defined successfully
|
|
864
|
-
Transaction: 0x123abc...
|
|
865
|
-
Gas used: 150000
|
|
866
|
-
```
|
|
867
|
-
|
|
868
|
-
### Set Tagger
|
|
869
|
-
|
|
870
|
-
Set the authorized address (tagger) that can modify a tag's value. Only the domain owner can set the tagger.
|
|
871
|
-
|
|
872
|
-
```bash
|
|
873
|
-
did-cli tag set-tagger <domain> <tag-name> <tagger-address>
|
|
874
|
-
```
|
|
875
|
-
|
|
876
|
-
**Requirements:** `PRIVATE_KEY_OR_MNEMONIC` environment variable
|
|
877
|
-
|
|
878
|
-
**Examples:**
|
|
879
|
-
|
|
880
|
-
```bash
|
|
881
|
-
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_PRIVATE_KEY"
|
|
882
|
-
|
|
883
|
-
# Set tagger to a specific address
|
|
884
|
-
did-cli tag set-tagger example.com email 0x1234567890abcdef...
|
|
885
|
-
|
|
886
|
-
# Set tagger to yourself
|
|
887
|
-
SIGNER_ADDRESS=$(did-cli crypto address)
|
|
888
|
-
did-cli tag set-tagger example.com email $SIGNER_ADDRESS
|
|
889
|
-
```
|
|
890
|
-
|
|
891
|
-
**Output Example:**
|
|
892
|
-
|
|
893
|
-
```
|
|
894
|
-
🔐 Setting tagger for tag "email" in domain: example.com
|
|
895
|
-
Tagger address: 0x1234567890abcdef...
|
|
896
|
-
|
|
897
|
-
✅ Tagger set successfully
|
|
898
|
-
Transaction: 0x456def...
|
|
899
|
-
```
|
|
900
|
-
|
|
901
|
-
### Set Tag Value
|
|
902
|
-
|
|
903
|
-
Set or update a tag's value. You must be the designated tagger for this tag.
|
|
904
|
-
|
|
905
|
-
```bash
|
|
906
|
-
did-cli tag set <domain> <tag-name> <value>
|
|
907
|
-
```
|
|
908
|
-
|
|
909
|
-
**Value Formats:**
|
|
910
|
-
|
|
911
|
-
- **Strings**: Direct input (`user@example.com`) or JSON string
|
|
912
|
-
- **Numbers**: Direct input (`30`, `1000`)
|
|
913
|
-
- **Booleans**: `true` or `false`
|
|
914
|
-
- **Arrays**: JSON format, must be quoted (`'["item1","item2"]'`)
|
|
915
|
-
|
|
916
|
-
**Requirements:** `PRIVATE_KEY_OR_MNEMONIC` environment variable
|
|
917
|
-
|
|
918
|
-
**Examples:**
|
|
919
|
-
|
|
920
|
-
```bash
|
|
921
|
-
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_PRIVATE_KEY"
|
|
922
|
-
|
|
923
|
-
# Set string value
|
|
924
|
-
did-cli tag set example.com email "user@example.com"
|
|
925
|
-
did-cli tag set example.com bio "Web3 developer and blockchain enthusiast"
|
|
926
|
-
|
|
927
|
-
# Set number value
|
|
928
|
-
did-cli tag set example.com age 30
|
|
929
|
-
did-cli tag set example.com followers 1350
|
|
930
|
-
|
|
931
|
-
# Set boolean value
|
|
932
|
-
did-cli tag set example.com verified true
|
|
933
|
-
did-cli tag set example.com premium false
|
|
934
|
-
|
|
935
|
-
# Set array value (use JSON, must be quoted!)
|
|
936
|
-
did-cli tag set example.com socialLinks '["https://twitter.com/alice","https://github.com/alice"]'
|
|
937
|
-
did-cli tag set example.com wallets '["0x1111111111111111111111111111111111111111","0x2222222222222222222222222222222222222222"]'
|
|
938
|
-
|
|
939
|
-
# With JSON output
|
|
940
|
-
did-cli tag set example.com email "user@example.com" --json
|
|
941
|
-
```
|
|
942
|
-
|
|
943
|
-
**Output Example:**
|
|
944
|
-
|
|
945
|
-
```
|
|
946
|
-
📝 Setting tag "email" for domain: example.com
|
|
947
|
-
Value: user@example.com
|
|
948
|
-
|
|
949
|
-
✅ Tag "email" set successfully
|
|
950
|
-
Transaction: 0x789ghi...
|
|
951
|
-
Gas used: 120000
|
|
952
|
-
```
|
|
953
|
-
|
|
954
|
-
### Get Tag Value
|
|
955
|
-
|
|
956
|
-
Read a tag's current value. This is a read-only operation and doesn't require authentication.
|
|
154
|
+
# Parent domain owner key
|
|
155
|
+
export PRIVATE_KEY_OR_MNEMONIC="0xPARENT_DOMAIN_OWNER_KEY"
|
|
957
156
|
|
|
958
|
-
|
|
959
|
-
did-cli
|
|
960
|
-
```
|
|
961
|
-
|
|
962
|
-
**Requirements:** None (read-only)
|
|
963
|
-
|
|
964
|
-
**Examples:**
|
|
965
|
-
|
|
966
|
-
```bash
|
|
967
|
-
# Get any tag value
|
|
968
|
-
did-cli tag get example.com email
|
|
969
|
-
did-cli tag get example.com age
|
|
970
|
-
did-cli tag get example.com socialLinks
|
|
971
|
-
|
|
972
|
-
# With JSON output
|
|
973
|
-
did-cli tag get example.com email --json
|
|
974
|
-
```
|
|
975
|
-
|
|
976
|
-
**Output Examples:**
|
|
977
|
-
|
|
978
|
-
```
|
|
979
|
-
📖 Getting tag "email" for domain: example.com
|
|
980
|
-
|
|
981
|
-
✅ Tag value:
|
|
982
|
-
user@example.com
|
|
983
|
-
```
|
|
984
|
-
|
|
985
|
-
```
|
|
986
|
-
📖 Getting tag "socialLinks" for domain: example.com
|
|
987
|
-
|
|
988
|
-
✅ Tag value:
|
|
989
|
-
["https://twitter.com/alice","https://github.com/alice"]
|
|
990
|
-
```
|
|
991
|
-
|
|
992
|
-
### Remove Tag Value
|
|
993
|
-
|
|
994
|
-
Remove a tag's value while keeping its definition. The tag can be set again later.
|
|
995
|
-
|
|
996
|
-
```bash
|
|
997
|
-
did-cli tag remove <domain> <tag-name>
|
|
998
|
-
```
|
|
999
|
-
|
|
1000
|
-
**Requirements:** `PRIVATE_KEY_OR_MNEMONIC` environment variable
|
|
1001
|
-
|
|
1002
|
-
**Examples:**
|
|
1003
|
-
|
|
1004
|
-
```bash
|
|
1005
|
-
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_PRIVATE_KEY"
|
|
1006
|
-
|
|
1007
|
-
# Remove tag value
|
|
1008
|
-
did-cli tag remove example.com email
|
|
1009
|
-
|
|
1010
|
-
# With JSON output
|
|
1011
|
-
did-cli tag remove example.com email --json
|
|
1012
|
-
```
|
|
1013
|
-
|
|
1014
|
-
**Output Example:**
|
|
1015
|
-
|
|
1016
|
-
```
|
|
1017
|
-
🗑️ Removing tag "email" for domain: example.com
|
|
1018
|
-
|
|
1019
|
-
✅ Tag "email" value removed successfully
|
|
1020
|
-
Transaction: 0xabc123...
|
|
1021
|
-
```
|
|
1022
|
-
|
|
1023
|
-
**Note:** This removes the _value_ only, not the tag definition. The tag type remains defined and can be set again.
|
|
1024
|
-
|
|
1025
|
-
### List All Tags
|
|
1026
|
-
|
|
1027
|
-
List all tags and their current values for a domain.
|
|
1028
|
-
|
|
1029
|
-
```bash
|
|
1030
|
-
did-cli tag list <domain>
|
|
157
|
+
# Register child under parent.com => child.parent.com
|
|
158
|
+
did-cli subdomain register parent.com child
|
|
1031
159
|
```
|
|
1032
160
|
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
**Examples:**
|
|
161
|
+
### Step B: Org Admin Defines Tag Type on Parent (Org) Domain
|
|
1036
162
|
|
|
1037
163
|
```bash
|
|
1038
|
-
#
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
# With JSON output
|
|
1042
|
-
did-cli tag list example.com --json
|
|
1043
|
-
```
|
|
164
|
+
# Still using org admin key
|
|
165
|
+
export PRIVATE_KEY_OR_MNEMONIC="0xPARENT_DOMAIN_OWNER_KEY"
|
|
1044
166
|
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
```
|
|
1048
|
-
📋 Listing all tags for domain: example.com
|
|
1049
|
-
|
|
1050
|
-
✅ Found 7 tags:
|
|
1051
|
-
|
|
1052
|
-
Tag: "email"
|
|
1053
|
-
Value: user@example.com
|
|
1054
|
-
Tag: "age"
|
|
1055
|
-
Value: 30
|
|
1056
|
-
Tag: "verified"
|
|
1057
|
-
Value: true
|
|
1058
|
-
Tag: "bio"
|
|
1059
|
-
Value: Web3 developer and blockchain enthusiast
|
|
1060
|
-
Tag: "followers"
|
|
1061
|
-
Value: 1350
|
|
1062
|
-
Tag: "socialLinks"
|
|
1063
|
-
Value: ["https://twitter.com/alice","https://github.com/alice"]
|
|
1064
|
-
Tag: "wallets"
|
|
1065
|
-
Value: ["0x1111111111111111111111111111111111111111"]
|
|
167
|
+
# Define tag type on parent/org domain
|
|
168
|
+
did-cli tag define parent.com profile string
|
|
1066
169
|
```
|
|
1067
170
|
|
|
1068
|
-
###
|
|
1069
|
-
|
|
1070
|
-
List all defined tag types for a domain, including those without values.
|
|
171
|
+
### Step C: Org Admin Sets Self as Tagger
|
|
1071
172
|
|
|
1072
173
|
```bash
|
|
1073
|
-
|
|
174
|
+
export PRIVATE_KEY_OR_MNEMONIC="0xPARENT_DOMAIN_OWNER_KEY"
|
|
175
|
+
did-cli tag set-tagger parent.com profile 0xORG_ADMIN_ADDRESS
|
|
1074
176
|
```
|
|
1075
177
|
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
**Examples:**
|
|
178
|
+
Tip: if needed, you can get admin address first:
|
|
1079
179
|
|
|
1080
180
|
```bash
|
|
1081
|
-
|
|
1082
|
-
did-cli
|
|
1083
|
-
|
|
1084
|
-
# With JSON output
|
|
1085
|
-
did-cli tag list-defined example.com --json
|
|
1086
|
-
```
|
|
1087
|
-
|
|
1088
|
-
**Output Example:**
|
|
1089
|
-
|
|
1090
|
-
```
|
|
1091
|
-
📋 Listing defined tag types for domain: example.com
|
|
1092
|
-
|
|
1093
|
-
✅ Found 9 defined tag types:
|
|
1094
|
-
|
|
1095
|
-
- email
|
|
1096
|
-
- age
|
|
1097
|
-
- verified
|
|
1098
|
-
- bio
|
|
1099
|
-
- followers
|
|
1100
|
-
- premium
|
|
1101
|
-
- socialLinks
|
|
1102
|
-
- wallets
|
|
1103
|
-
- userInfo
|
|
181
|
+
export PRIVATE_KEY_OR_MNEMONIC="0xPARENT_DOMAIN_OWNER_KEY"
|
|
182
|
+
did-cli crypto address
|
|
1104
183
|
```
|
|
1105
184
|
|
|
1106
|
-
###
|
|
1107
|
-
|
|
1108
|
-
Get the current tagger address for a tag.
|
|
185
|
+
### Step D: Org Admin Sets Tag Value for Subdomain Object
|
|
1109
186
|
|
|
1110
187
|
```bash
|
|
1111
|
-
|
|
188
|
+
export PRIVATE_KEY_OR_MNEMONIC="0xPARENT_DOMAIN_OWNER_KEY"
|
|
189
|
+
did-cli tag set child.parent.com profile "builder of team alpha" --from parent.com
|
|
1112
190
|
```
|
|
1113
191
|
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
**Examples:**
|
|
192
|
+
Verify result:
|
|
1117
193
|
|
|
1118
194
|
```bash
|
|
1119
|
-
|
|
1120
|
-
did-cli tag
|
|
1121
|
-
|
|
1122
|
-
# With JSON output
|
|
1123
|
-
did-cli tag get-tagger example.com email --json
|
|
1124
|
-
```
|
|
1125
|
-
|
|
1126
|
-
**Output Example:**
|
|
1127
|
-
|
|
195
|
+
did-cli tag get child.parent.com profile --from parent.com
|
|
196
|
+
did-cli tag list child.parent.com --from parent.com
|
|
1128
197
|
```
|
|
1129
|
-
🔍 Getting tagger for tag "email" in domain: example.com
|
|
1130
198
|
|
|
1131
|
-
|
|
1132
|
-
```
|
|
199
|
+
Practical notes:
|
|
1133
200
|
|
|
1134
|
-
|
|
201
|
+
- Define tag type first, then set tagger, then set value.
|
|
202
|
+
- In this workflow, tag type and tagger are managed on the parent/org domain, while the value is written to the target subdomain object.
|
|
203
|
+
- Use `--from` whenever tag type is defined on a different domain than the target object.
|
|
204
|
+
- `tag list-defined` supports root query when domain is omitted:
|
|
1135
205
|
|
|
1136
206
|
```bash
|
|
1137
|
-
|
|
1138
|
-
export PRIVATE_KEY_OR_MNEMONIC="0xYOUR_PRIVATE_KEY"
|
|
1139
|
-
|
|
1140
|
-
# 2. Define tag types
|
|
1141
|
-
did-cli tag define example.com bio string
|
|
1142
|
-
did-cli tag define example.com followers uint256
|
|
1143
|
-
did-cli tag define example.com premium bool
|
|
1144
|
-
did-cli tag define example.com socialLinks "string[]"
|
|
1145
|
-
|
|
1146
|
-
# 3. Get your address and set as tagger
|
|
1147
|
-
SIGNER_ADDRESS=$(did-cli crypto address)
|
|
1148
|
-
did-cli tag set-tagger example.com bio $SIGNER_ADDRESS
|
|
1149
|
-
did-cli tag set-tagger example.com followers $SIGNER_ADDRESS
|
|
1150
|
-
did-cli tag set-tagger example.com premium $SIGNER_ADDRESS
|
|
1151
|
-
did-cli tag set-tagger example.com socialLinks $SIGNER_ADDRESS
|
|
1152
|
-
|
|
1153
|
-
# 4. Set tag values
|
|
1154
|
-
did-cli tag set example.com bio "Web3 developer and blockchain enthusiast"
|
|
1155
|
-
did-cli tag set example.com followers 1350
|
|
1156
|
-
did-cli tag set example.com premium true
|
|
1157
|
-
did-cli tag set example.com socialLinks '["https://twitter.com/alice","https://github.com/alice"]'
|
|
1158
|
-
|
|
1159
|
-
# 5. Read values (no auth required)
|
|
1160
|
-
did-cli tag get example.com bio
|
|
1161
|
-
did-cli tag list example.com
|
|
1162
|
-
|
|
1163
|
-
# 6. Update a value
|
|
1164
|
-
did-cli tag set example.com followers 1500
|
|
1165
|
-
|
|
1166
|
-
# 7. Remove a value
|
|
1167
|
-
did-cli tag remove example.com premium
|
|
207
|
+
did-cli tag list-defined
|
|
1168
208
|
```
|
|
1169
209
|
|
|
1170
|
-
### Important Notes
|
|
1171
|
-
|
|
1172
|
-
1. **Array Types Must Be Quoted**: When using array types like `address[]` or `string[]`, you must quote them to prevent shell interpretation:
|
|
1173
|
-
|
|
1174
|
-
```bash
|
|
1175
|
-
# ✅ Correct
|
|
1176
|
-
did-cli tag define example.com wallets "address[]"
|
|
1177
|
-
|
|
1178
|
-
# ❌ Wrong - shell will interpret []
|
|
1179
|
-
did-cli tag define example.com wallets address[]
|
|
1180
|
-
```
|
|
1181
|
-
|
|
1182
|
-
2. **Array Values Must Be JSON**: When setting array values, use valid JSON and quote the entire value:
|
|
1183
|
-
|
|
1184
|
-
```bash
|
|
1185
|
-
# ✅ Correct
|
|
1186
|
-
did-cli tag set example.com links '["https://twitter.com","https://github.com"]'
|
|
1187
|
-
|
|
1188
|
-
# ❌ Wrong
|
|
1189
|
-
did-cli tag set example.com links https://twitter.com,https://github.com
|
|
1190
|
-
```
|
|
1191
|
-
|
|
1192
|
-
3. **Set Tagger Before Setting Values**: You must set a tagger after defining a tag and before you can set its value:
|
|
1193
|
-
|
|
1194
|
-
```bash
|
|
1195
|
-
did-cli tag define example.com email string
|
|
1196
|
-
did-cli tag set-tagger example.com email $YOUR_ADDRESS # Required!
|
|
1197
|
-
did-cli tag set example.com email "user@example.com"
|
|
1198
|
-
```
|
|
1199
|
-
|
|
1200
|
-
4. **CLI Limitations**: The CLI only supports simple types and arrays. For complex tuple types and advanced operations:
|
|
1201
|
-
|
|
1202
|
-
- Use the SDK directly (see [TAG.md](./TAG.md))
|
|
1203
|
-
- Check examples in [`examples/tag-management.ts`](./examples/tag-management.ts)
|
|
1204
|
-
|
|
1205
|
-
5. **Tags Are Immutable After Definition**: You cannot change a tag's type once defined. You can only set/update/remove values.
|
|
1206
|
-
|
|
1207
210
|
---
|
|
1208
211
|
|
|
1209
|
-
##
|
|
1210
|
-
|
|
1211
|
-
| Option | Description | Default |
|
|
1212
|
-
| --- | --- | --- |
|
|
1213
|
-
| `-n, --network <network>` | Network to use (sepolia\|mainnet) | mainnet |
|
|
1214
|
-
| `--rpc <url>` | Custom RPC endpoint URL | - |
|
|
1215
|
-
| `--contract-did <address>` | Custom DID contract address | - |
|
|
1216
|
-
| `--contract-resolver <address>` | Custom RootResolver contract address | - |
|
|
1217
|
-
| `--contract-abi <address>` | Custom ABIType contract address | - |
|
|
1218
|
-
| `--contract-resolver2 <address>` | Custom RootResolver2 contract address | - |
|
|
1219
|
-
| `--support-svc-url <url>` | Custom support service URL | - |
|
|
1220
|
-
| `-o, --output <file>` | Output file path | - |
|
|
1221
|
-
| `--key-length <bits>` | RSA key length in bits | 2048 |
|
|
1222
|
-
| `-w, --words <count>` | Mnemonic word count (12\|15\|18\|21\|24) | 12 |
|
|
1223
|
-
| `-j, --json` | Output in JSON format | false |
|
|
1224
|
-
| `-v, --verbose` | Enable verbose debug output | false |
|
|
1225
|
-
| `--debug` | Enable debug output | false |
|
|
1226
|
-
| `--debug-level <level>` | Set debug level (debug\|info\|warn\|error) | info |
|
|
1227
|
-
| `-h, --help` | Show help message | - |
|
|
1228
|
-
| `-V, --version` | Show version number | - |
|
|
1229
|
-
|
|
1230
|
-
## Environment Variables
|
|
1231
|
-
|
|
1232
|
-
| Variable | Description |
|
|
1233
|
-
| --- | --- |
|
|
1234
|
-
| `PRIVATE_KEY_OR_MNEMONIC` | Private key (0x...) or BIP39 mnemonic phrase for signing transactions (required for write operations like transfer, set RSA key, set IP, wallet management, etc.) |
|
|
1235
|
-
| `SUBDOMAIN_OWNER_MNEMONIC` | BIP39 mnemonic phrase for generating subdomain owner identity (used in subdomain registration) |
|
|
1236
|
-
| `TO_MNEMONIC` | BIP39 mnemonic phrase for generating new owner identity (used in domain transfer) |
|
|
1237
|
-
| `MNEMONIC` | BIP39 mnemonic phrase for crypto utility commands (used in crypto address, did, privatekey, derive) |
|
|
1238
|
-
| `EVM_PRIVATE_KEY` | EVM wallet private key (0x...) for wallet management operations (required for `wallet evm add/remove` commands) |
|
|
1239
|
-
| `SOLANA_PRIVATE_KEY` | Solana wallet private key for wallet management operations (required for `wallet solana add/remove` commands). Supports base58 or JSON array format |
|
|
1240
|
-
|
|
1241
|
-
**Security Note:** Using environment variables for private keys or mnemonics prevents them from being stored in shell history, which is more secure than passing them as command-line arguments.
|
|
1242
|
-
|
|
1243
|
-
**Format Examples:**
|
|
1244
|
-
|
|
1245
|
-
- Private key: `export PRIVATE_KEY_OR_MNEMONIC=0x1234567890abcdef...`
|
|
1246
|
-
- Mnemonic: `export PRIVATE_KEY_OR_MNEMONIC="abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"`
|
|
1247
|
-
|
|
1248
|
-
> **⚠️ Important: Always use quotes for mnemonic phrases!**
|
|
1249
|
-
>
|
|
1250
|
-
> Without quotes, the shell will only capture the first word:
|
|
1251
|
-
>
|
|
1252
|
-
> ```bash
|
|
1253
|
-
> # ❌ WRONG - Only captures "advice"
|
|
1254
|
-
> export PRIVATE_KEY_OR_MNEMONIC=advice wrestle recycle yellow light avoid shell mutual ketchup obscure game corn
|
|
1255
|
-
>
|
|
1256
|
-
> # ✅ CORRECT - Captures the entire phrase
|
|
1257
|
-
> export PRIVATE_KEY_OR_MNEMONIC="advice wrestle recycle yellow light avoid shell mutual ketchup obscure game corn"
|
|
1258
|
-
> ```
|
|
1259
|
-
|
|
1260
|
-
## Network Configuration
|
|
1261
|
-
|
|
1262
|
-
### Configuration File
|
|
1263
|
-
|
|
1264
|
-
All network settings are stored in `config.json` in the package directory. You can modify settings using CLI commands or by directly editing the file.
|
|
1265
|
-
|
|
1266
|
-
**Priority:** Command-line args > config file values
|
|
1267
|
-
|
|
1268
|
-
### Configuration Commands
|
|
212
|
+
## Common Pitfalls in Real Workflows
|
|
1269
213
|
|
|
1270
|
-
|
|
1271
|
-
# Show configuration
|
|
1272
|
-
did-cli config show [--network mainnet|sepolia]
|
|
1273
|
-
|
|
1274
|
-
# List all networks
|
|
1275
|
-
did-cli config list
|
|
1276
|
-
|
|
1277
|
-
# Set configuration value (creates network if it doesn't exist)
|
|
1278
|
-
did-cli config set <key> <value> [--network <network>]
|
|
1279
|
-
# Keys: rpc, contractDid, contractRootResolver, contractAbiType,
|
|
1280
|
-
# contractRootResolver2, supportSvcUrl
|
|
1281
|
-
# Default network: mainnet
|
|
1282
|
-
```
|
|
1283
|
-
|
|
1284
|
-
**Examples:**
|
|
214
|
+
- Mnemonic must be quoted:
|
|
1285
215
|
|
|
1286
216
|
```bash
|
|
1287
|
-
|
|
1288
|
-
did-cli config show --network mainnet
|
|
1289
|
-
|
|
1290
|
-
# Update mainnet RPC (default network)
|
|
1291
|
-
did-cli config set rpc https://eth.llamarpc.com
|
|
1292
|
-
|
|
1293
|
-
# Update sepolia contract
|
|
1294
|
-
did-cli config set contractDid 0x1234... --network sepolia
|
|
1295
|
-
|
|
1296
|
-
# Add new network
|
|
1297
|
-
did-cli config set rpc https://my-rpc.com --network custom_net
|
|
1298
|
-
did-cli config set contractDid 0x5678... --network custom_net
|
|
1299
|
-
|
|
1300
|
-
# List all networks
|
|
1301
|
-
did-cli config list
|
|
217
|
+
export PRIVATE_KEY_OR_MNEMONIC="advice wrestle recycle ..."
|
|
1302
218
|
```
|
|
1303
219
|
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
#### Mainnet (Default)
|
|
1307
|
-
|
|
1308
|
-
- RPC: `https://optimism-rpc.publicnode.com`
|
|
1309
|
-
- DID Contract: `0x5DA4Fa8E567d86e52Ef8Da860de1be8f54cae97D`
|
|
1310
|
-
- RootResolver: `0x0223be5559961f9D393b28EFD1dBEdcB2dD67523`
|
|
1311
|
-
- ABI Type: `0x9ae3F16bD99294Af1784beB1a0A5C84bf2636365`
|
|
1312
|
-
- RootResolver2: `0x7e7961aB771cA942CE4DB6e79579e016a33Dc95B`
|
|
1313
|
-
- Support Service: `https://api.olares.com/did/support`
|
|
1314
|
-
|
|
1315
|
-
#### Sepolia Testnet
|
|
1316
|
-
|
|
1317
|
-
- RPC: `https://sepolia.optimism.io`
|
|
1318
|
-
- DID Contract: `0xe2D7c3a9013960E04d4E9F5F9B63fff37eEd97A8`
|
|
1319
|
-
- RootResolver: `0xcB045D9133A4F5ffCe2C98b2C47e951e8c9A0655`
|
|
1320
|
-
- ABI Type: `0x7386fCBae6Ad4CCE1499d9153D99bc950B589718`
|
|
1321
|
-
- RootResolver2: `0xcbC02aa08c77a374eC0D5A0403E108b7573d96e8`
|
|
1322
|
-
- Support Service: `https://api-test.olares.com/did/support`
|
|
1323
|
-
|
|
1324
|
-
## Output Formats
|
|
1325
|
-
|
|
1326
|
-
### Human-Readable (Default)
|
|
1327
|
-
|
|
1328
|
-
```bash
|
|
1329
|
-
$ did-cli info example.olares.com
|
|
1330
|
-
|
|
1331
|
-
📋 Domain Metadata:
|
|
1332
|
-
Name: example.olares.com
|
|
1333
|
-
DID: did:key:z6Mkm...
|
|
1334
|
-
Token ID: 1234567890123456789012345678901234567890
|
|
1335
|
-
Note: Individual:TerminusUser
|
|
1336
|
-
Allow Subdomain: true
|
|
1337
|
-
```
|
|
1338
|
-
|
|
1339
|
-
### JSON Format
|
|
1340
|
-
|
|
1341
|
-
```bash
|
|
1342
|
-
$ did-cli info example.olares.com --json
|
|
1343
|
-
|
|
1344
|
-
{
|
|
1345
|
-
"name": "example.olares.com",
|
|
1346
|
-
"did": "did:key:z6Mkm...",
|
|
1347
|
-
"id": "1234567890123456789012345678901234567890",
|
|
1348
|
-
"note": "Individual:TerminusUser",
|
|
1349
|
-
"allowSubdomain": true
|
|
1350
|
-
}
|
|
1351
|
-
```
|
|
1352
|
-
|
|
1353
|
-
## Examples
|
|
1354
|
-
|
|
1355
|
-
### Complete Workflow: Register and Configure a Domain
|
|
1356
|
-
|
|
1357
|
-
```bash
|
|
1358
|
-
# 1. Set your private key or mnemonic (do this once per session)
|
|
1359
|
-
export PRIVATE_KEY_OR_MNEMONIC=0x1234567890abcdef...
|
|
1360
|
-
# Or use mnemonic
|
|
1361
|
-
export PRIVATE_KEY_OR_MNEMONIC="your twelve word mnemonic phrase here"
|
|
1362
|
-
|
|
1363
|
-
# 2. Check ownership
|
|
1364
|
-
did-cli is-owner example.olares.com
|
|
1365
|
-
|
|
1366
|
-
# 3. Generate RSA key pair
|
|
1367
|
-
did-cli rsa generate --output ./example-key.pem --key-length 2048
|
|
1368
|
-
|
|
1369
|
-
# 4. Set RSA public key
|
|
1370
|
-
did-cli rsa set example.olares.com ./example-key.pem
|
|
1371
|
-
|
|
1372
|
-
# 5. Set IP address
|
|
1373
|
-
did-cli ip set example.olares.com 192.168.1.100
|
|
1374
|
-
|
|
1375
|
-
# 6. Verify configuration
|
|
1376
|
-
did-cli info example.olares.com
|
|
1377
|
-
did-cli rsa get example.olares.com
|
|
1378
|
-
did-cli ip get example.olares.com
|
|
1379
|
-
```
|
|
1380
|
-
|
|
1381
|
-
### Persisting Private Key Across Sessions
|
|
220
|
+
- Array type must be quoted in shell:
|
|
1382
221
|
|
|
1383
222
|
```bash
|
|
1384
|
-
|
|
1385
|
-
echo 'export PRIVATE_KEY_OR_MNEMONIC=0x1234567890abcdef...' >> ~/.bashrc
|
|
1386
|
-
source ~/.bashrc
|
|
1387
|
-
|
|
1388
|
-
# Or use a .env file (recommended for development)
|
|
1389
|
-
echo 'PRIVATE_KEY_OR_MNEMONIC=0x1234567890abcdef...' > .env
|
|
1390
|
-
# Then load it before using CLI
|
|
1391
|
-
export $(cat .env | xargs)
|
|
1392
|
-
|
|
1393
|
-
# Now you can use commands without setting PRIVATE_KEY_OR_MNEMONIC each time
|
|
1394
|
-
did-cli rsa set example.olares.com ./key.pem
|
|
1395
|
-
did-cli ip set example.olares.com 192.168.1.100
|
|
1396
|
-
did-cli operator set 0x5678...
|
|
223
|
+
did-cli tag define olares.com wallets "address[]"
|
|
1397
224
|
```
|
|
1398
225
|
|
|
1399
|
-
|
|
226
|
+
- Array value should be valid JSON string:
|
|
1400
227
|
|
|
1401
228
|
```bash
|
|
1402
|
-
|
|
1403
|
-
for domain in example1.olares.com example2.olares.com; do
|
|
1404
|
-
did-cli info $domain --json >> domains.json
|
|
1405
|
-
done
|
|
1406
|
-
|
|
1407
|
-
# Process JSON output with jq
|
|
1408
|
-
did-cli info example.olares.com --json | jq '.owner'
|
|
229
|
+
did-cli tag set olares.com links '["https://x.com","https://github.com"]'
|
|
1409
230
|
```
|
|
1410
231
|
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
The CLI provides clear error messages for common issues:
|
|
232
|
+
- Cross-domain tag read/write/list must specify `--from`:
|
|
1414
233
|
|
|
1415
234
|
```bash
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
Usage: did-cli info <domain>
|
|
1420
|
-
|
|
1421
|
-
# Invalid IP address
|
|
1422
|
-
$ did-cli ip set example.olares.com invalid-ip
|
|
1423
|
-
❌ Error: Invalid IPv4 address format
|
|
1424
|
-
|
|
1425
|
-
# Missing private key or mnemonic
|
|
1426
|
-
$ did-cli is-owner example.olares.com
|
|
1427
|
-
❌ Error: Private key or mnemonic is required for this operation
|
|
1428
|
-
Please set PRIVATE_KEY_OR_MNEMONIC environment variable
|
|
1429
|
-
Example: export PRIVATE_KEY_OR_MNEMONIC=0xYOUR_PRIVATE_KEY
|
|
1430
|
-
Or: export PRIVATE_KEY_OR_MNEMONIC="your twelve words..."
|
|
235
|
+
did-cli tag set child.parent.com profile "builder" --from parent.com
|
|
236
|
+
did-cli tag get child.parent.com profile --from parent.com
|
|
237
|
+
did-cli tag list child.parent.com --from parent.com
|
|
1431
238
|
```
|
|
1432
239
|
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
### Run from Source
|
|
240
|
+
- For tags defined on root (`""`), use `--from root`:
|
|
1436
241
|
|
|
1437
242
|
```bash
|
|
1438
|
-
|
|
1439
|
-
git clone https://github.com/olares/did-system.git
|
|
1440
|
-
cd did-system/packages/olaresid
|
|
1441
|
-
|
|
1442
|
-
# Install dependencies
|
|
1443
|
-
npm install
|
|
1444
|
-
|
|
1445
|
-
# Run CLI
|
|
1446
|
-
npx ts-node src/cli.ts <command>
|
|
243
|
+
did-cli tag get child.parent.com latestDID --from root
|
|
1447
244
|
```
|
|
1448
245
|
|
|
1449
|
-
|
|
246
|
+
- Use `--network sepolia` for test runs before mainnet writes.
|
|
1450
247
|
|
|
1451
|
-
|
|
1452
|
-
# Enable verbose output
|
|
1453
|
-
did-cli info example.olares.com --verbose
|
|
1454
|
-
|
|
1455
|
-
# Enable debug output with level
|
|
1456
|
-
did-cli info example.olares.com --debug --debug-level debug
|
|
1457
|
-
```
|
|
248
|
+
---
|
|
1458
249
|
|
|
1459
|
-
##
|
|
250
|
+
## Quick Pointers
|
|
1460
251
|
|
|
1461
|
-
|
|
252
|
+
- Full tag concepts and SDK usage: [TAG.md](./TAG.md)
|
|
253
|
+
- Project overview and SDK quick start: [README.md](./README.md)
|
|
254
|
+
- Full command list: run `did-cli --help`
|