blue-js-sdk 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/CHANGELOG.md +446 -0
  2. package/LICENSE +21 -0
  3. package/README.md +75 -0
  4. package/ai-path/ADMIN-ELEVATION.md +116 -0
  5. package/ai-path/AI-MANIFESTO.md +185 -0
  6. package/ai-path/BREAKING.md +74 -0
  7. package/ai-path/CHECKLIST.md +619 -0
  8. package/ai-path/CONNECTION-STEPS.md +724 -0
  9. package/ai-path/DECISION-TREE.md +378 -0
  10. package/ai-path/DEPENDENCIES.md +459 -0
  11. package/ai-path/E2E-FLOW.md +1555 -0
  12. package/ai-path/FAILURES.md +403 -0
  13. package/ai-path/GUIDE.md +1217 -0
  14. package/ai-path/README.md +558 -0
  15. package/ai-path/SPLIT-TUNNEL.md +266 -0
  16. package/ai-path/cli.js +535 -0
  17. package/ai-path/connect.js +884 -0
  18. package/ai-path/discover.js +178 -0
  19. package/ai-path/environment.js +266 -0
  20. package/ai-path/errors.js +86 -0
  21. package/ai-path/examples/autonomous-agent.mjs +220 -0
  22. package/ai-path/examples/multi-region.mjs +174 -0
  23. package/ai-path/examples/one-shot.mjs +31 -0
  24. package/ai-path/index.js +60 -0
  25. package/ai-path/pricing.js +136 -0
  26. package/ai-path/recommend.js +413 -0
  27. package/ai-path/run-admin.vbs +25 -0
  28. package/ai-path/setup.js +291 -0
  29. package/ai-path/wallet.js +137 -0
  30. package/app-helpers.js +363 -0
  31. package/app-settings.js +95 -0
  32. package/app-types.js +267 -0
  33. package/audit.js +847 -0
  34. package/batch.js +293 -0
  35. package/bin/setup.js +376 -0
  36. package/chain/authz.js +109 -0
  37. package/chain/broadcast.js +472 -0
  38. package/chain/client.js +160 -0
  39. package/chain/fee-grants.js +305 -0
  40. package/chain/index.js +891 -0
  41. package/chain/lcd.js +313 -0
  42. package/chain/queries.js +547 -0
  43. package/chain/rpc.js +408 -0
  44. package/chain/wallet.js +141 -0
  45. package/cli/config.js +143 -0
  46. package/cli/index.js +463 -0
  47. package/cli/output.js +182 -0
  48. package/cli.js +491 -0
  49. package/client/index.js +251 -0
  50. package/client.js +271 -0
  51. package/config/index.js +255 -0
  52. package/connection/connect.js +849 -0
  53. package/connection/disconnect.js +180 -0
  54. package/connection/discovery.js +321 -0
  55. package/connection/index.js +76 -0
  56. package/connection/proxy.js +148 -0
  57. package/connection/resilience.js +428 -0
  58. package/connection/security.js +232 -0
  59. package/connection/state.js +369 -0
  60. package/connection/tunnel.js +691 -0
  61. package/consumer.js +132 -0
  62. package/cosmjs-setup.js +1884 -0
  63. package/defaults.js +366 -0
  64. package/disk-cache.js +107 -0
  65. package/dist/client.d.ts +108 -0
  66. package/dist/client.d.ts.map +1 -0
  67. package/dist/client.js +400 -0
  68. package/dist/client.js.map +1 -0
  69. package/dist/index.d.ts +8 -0
  70. package/dist/index.d.ts.map +1 -0
  71. package/dist/index.js +8 -0
  72. package/dist/index.js.map +1 -0
  73. package/errors/index.js +112 -0
  74. package/errors.js +218 -0
  75. package/examples/README.md +64 -0
  76. package/examples/connect-direct.mjs +106 -0
  77. package/examples/connect-plan.mjs +125 -0
  78. package/examples/error-handling.mjs +109 -0
  79. package/examples/query-nodes.mjs +94 -0
  80. package/examples/wallet-basics.mjs +61 -0
  81. package/generated/amino/amino.ts +9 -0
  82. package/generated/cosmos/base/v1beta1/coin.ts +365 -0
  83. package/generated/cosmos_proto/cosmos.ts +323 -0
  84. package/generated/gogoproto/gogo.ts +9 -0
  85. package/generated/google/protobuf/descriptor.ts +7601 -0
  86. package/generated/google/protobuf/duration.ts +208 -0
  87. package/generated/google/protobuf/timestamp.ts +238 -0
  88. package/generated/sentinel/lease/v1/events.ts +924 -0
  89. package/generated/sentinel/lease/v1/lease.ts +292 -0
  90. package/generated/sentinel/lease/v1/msg.ts +949 -0
  91. package/generated/sentinel/lease/v1/params.ts +164 -0
  92. package/generated/sentinel/node/v3/events.ts +881 -0
  93. package/generated/sentinel/node/v3/msg.ts +1002 -0
  94. package/generated/sentinel/node/v3/node.ts +263 -0
  95. package/generated/sentinel/node/v3/params.ts +183 -0
  96. package/generated/sentinel/plan/v3/events.ts +675 -0
  97. package/generated/sentinel/plan/v3/msg.ts +1191 -0
  98. package/generated/sentinel/plan/v3/plan.ts +283 -0
  99. package/generated/sentinel/provider/v2/events.ts +171 -0
  100. package/generated/sentinel/provider/v2/msg.ts +480 -0
  101. package/generated/sentinel/provider/v2/params.ts +131 -0
  102. package/generated/sentinel/provider/v2/provider.ts +246 -0
  103. package/generated/sentinel/session/v3/events.ts +480 -0
  104. package/generated/sentinel/session/v3/msg.ts +616 -0
  105. package/generated/sentinel/session/v3/params.ts +260 -0
  106. package/generated/sentinel/session/v3/proof.ts +180 -0
  107. package/generated/sentinel/session/v3/session.ts +384 -0
  108. package/generated/sentinel/subscription/v3/events.ts +1181 -0
  109. package/generated/sentinel/subscription/v3/msg.ts +1305 -0
  110. package/generated/sentinel/subscription/v3/params.ts +167 -0
  111. package/generated/sentinel/subscription/v3/subscription.ts +315 -0
  112. package/generated/sentinel/types/v1/bandwidth.ts +124 -0
  113. package/generated/sentinel/types/v1/price.ts +149 -0
  114. package/generated/sentinel/types/v1/renewal.ts +87 -0
  115. package/generated/sentinel/types/v1/status.ts +54 -0
  116. package/generated/typeRegistry.ts +27 -0
  117. package/index.js +486 -0
  118. package/node-connect.js +3015 -0
  119. package/operator.js +134 -0
  120. package/package.json +113 -0
  121. package/plan-operations.js +199 -0
  122. package/preflight.js +352 -0
  123. package/pricing/index.js +262 -0
  124. package/proto/amino/amino.proto +84 -0
  125. package/proto/cosmos/base/v1beta1/coin.proto +61 -0
  126. package/proto/cosmos_proto/cosmos.proto +112 -0
  127. package/proto/gogoproto/gogo.proto +145 -0
  128. package/proto/google/api/annotations.proto +31 -0
  129. package/proto/google/api/http.proto +370 -0
  130. package/proto/google/protobuf/any.proto +106 -0
  131. package/proto/google/protobuf/duration.proto +115 -0
  132. package/proto/google/protobuf/timestamp.proto +145 -0
  133. package/proto/sentinel/lease/v1/events.proto +52 -0
  134. package/proto/sentinel/lease/v1/genesis.proto +15 -0
  135. package/proto/sentinel/lease/v1/lease.proto +25 -0
  136. package/proto/sentinel/lease/v1/msg.proto +62 -0
  137. package/proto/sentinel/lease/v1/params.proto +17 -0
  138. package/proto/sentinel/node/v3/events.proto +50 -0
  139. package/proto/sentinel/node/v3/genesis.proto +15 -0
  140. package/proto/sentinel/node/v3/msg.proto +63 -0
  141. package/proto/sentinel/node/v3/node.proto +27 -0
  142. package/proto/sentinel/node/v3/params.proto +21 -0
  143. package/proto/sentinel/node/v3/querier.proto +63 -0
  144. package/proto/sentinel/plan/v3/events.proto +41 -0
  145. package/proto/sentinel/plan/v3/genesis.proto +21 -0
  146. package/proto/sentinel/plan/v3/msg.proto +83 -0
  147. package/proto/sentinel/plan/v3/plan.proto +32 -0
  148. package/proto/sentinel/plan/v3/querier.proto +53 -0
  149. package/proto/sentinel/provider/v2/events.proto +16 -0
  150. package/proto/sentinel/provider/v2/genesis.proto +15 -0
  151. package/proto/sentinel/provider/v2/msg.proto +35 -0
  152. package/proto/sentinel/provider/v2/params.proto +17 -0
  153. package/proto/sentinel/provider/v2/provider.proto +24 -0
  154. package/proto/sentinel/provider/v3/genesis.proto +15 -0
  155. package/proto/sentinel/provider/v3/params.proto +13 -0
  156. package/proto/sentinel/session/v3/events.proto +30 -0
  157. package/proto/sentinel/session/v3/genesis.proto +15 -0
  158. package/proto/sentinel/session/v3/msg.proto +50 -0
  159. package/proto/sentinel/session/v3/params.proto +25 -0
  160. package/proto/sentinel/session/v3/proof.proto +25 -0
  161. package/proto/sentinel/session/v3/querier.proto +100 -0
  162. package/proto/sentinel/session/v3/session.proto +50 -0
  163. package/proto/sentinel/subscription/v2/allocation.proto +21 -0
  164. package/proto/sentinel/subscription/v2/payout.proto +22 -0
  165. package/proto/sentinel/subscription/v3/events.proto +65 -0
  166. package/proto/sentinel/subscription/v3/genesis.proto +17 -0
  167. package/proto/sentinel/subscription/v3/msg.proto +83 -0
  168. package/proto/sentinel/subscription/v3/params.proto +21 -0
  169. package/proto/sentinel/subscription/v3/subscription.proto +33 -0
  170. package/proto/sentinel/types/v1/bandwidth.proto +19 -0
  171. package/proto/sentinel/types/v1/price.proto +21 -0
  172. package/proto/sentinel/types/v1/renewal.proto +21 -0
  173. package/proto/sentinel/types/v1/status.proto +16 -0
  174. package/protocol/encoding.js +341 -0
  175. package/protocol/events.js +361 -0
  176. package/protocol/handshake.js +297 -0
  177. package/protocol/index.js +15 -0
  178. package/protocol/messages.js +346 -0
  179. package/protocol/plans.js +199 -0
  180. package/protocol/v2ray.js +268 -0
  181. package/protocol/v3.js +723 -0
  182. package/protocol/wireguard.js +125 -0
  183. package/security/index.js +132 -0
  184. package/session-manager.js +329 -0
  185. package/session-tracker.js +80 -0
  186. package/setup.js +376 -0
  187. package/speedtest/index.js +528 -0
  188. package/speedtest.js +567 -0
  189. package/src/client.ts +502 -0
  190. package/src/index.ts +20 -0
  191. package/state/index.js +347 -0
  192. package/state.js +516 -0
  193. package/test-all-chain-ops.js +493 -0
  194. package/test-all-logic.js +199 -0
  195. package/test-all-msg-types.js +292 -0
  196. package/test-every-connection.js +208 -0
  197. package/test-feegrant-connect.js +98 -0
  198. package/test-logic.js +148 -0
  199. package/test-mainnet.js +176 -0
  200. package/test-plan-lifecycle.js +335 -0
  201. package/tls-trust.js +132 -0
  202. package/tsconfig.build.json +20 -0
  203. package/tsconfig.json +34 -0
  204. package/types/chain.d.ts +746 -0
  205. package/types/connection.d.ts +425 -0
  206. package/types/errors.d.ts +174 -0
  207. package/types/index.d.ts +1380 -0
  208. package/types/nodes.d.ts +187 -0
  209. package/types/pricing.d.ts +156 -0
  210. package/types/protocol.d.ts +332 -0
  211. package/types/session.d.ts +236 -0
  212. package/types/settings.d.ts +192 -0
  213. package/v3protocol.js +1053 -0
  214. package/wallet/index.js +153 -0
  215. package/wireguard.js +307 -0
@@ -0,0 +1,459 @@
1
+ # Sentinel SDK Dependencies
2
+
3
+ > Complete dependency reference for the Sentinel dVPN SDK.
4
+ > Every dependency listed with: what it is, why it's needed, exact version, what breaks if wrong, how to install, how to verify.
5
+
6
+ ---
7
+
8
+ ## Runtime Environment
9
+
10
+ ### Node.js
11
+
12
+ | Property | Value |
13
+ |----------|-------|
14
+ | **What** | JavaScript runtime |
15
+ | **Why** | The JS SDK is ES Module-based; requires Node.js 20+ for native fetch, AbortController, and stable ES module support |
16
+ | **Exact version** | `>=20.0.0` (specified in `package.json` `engines`) |
17
+ | **What breaks if wrong** | Node 18: `fetch` adapter issues with axios on self-signed certs. Node 16: no top-level await, no AbortController, ES module bugs. |
18
+ | **Install** | https://nodejs.org/ -- download LTS (20.x or 22.x) |
19
+ | **Verify** | `node --version` -- must show v20.x.x or higher |
20
+
21
+ ### .NET 8.0 SDK (C# only)
22
+
23
+ | Property | Value |
24
+ |----------|-------|
25
+ | **What** | .NET runtime and build tools |
26
+ | **Why** | The C# SDK targets .NET 8.0 for WPF desktop apps |
27
+ | **Exact version** | .NET 8.0 SDK |
28
+ | **What breaks if wrong** | .NET 6/7: Missing APIs used by the SDK. .NET 9: untested, may have breaking changes. |
29
+ | **Install** | https://dotnet.microsoft.com/download/dotnet/8.0 |
30
+ | **Verify** | `dotnet --version` -- must show 8.0.x |
31
+
32
+ ---
33
+
34
+ ## npm Packages (JS SDK)
35
+
36
+ ### @cosmjs/stargate
37
+
38
+ | Property | Value |
39
+ |----------|-------|
40
+ | **What** | Cosmos SDK client library for signing and broadcasting transactions |
41
+ | **Why** | Core chain interaction: wallet creation, message signing, transaction broadcast, RPC queries |
42
+ | **Exact version** | `^0.32.2` |
43
+ | **What breaks if wrong** | 0.31.x: Different `SigningStargateClient` API, missing gas estimation features. 0.33+: untested, may have breaking changes to registry or signing. |
44
+ | **Install** | `npm install @cosmjs/stargate@^0.32.2` |
45
+ | **Verify** | `node -e "import('@cosmjs/stargate').then(m => console.log('OK:', Object.keys(m).length, 'exports'))"` |
46
+
47
+ ### @cosmjs/amino
48
+
49
+ | Property | Value |
50
+ |----------|-------|
51
+ | **What** | Cosmos Amino encoding for legacy message signing |
52
+ | **Why** | Some Sentinel message types use Amino encoding; required by `@cosmjs/stargate` |
53
+ | **Exact version** | `^0.32.2` (must match stargate version) |
54
+ | **What breaks if wrong** | Version mismatch with stargate causes cryptic encoding errors on TX broadcast |
55
+ | **Install** | `npm install @cosmjs/amino@^0.32.2` |
56
+ | **Verify** | Installed automatically with stargate; verify same version in `package-lock.json` |
57
+
58
+ ### @cosmjs/crypto
59
+
60
+ | Property | Value |
61
+ |----------|-------|
62
+ | **What** | Cryptographic primitives (SHA256, secp256k1, Ripemd160) |
63
+ | **Why** | Wallet key derivation (BIP39/BIP44), handshake signature (secp256k1 sign of session ID), address generation |
64
+ | **Exact version** | `^0.32.2` (must match stargate version) |
65
+ | **What breaks if wrong** | Signature format changes break handshake; key derivation changes break wallet address |
66
+ | **Install** | `npm install @cosmjs/crypto@^0.32.2` |
67
+ | **Verify** | `node -e "import('@cosmjs/crypto').then(m => console.log('Secp256k1:', typeof m.Secp256k1))"` |
68
+
69
+ ### @cosmjs/encoding
70
+
71
+ | Property | Value |
72
+ |----------|-------|
73
+ | **What** | Encoding utilities (Bech32, Base64, hex) |
74
+ | **Why** | Bech32 address encoding (`sent1...`, `sentnode1...`), Base64 for handshake signatures and keys |
75
+ | **Exact version** | `^0.32.2` (must match stargate version) |
76
+ | **What breaks if wrong** | Address encoding changes break all chain queries |
77
+ | **Install** | `npm install @cosmjs/encoding@^0.32.2` |
78
+ | **Verify** | `node -e "import('@cosmjs/encoding').then(m => console.log('Bech32:', typeof m.Bech32))"` |
79
+
80
+ ### @cosmjs/proto-signing
81
+
82
+ | Property | Value |
83
+ |----------|-------|
84
+ | **What** | Protobuf message signing and registry |
85
+ | **Why** | Registering Sentinel-specific message types (MsgStartSession, MsgEndSession, etc.) in the CosmJS Registry |
86
+ | **Exact version** | `^0.32.2` (must match stargate version) |
87
+ | **What breaks if wrong** | Unregistered message types silently fail on broadcast; sessions never start or end |
88
+ | **Install** | `npm install @cosmjs/proto-signing@^0.32.2` |
89
+ | **Verify** | `node -e "import('@cosmjs/proto-signing').then(m => console.log('Registry:', typeof m.Registry))"` |
90
+
91
+ **CRITICAL:** All 5 `@cosmjs/*` packages must be the SAME version. Mixed versions cause encoding mismatches and cryptic failures.
92
+
93
+ ### @noble/curves
94
+
95
+ | Property | Value |
96
+ |----------|-------|
97
+ | **What** | Elliptic curve cryptography (secp256k1, x25519) |
98
+ | **Why** | X25519 key generation for WireGuard handshake; secp256k1 for handshake signature computation |
99
+ | **Exact version** | `^2.0.1` |
100
+ | **What breaks if wrong** | 1.x: Different API (no `x25519.utils`). Key generation fails silently or produces wrong keys. |
101
+ | **Install** | `npm install @noble/curves@^2.0.1` |
102
+ | **Verify** | `node -e "import('@noble/curves/ed25519').then(m => console.log('x25519:', typeof m.x25519))"` |
103
+
104
+ ### axios
105
+
106
+ | Property | Value |
107
+ |----------|-------|
108
+ | **What** | HTTP client library |
109
+ | **Why** | All HTTP requests to Sentinel nodes (handshake, status), LCD queries, speed tests. SOCKS5 proxy support via agents. |
110
+ | **Exact version** | `^1.6.8` |
111
+ | **What breaks if wrong** | <1.0: Missing `adapter` config. Node.js 18+ uses fetch adapter by default; self-signed certs fail without `adapter: 'http'`. |
112
+ | **Install** | `npm install axios@^1.6.8` |
113
+ | **Verify** | `node -e "import('axios').then(m => console.log('axios:', m.default.VERSION))"` |
114
+
115
+ **CRITICAL:** Must set `axios.defaults.adapter = 'http'` at startup. Node.js 18+ defaults to `fetch` adapter which cannot handle self-signed certificates used by Sentinel nodes. Without this, every node HTTPS request fails with opaque "fetch failed" error.
116
+
117
+ ### dotenv
118
+
119
+ | Property | Value |
120
+ |----------|-------|
121
+ | **What** | Environment variable loader from `.env` files |
122
+ | **Why** | Loading mnemonic, RPC/LCD URLs, and configuration from `.env` without hardcoding secrets |
123
+ | **Exact version** | `^16.6.1` |
124
+ | **What breaks if wrong** | Older versions: Missing `dotenv/config` import path. Not critical -- any v16+ works. |
125
+ | **Install** | `npm install dotenv@^16.6.1` |
126
+ | **Verify** | Create `.env` with `TEST=hello`, run `node -e "import('dotenv/config'); console.log(process.env.TEST)"` |
127
+
128
+ ### socks-proxy-agent
129
+
130
+ | Property | Value |
131
+ |----------|-------|
132
+ | **What** | SOCKS5 proxy agent for HTTP clients |
133
+ | **Why** | Speed testing through V2Ray SOCKS5 tunnel; verifying tunnel connectivity |
134
+ | **Exact version** | `^8.0.4` |
135
+ | **What breaks if wrong** | <8.0: Different API; `new SocksProxyAgent()` constructor changes. Native `fetch` silently ignores this agent -- must use axios. |
136
+ | **Install** | `npm install socks-proxy-agent@^8.0.4` |
137
+ | **Verify** | `node -e "import('socks-proxy-agent').then(m => console.log('SocksProxyAgent:', typeof m.SocksProxyAgent))"` |
138
+
139
+ **CRITICAL:** JavaScript native `fetch()` silently ignores SOCKS proxy agents. All SOCKS5 speed tests MUST use axios with `adapter: 'http'`. Using `fetch` through a SOCKS5 proxy appears to work but bypasses the proxy entirely.
140
+
141
+ ---
142
+
143
+ ## External Binaries
144
+
145
+ ### WireGuard
146
+
147
+ | Property | Value |
148
+ |----------|-------|
149
+ | **What** | VPN tunnel implementation using Noise protocol |
150
+ | **Why** | Primary tunnel type for Sentinel dVPN; ~380 nodes are WireGuard, 100% success rate when reachable |
151
+ | **Exact version** | Any recent version; tested with v0.5.3 (Windows Dec 2021) |
152
+ | **What breaks if wrong** | WireGuard is backwards-compatible; version rarely matters. The SDK uses `/installtunnelservice` and `/uninstalltunnelservice` CLI commands which are stable. |
153
+ | **Install (Windows)** | Download from https://www.wireguard.com/install/ -- MSI installer |
154
+ | **Install (macOS)** | `brew install wireguard-tools` or App Store |
155
+ | **Install (Linux)** | `sudo apt install wireguard-tools` or `yum install wireguard-tools` |
156
+ | **Verify** | `"C:\Program Files\WireGuard\wireguard.exe" /help` (Windows) or `wg --version` (macOS/Linux) |
157
+ | **Default path (Windows)** | `C:\Program Files\WireGuard\wireguard.exe` |
158
+ | **Default path (macOS/Linux)** | `/usr/bin/wg-quick` or `/usr/local/bin/wg-quick` |
159
+
160
+ **CRITICAL REQUIREMENTS:**
161
+ - **Windows: Administrator privileges REQUIRED.** WireGuard installs a Windows service (`WireGuardTunnel$wgsent0`) which requires SYSTEM-level access. Without admin, tunnel install silently fails. Check admin BEFORE paying for a session.
162
+ - **Never call `/installmanagerservice`** -- this launches the WireGuard GUI and takes over all tunnel management. Only use `/installtunnelservice` and `/uninstalltunnelservice`.
163
+ - **Use `execFileSync`, never `execSync` with string interpolation** -- prevents command injection and Git Bash path mangling.
164
+ - **Config file must remain on disk while service exists** -- the Windows service reads `wgsent0.conf` at startup; deleting it causes "file not found" crash.
165
+
166
+ ### V2Ray
167
+
168
+ | Property | Value |
169
+ |----------|-------|
170
+ | **What** | Multi-protocol proxy platform (VMess, VLess, gRPC, WebSocket, etc.) |
171
+ | **Why** | Secondary tunnel type for Sentinel dVPN; ~407 nodes are V2Ray. Supports multiple transport protocols. |
172
+ | **Exact version** | **v5.2.1 ONLY** |
173
+ | **What breaks if wrong** | v5.44.1+: Observatory module has bugs that mark working outbounds as dead; connection success rate drops drastically. v4.x: Different config format entirely. v5.3-5.43: untested, may or may not work. **The SDK will silently use a wrong version if it finds one on PATH.** |
174
+ | **Install** | SDK's `setup.js` auto-downloads v5.2.1 to `~/.sentinel-sdk/bin/v2ray.exe`. Run `npm run setup` or `node setup.js`. |
175
+ | **Verify** | `~/.sentinel-sdk/bin/v2ray.exe version` -- must show `V2Ray 5.2.1` |
176
+ | **Binary location** | `~/.sentinel-sdk/bin/v2ray.exe` (Windows), `~/.sentinel-sdk/bin/v2ray` (macOS/Linux) |
177
+
178
+ **CRITICAL REQUIREMENTS:**
179
+ - **Exactly v5.2.1.** No newer, no older. The observatory module in 5.44.1+ has confirmed bugs.
180
+ - **Do not rely on system-wide V2Ray.** The SDK should use its own copy at `~/.sentinel-sdk/bin/`.
181
+ - **Two companion data files required:** `geoip.dat` and `geosite.dat` must be in the same directory as the binary.
182
+ - **SOCKS5 inbound configuration:** When using `systemProxy: true`, SOCKS5 auth must be set to `noauth` because Windows system proxy cannot pass credentials.
183
+ - **Port selection:** Use `10800 + Math.floor(Math.random() * 1000)` for SOCKS5 port. Increment for fallback outbounds to avoid TIME_WAIT conflicts.
184
+
185
+ ### GeoIP and GeoSite Data
186
+
187
+ | Property | Value |
188
+ |----------|-------|
189
+ | **What** | IP geolocation and domain categorization databases for V2Ray routing |
190
+ | **Why** | V2Ray uses these for routing decisions; required at startup |
191
+ | **Exact version** | Any recent version; bundled with V2Ray download |
192
+ | **What breaks if wrong** | V2Ray fails to start with "geoip.dat not found" error |
193
+ | **Install** | Automatically downloaded by `setup.js` alongside V2Ray binary |
194
+ | **Verify** | Check files exist in V2Ray binary directory |
195
+
196
+ ---
197
+
198
+ ## OS Requirements
199
+
200
+ ### Windows
201
+
202
+ | Requirement | Details |
203
+ |-------------|---------|
204
+ | **Windows 10/11** | WireGuard requires Windows 10 1607+ for Wintun driver support |
205
+ | **Administrator privileges** | Required for WireGuard service install, kill switch firewall rules, DNS leak prevention |
206
+ | **PowerShell** | Required for VPN conflict detection, adapter cleanup, diagnostic commands |
207
+ | **Windows Firewall** | Must be running for kill switch functionality (`netsh advfirewall`) |
208
+ | **.NET 8.0 Runtime** | Required for C# SDK only; installed with SDK or separately |
209
+
210
+ ### macOS
211
+
212
+ | Requirement | Details |
213
+ |-------------|---------|
214
+ | **macOS 12+** | Required for modern WireGuard kernel extension support |
215
+ | **Root access** | Required for `wg-quick up/down` and `networksetup` proxy configuration |
216
+ | **wireguard-tools** | Install via `brew install wireguard-tools` |
217
+
218
+ ### Linux
219
+
220
+ | Requirement | Details |
221
+ |-------------|---------|
222
+ | **Kernel 5.6+** | WireGuard built into kernel since 5.6; older kernels need `wireguard-dkms` |
223
+ | **Root access** | Required for `wg-quick` and `gsettings` proxy configuration |
224
+ | **wireguard-tools** | Install via package manager |
225
+
226
+ ---
227
+
228
+ ## Sentinel Chain Infrastructure
229
+
230
+ ### LCD (Light Client Daemon) Endpoints
231
+
232
+ | Property | Value |
233
+ |----------|-------|
234
+ | **What** | REST API for querying chain state (nodes, subscriptions, sessions, balances) |
235
+ | **Why** | All chain queries: node discovery, subscription lookup, session status, balance check |
236
+ | **Primary** | `https://lcd.sentinel.co` |
237
+ | **Failover 1** | `https://api.sentinel.quokkastake.io` |
238
+ | **Failover 2** | `https://sentinel-api.polkachu.com` |
239
+ | **Failover 3** | `https://sentinel.api.trivium.network:1317` |
240
+ | **What breaks** | All LCD endpoints down = no node queries, no subscriptions, no chain interaction |
241
+ | **Verify** | `curl https://lcd.sentinel.co/sentinel/node/v3/nodes?status=1&pagination.limit=1` |
242
+
243
+ **CRITICAL:** All paths must use v3 format EXCEPT provider which is v2:
244
+ - Nodes: `/sentinel/node/v3/nodes?status=1`
245
+ - Sessions: `/sentinel/session/v3/accounts/{addr}/sessions`
246
+ - Subscriptions: `/sentinel/subscription/v3/accounts/{addr}/subscriptions`
247
+ - Plans: `/sentinel/node/v3/plans/{id}/nodes`
248
+ - Provider: `/sentinel/provider/v2/providers/{addr}` (v2 only!)
249
+
250
+ ### RPC Endpoints
251
+
252
+ | Property | Value |
253
+ |----------|-------|
254
+ | **What** | Tendermint RPC for transaction broadcast and block queries |
255
+ | **Why** | Signing and broadcasting transactions (session creation, subscription, etc.) |
256
+ | **Primary** | `https://rpc.sentinel.co` |
257
+ | **Failover 1** | `https://rpc.sentinel.quokkastake.io` |
258
+ | **Failover 2** | `https://sentinel-rpc.polkachu.com` |
259
+ | **What breaks** | All RPC endpoints down = no transactions, no connections |
260
+ | **Verify** | `curl https://rpc.sentinel.co/status` |
261
+
262
+ ### Chain Parameters
263
+
264
+ | Parameter | Value |
265
+ |-----------|-------|
266
+ | **Chain ID** | `sentinelhub-2` |
267
+ | **Denom** | `udvpn` (micro-DVPN; 1 P2P = 1,000,000 udvpn) |
268
+ | **Display token** | P2P (not DVPN, not dvpn) |
269
+ | **Gas price** | `0.2udvpn` |
270
+ | **Address prefix** | `sent1...` (wallet), `sentnode1...` (node), `sentprov1...` (provider) |
271
+ | **Key algorithm** | secp256k1 (same as Cosmos Hub, Ethereum) |
272
+ | **HD path** | `m/44'/118'/0'/0/0` (Cosmos standard) |
273
+
274
+ ---
275
+
276
+ ## Protocol Specifications
277
+
278
+ ### V3 Handshake
279
+
280
+ | Property | Value |
281
+ |----------|-------|
282
+ | **Method** | `POST /` to node's remote URL |
283
+ | **Content-Type** | `application/json` |
284
+ | **TLS** | Self-signed certificates; use TOFU model |
285
+ | **Timeout** | 90 seconds (increased from 30s through testing) |
286
+
287
+ **Request body:**
288
+ ```json
289
+ {
290
+ "session_id": 12345678,
291
+ "key": "<base64-encoded-key>",
292
+ "signature": "<base64-encoded-signature>"
293
+ }
294
+ ```
295
+
296
+ **Signature computation:**
297
+ 1. Convert session_id to 8-byte big-endian uint64
298
+ 2. Sign raw bytes with secp256k1 private key (same key that created session)
299
+ 3. Base64-encode the signature
300
+
301
+ **Key field:**
302
+ - WireGuard: X25519 public key (32 bytes, base64)
303
+ - V2Ray: UUID as 16-byte array (base64)
304
+
305
+ ### V2Ray Transport Map
306
+
307
+ | Sentinel Enum | Transport | V2Ray Network | Success Rate |
308
+ |---------------|-----------|---------------|-------------|
309
+ | 1 | domainsocket | N/A (unusable remotely) | 0% |
310
+ | 2 | gun | `grpc` | 100% (same config as grpc) |
311
+ | 3 | grpc | `grpc` | 87% (none), 0% (tls) |
312
+ | 4 | http | `http` | 100% |
313
+ | 5 | mkcp | `kcp` | 100% |
314
+ | 6 | quic | `quic` | 0% (with 5.2.1 fix: untested post-fix) |
315
+ | 7 | tcp | `tcp` | 100% |
316
+ | 8 | websocket | `ws` | 100% |
317
+
318
+ ### V2Ray Proxy Protocol Map
319
+
320
+ | Sentinel Enum | Protocol | V2Ray Protocol |
321
+ |---------------|----------|---------------|
322
+ | 1 | VLess | `vless` (encryption=none, NO flow) |
323
+ | 2 | VMess | `vmess` (alterId=0, NO security in user) |
324
+
325
+ ### WireGuard Config Template
326
+
327
+ ```ini
328
+ [Interface]
329
+ PrivateKey = <client-x25519-private-key>
330
+ Address = <assigned-address-from-handshake>/32
331
+ MTU = 1280
332
+ DNS = 10.8.0.1
333
+
334
+ [Peer]
335
+ PublicKey = <server-public-key-from-handshake>
336
+ Endpoint = <server-endpoint-from-handshake>
337
+ AllowedIPs = 0.0.0.0/0, ::/0
338
+ PersistentKeepalive = 15
339
+ ```
340
+
341
+ **Non-negotiable values:**
342
+ - MTU = 1280 (NOT 1420)
343
+ - DNS = 10.8.0.1 (NOT external DNS)
344
+ - PersistentKeepalive = 15 (NOT 30)
345
+
346
+ ---
347
+
348
+ ## NuGet Packages (C# SDK)
349
+
350
+ ### CosmosSharp / Cosmos SDK bindings
351
+
352
+ | Property | Value |
353
+ |----------|-------|
354
+ | **What** | Cosmos chain interaction for .NET |
355
+ | **Why** | Transaction signing, broadcasting, and chain queries in C# |
356
+ | **Note** | The C# SDK has its own `TransactionBuilder` and `ChainClient` that use raw HTTP -- not a third-party Cosmos SDK package |
357
+
358
+ ### System.Security.Cryptography
359
+
360
+ | Property | Value |
361
+ |----------|-------|
362
+ | **What** | .NET built-in cryptography |
363
+ | **Why** | secp256k1 signing, SHA256, X25519 key generation |
364
+ | **Note** | Built into .NET 8.0; no separate package needed |
365
+
366
+ ### System.Text.Json
367
+
368
+ | Property | Value |
369
+ |----------|-------|
370
+ | **What** | .NET built-in JSON serializer |
371
+ | **Why** | Parsing LCD responses, handshake payloads, config files |
372
+ | **CRITICAL** | String-number round-trip bug: `"5500000"` (string) serializes as `5500000` (number), deserializes back as `null`. Test all data models with round-trip serialization. |
373
+
374
+ ---
375
+
376
+ ## Development Dependencies
377
+
378
+ ### For testing the SDK itself
379
+
380
+ | Tool | Purpose | Version |
381
+ |------|---------|---------|
382
+ | `node test/smoke.js` | SDK smoke tests (661 assertions) | Built-in |
383
+ | Live Sentinel mainnet | Integration testing | N/A |
384
+ | Funded wallet | Real chain transactions | Need `udvpn` tokens |
385
+
386
+ ### For building consumer apps
387
+
388
+ | Tool | Purpose | Notes |
389
+ |------|---------|-------|
390
+ | `npm` or `yarn` | Package management | npm 10+ recommended |
391
+ | Git | Version control | Any recent version |
392
+ | VS Code / IDE | Development | Recommended: ESLint with single-quote, semicolons |
393
+
394
+ ---
395
+
396
+ ## Version Compatibility Matrix
397
+
398
+ | Component | Minimum | Recommended | Maximum Tested |
399
+ |-----------|---------|-------------|---------------|
400
+ | Node.js | 20.0.0 | 22.x LTS | 22.x |
401
+ | .NET SDK | 8.0.0 | 8.0.x latest | 8.0.x |
402
+ | @cosmjs/* | 0.32.2 | 0.32.4 | 0.32.x |
403
+ | @noble/curves | 2.0.1 | 2.x latest | 2.x |
404
+ | axios | 1.6.8 | 1.7.x | 1.x |
405
+ | V2Ray | 5.2.1 | **5.2.1 only** | 5.2.1 |
406
+ | WireGuard | 0.5.3 | Latest | Latest |
407
+ | Windows | 10 1607 | 11 | 11 |
408
+ | macOS | 12 | 14+ | 15 |
409
+ | Linux kernel | 5.6 | 6.x | 6.x |
410
+
411
+ ---
412
+
413
+ ## Dependency Installation Checklist
414
+
415
+ For a fresh development machine:
416
+
417
+ ```bash
418
+ # 1. Install Node.js 22 LTS
419
+ # Download from https://nodejs.org/
420
+
421
+ # 2. Install WireGuard
422
+ # Windows: https://www.wireguard.com/install/ (MSI)
423
+ # macOS: brew install wireguard-tools
424
+ # Linux: sudo apt install wireguard-tools
425
+
426
+ # 3. Clone/create project and install SDK
427
+ npm init -y
428
+ npm install sentinel-dvpn-sdk
429
+
430
+ # 4. Download V2Ray 5.2.1 (automatic)
431
+ npx sentinel-setup
432
+ # OR: node node_modules/sentinel-dvpn-sdk/setup.js
433
+
434
+ # 5. Create .env file
435
+ echo "MNEMONIC=your twelve word mnemonic phrase goes here" > .env
436
+
437
+ # 6. Verify everything
438
+ node -e "
439
+ import sdk from 'sentinel-dvpn-sdk';
440
+ console.log('SDK exports:', Object.keys(sdk).length);
441
+ "
442
+
443
+ # 7. Run smoke tests
444
+ node node_modules/sentinel-dvpn-sdk/test/smoke.js
445
+ ```
446
+
447
+ **For C# projects:**
448
+
449
+ ```bash
450
+ # 1. Install .NET 8.0 SDK
451
+ # Download from https://dotnet.microsoft.com/download/dotnet/8.0
452
+
453
+ # 2. Add SDK NuGet package (when published)
454
+ dotnet add package Sentinel.SDK
455
+
456
+ # 3. Build and run tests
457
+ dotnet build
458
+ dotnet test
459
+ ```