Skip to content

Commit 10a9ddd

Browse files
committed
improve specs
1 parent ebbd732 commit 10a9ddd

3 files changed

Lines changed: 97 additions & 56 deletions

File tree

hive/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Registering the `hive` namespace enables:
2222
- Standard CAIP-2 chain identifiers for Hive networks
2323
- Use of CAIP-10 account identifiers for Hive account names
2424
- Interoperability with multichain wallets and tooling
25-
- Deterministic identification of Hive mainnet and testnet
25+
- Deterministic identification of Hive networks (mainnet, mirrornet)
2626

2727
Hive networks expose a protocol-defined `chain_id` used in transaction signing to prevent cross-network replay. This makes Hive suitable for deterministic CAIP-2 identification.
2828

hive/caip10.md

Lines changed: 65 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -43,82 +43,102 @@ Where:
4343

4444
Hive account names MUST:
4545

46-
- Be lowercase
47-
- Be between 3 and 16 characters
48-
- Contain only:
49-
- `a-z`
50-
- `0-9`
51-
- hyphen (`-`)
52-
- Not start or end with a hyphen
53-
- Not contain consecutive hyphens
46+
- Be between 3 and 16 characters in total length
47+
- Start with a lowercase letter (`a-z`)
48+
- Contain only lowercase letters (`a-z`), digits (`0-9`), hyphens (`-`), and dots (`.`)
49+
- Not start or end with a hyphen or dot
50+
- Not contain consecutive hyphens or dots
51+
- If dot-separated, each segment must be at least 3 characters and start with a letter
5452

5553
Regex:
56-
`[a-z0-9]([a-z0-9-]{1,14}[a-z0-9])?`
5754

58-
Examples
59-
Hive Mainnet
55+
```
56+
^(?=.{3,16}$)[a-z]([0-9a-z]|[0-9a-z\-](?=[0-9a-z])){2,}([\.](?=[a-z][0-9a-z\-][0-9a-z\-])[a-z]([0-9a-z]|[0-9a-z\-](?=[0-9a-z])){1,}){0,}$
57+
```
6058

61-
`hive:beeab0de000000000000000000000000:ecency`
62-
`hive:beeab0de000000000000000000000000:good-karma`
59+
### Resolution
6360

64-
Hive Testnet
61+
To validate a Hive CAIP-10 identifier:
6562

66-
`hive:4200000000000000000000000000000:testuser`
63+
1. Parse the namespace (`hive`).
64+
2. Validate the CAIP-2 reference according to the Hive CAIP-2 profile.
65+
3. Validate the account name against Hive naming rules.
66+
4. Query a Hive RPC endpoint to confirm account existence.
6767

68-
Resolution
68+
Account existence may be verified via:
6969

70-
To validate a Hive CAIP-10 identifier:
70+
- `condenser_api.get_accounts`
71+
- `database_api.find_accounts`
7172

72-
Parse the namespace (hive)
73+
#### Example Request
7374

74-
Validate the CAIP-2 reference according to the Hive CAIP-2 profile
75+
```json
76+
{
77+
"jsonrpc": "2.0",
78+
"method": "condenser_api.get_accounts",
79+
"params": [["ecency"]],
80+
"id": 1
81+
}
82+
```
7583

76-
Validate the account name against Hive naming rules
84+
## Examples
7785

78-
Query a Hive RPC endpoint to confirm account existence
86+
### Hive Mainnet
7987

80-
Account existence may be verified via:
88+
```
89+
hive:beeab0de000000000000000000000000:ecency
90+
hive:beeab0de000000000000000000000000:good-karma
91+
hive:beeab0de000000000000000000000000:hive.fund
92+
hive:beeab0de000000000000000000000000:v4vapp.dhf
93+
```
8194

82-
`condenser_api.get_accounts`
95+
### Hive Mirrornet
8396

84-
`database_api.find_accounts`
97+
```
98+
hive:42000000000000000000000000000000:testuser
99+
```
85100

86-
Security Considerations
101+
## Security Considerations
87102

88-
Hive account names are human-readable and may be subject to phishing using visually similar names.
103+
Hive account names are human-readable and may be subject to phishing using visually similar names (e.g., `ecency` vs `ecency-fake`).
89104

90105
Applications SHOULD:
91106

92-
Validate account existence before processing transactions
93-
94-
Display full CAIP-10 identifiers when clarity is required
95-
96-
Not assume account ownership without authority verification
107+
- Validate account existence before processing transactions
108+
- Display full CAIP-10 identifiers when clarity is required
109+
- Not assume account ownership without authority verification
97110

98111
Because Hive supports multiple authorities (owner, active, posting), CAIP-10 identifiers represent accounts, not individual keys.
99112

100-
Test Cases
113+
## Test Cases
101114

102115
Valid:
103116

104-
`hive:beeab0de000000000000000000000000:ecency`
105-
`hive:beeab0de000000000000000000000000:username`
106-
`hive:4200000000000000000000000000000:test-account`
117+
```
118+
hive:beeab0de000000000000000000000000:ecency
119+
hive:beeab0de000000000000000000000000:good-karma
120+
hive:beeab0de000000000000000000000000:hive.fund
121+
hive:beeab0de000000000000000000000000:gtg
122+
hive:42000000000000000000000000000000:test-account
123+
```
107124

108125
Invalid:
109126

110-
`hive:beeab0de000000000000000000000000:UpperCase`
111-
`hive:beeab0de000000000000000000000000:ab`
112-
`hive:beeab0de000000000000000000000000:-invalid`
127+
```
128+
hive:beeab0de000000000000000000000000:UpperCase
129+
hive:beeab0de000000000000000000000000:ab
130+
hive:beeab0de000000000000000000000000:-invalid
131+
hive:beeab0de000000000000000000000000:3digits
132+
hive:beeab0de000000000000000000000000:has..double
133+
```
113134

114-
References
135+
## References
115136

116-
Hive configuration and account rules:
117-
https://developers.hive.io/tutorials-recipes/understanding-configuration-values.html
118-
119-
CAIP-10 specification:
120-
https://chainagnostic.org/CAIPs/caip-10
137+
- Hive configuration and account rules:
138+
https://developers.hive.io/tutorials-recipes/understanding-configuration-values.html
139+
- CAIP-10 specification:
140+
https://chainagnostic.org/CAIPs/caip-10
121141

122-
Copyright
142+
## Copyright
123143

124144
Copyright and related rights waived via CC0 1.0.

hive/caip2.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Hive defines a 32-byte (`64` hex characters) `chain_id` value used for transacti
2020

2121
Because CAIP-2 restricts the `reference` field to a maximum of 32 characters, this specification defines the `reference` as:
2222

23-
> The first 32 lowercase hexadecimal characters of Hives `chain_id`.
23+
> The first 32 lowercase hexadecimal characters of Hive's `chain_id`.
2424
2525
This approach ensures:
2626

@@ -40,17 +40,35 @@ This approach ensures:
4040
The `reference` MUST:
4141

4242
- Be lowercase hexadecimal
43-
- Match the pattern: [0-9a-f]{32}
43+
- Match the pattern: `[0-9a-f]{32}`
4444

4545
### Resolution
4646

4747
To derive a valid CAIP-2 identifier:
4848

49-
1. Query a Hive node configuration.
50-
2. Retrieve the `chain_id` value.
49+
1. Query a Hive node using `database_api.get_config`.
50+
2. Retrieve the `HIVE_CHAIN_ID` value from the response.
5151
3. Convert to lowercase.
5252
4. Truncate to the first 32 hexadecimal characters.
5353

54+
#### Example Request
55+
56+
```json
57+
{
58+
"jsonrpc": "2.0",
59+
"method": "database_api.get_config",
60+
"id": 1
61+
}
62+
```
63+
64+
#### Example Response (partial)
65+
66+
```json
67+
{
68+
"HIVE_CHAIN_ID": "beeab0de00000000000000000000000000000000000000000000000000000000"
69+
}
70+
```
71+
5472
## Known Networks (Non-Normative Examples)
5573

5674
### Hive Mainnet
@@ -60,11 +78,12 @@ CAIP-2: `hive:beeab0de000000000000000000000000`
6078

6179
---
6280

63-
### Hive Testnet
81+
### Hive Mirrornet
6482

6583
Full chain_id: `42`
66-
CAIP-2: `42000000000000000000000000000000`
84+
CAIP-2: `hive:42000000000000000000000000000000` (zero-padded to 32 hex characters)
6785

86+
> **Note:** The mirrornet is a periodic snapshot of mainnet used for testing. There is no permanent public testnet at this time; mirrornet instances are ephemeral.
6887
6988
## Security Considerations
7089

@@ -74,16 +93,18 @@ Hive uses account-based identity rather than address-based identity. Application
7493

7594
## Test Cases
7695

96+
```
7797
hive:beeab0de000000000000000000000000
7898
hive:42000000000000000000000000000000
79-
99+
```
80100

81101
## References
82102

83-
Hive configuration documentation:
84-
https://developers.hive.io/tutorials-recipes/understanding-configuration-values.html
103+
- Hive configuration documentation:
104+
https://developers.hive.io/tutorials-recipes/understanding-configuration-values.html
105+
- CAIP-2 specification:
106+
https://chainagnostic.org/CAIPs/caip-2
85107

86108
## Copyright
87109

88110
Copyright and related rights waived via CC0 1.0.
89-

0 commit comments

Comments
 (0)