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