dero-mcp-server 0.1.2 → 0.4.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 (77) hide show
  1. package/POSITIONING.md +94 -0
  2. package/README.md +132 -31
  3. package/SKILL.md +264 -0
  4. package/data/docs-index.json +276 -264
  5. package/dist/bn254.d.ts +74 -0
  6. package/dist/bn254.d.ts.map +1 -0
  7. package/dist/bn254.js +205 -0
  8. package/dist/bn254.js.map +1 -0
  9. package/dist/citations.d.ts +140 -0
  10. package/dist/citations.d.ts.map +1 -0
  11. package/dist/citations.js +322 -0
  12. package/dist/citations.js.map +1 -0
  13. package/dist/composites/_shared.d.ts +119 -0
  14. package/dist/composites/_shared.d.ts.map +1 -0
  15. package/dist/composites/_shared.js +152 -0
  16. package/dist/composites/_shared.js.map +1 -0
  17. package/dist/composites/audit-chain-artifact-claim.d.ts +128 -0
  18. package/dist/composites/audit-chain-artifact-claim.d.ts.map +1 -0
  19. package/dist/composites/audit-chain-artifact-claim.js +305 -0
  20. package/dist/composites/audit-chain-artifact-claim.js.map +1 -0
  21. package/dist/composites/diagnose-chain-health.d.ts +64 -0
  22. package/dist/composites/diagnose-chain-health.d.ts.map +1 -0
  23. package/dist/composites/diagnose-chain-health.js +144 -0
  24. package/dist/composites/diagnose-chain-health.js.map +1 -0
  25. package/dist/composites/estimate-deploy-cost.d.ts +83 -0
  26. package/dist/composites/estimate-deploy-cost.d.ts.map +1 -0
  27. package/dist/composites/estimate-deploy-cost.js +116 -0
  28. package/dist/composites/estimate-deploy-cost.js.map +1 -0
  29. package/dist/composites/explain-smart-contract.d.ts +64 -0
  30. package/dist/composites/explain-smart-contract.d.ts.map +1 -0
  31. package/dist/composites/explain-smart-contract.js +149 -0
  32. package/dist/composites/explain-smart-contract.js.map +1 -0
  33. package/dist/composites/forge-demo-proof.d.ts +81 -0
  34. package/dist/composites/forge-demo-proof.d.ts.map +1 -0
  35. package/dist/composites/forge-demo-proof.js +204 -0
  36. package/dist/composites/forge-demo-proof.js.map +1 -0
  37. package/dist/composites/recommend-docs-path.d.ts +97 -0
  38. package/dist/composites/recommend-docs-path.d.ts.map +1 -0
  39. package/dist/composites/recommend-docs-path.js +149 -0
  40. package/dist/composites/recommend-docs-path.js.map +1 -0
  41. package/dist/composites/trace-transaction-with-context.d.ts +107 -0
  42. package/dist/composites/trace-transaction-with-context.d.ts.map +1 -0
  43. package/dist/composites/trace-transaction-with-context.js +217 -0
  44. package/dist/composites/trace-transaction-with-context.js.map +1 -0
  45. package/dist/daemon-base.d.ts +28 -0
  46. package/dist/daemon-base.d.ts.map +1 -0
  47. package/dist/daemon-base.js +62 -0
  48. package/dist/daemon-base.js.map +1 -0
  49. package/dist/dero-curve.d.ts +79 -0
  50. package/dist/dero-curve.d.ts.map +1 -0
  51. package/dist/dero-curve.js +79 -0
  52. package/dist/dero-curve.js.map +1 -0
  53. package/dist/docs-parse.d.ts.map +1 -1
  54. package/dist/docs-parse.js +18 -2
  55. package/dist/docs-parse.js.map +1 -1
  56. package/dist/http-server.d.ts +37 -0
  57. package/dist/http-server.d.ts.map +1 -0
  58. package/dist/http-server.js +132 -0
  59. package/dist/http-server.js.map +1 -0
  60. package/dist/index.js +18 -11
  61. package/dist/index.js.map +1 -1
  62. package/dist/proof-decode.d.ts +125 -0
  63. package/dist/proof-decode.d.ts.map +1 -0
  64. package/dist/proof-decode.js +619 -0
  65. package/dist/proof-decode.js.map +1 -0
  66. package/dist/server.d.ts.map +1 -1
  67. package/dist/server.js +414 -114
  68. package/dist/server.js.map +1 -1
  69. package/dist/tool-descriptions.d.ts +53 -0
  70. package/dist/tool-descriptions.d.ts.map +1 -0
  71. package/dist/tool-descriptions.js +285 -0
  72. package/dist/tool-descriptions.js.map +1 -0
  73. package/dist/tx-parse.d.ts +63 -0
  74. package/dist/tx-parse.d.ts.map +1 -0
  75. package/dist/tx-parse.js +183 -0
  76. package/dist/tx-parse.js.map +1 -0
  77. package/package.json +27 -2
@@ -0,0 +1,217 @@
1
+ /**
2
+ * `trace_transaction_with_context` — Phase C composite #5 (final).
3
+ *
4
+ * Wedge: `dero_get_transaction` returns the raw tx record (block,
5
+ * ring, signer, code, balances) but leaves the agent to figure out
6
+ * confirmation state, classify the tx kind, and separately fetch
7
+ * any SC context. This composite combines all of that in one call
8
+ * and stitches the right docs page as a citation.
9
+ *
10
+ * Design contract § 5. Sequencing rule: SHIP
11
+ * LAST — highest fan-out + failure-mode count of all Phase C
12
+ * composites.
13
+ *
14
+ * Implementation notes (recorded honestly so the design doc and
15
+ * shipped surface stay in sync):
16
+ *
17
+ * - SC INSTALL detection works directly off the tx record: when
18
+ * `tx.code` is non-empty the tx_hash itself IS the resulting
19
+ * SCID and the embedded code is the deployed source. We run
20
+ * `extractScSurface` on `tx.code` directly — no second
21
+ * `DERO.GetSC` call is needed for installs.
22
+ * - SC INVOCATION arg/entrypoint decoding requires walking the
23
+ * binary tx blob (`txs_as_hex`) with DERO's tx codec. That
24
+ * codec is not yet bundled in this MCP, so the composite does
25
+ * NOT fabricate decoded args. It surfaces `raw_tx_hex_length`
26
+ * so the agent knows the binary is available via
27
+ * `dero_get_transaction` if a downstream wallet wants to
28
+ * decode it.
29
+ * - TX_NOT_FOUND is signalled by the daemon as an EMPTY record
30
+ * (`block_height: 0, in_pool: false, code: ''`) — it does
31
+ * not throw. The composite detects this and throws a
32
+ * classifier-friendly message so `withStructuredErrors`
33
+ * surfaces `_meta.error.code = TX_NOT_FOUND`.
34
+ *
35
+ * Failure model:
36
+ * - `DERO.GetTransaction` throws → propagates via
37
+ * `withStructuredErrors` (RPC_UNREACHABLE / RPC_INVALID_PARAMS
38
+ * classifier branches handle the daemon-side cases).
39
+ * - Daemon returns empty record for the hash → composite throws
40
+ * `'DERO transaction not found: ...'` → classifier returns
41
+ * `TX_NOT_FOUND` with a retry hint.
42
+ * - Tx found but SC surface extraction degraded for the install
43
+ * case → record the surface as-is (`has_code: false`,
44
+ * `functions: []`) and let the narrative explain. Never abort.
45
+ */
46
+ import { z } from 'zod';
47
+ import { attachCitations, extractScSurface, runChain, stepLatencies, stepValue, } from './_shared.js';
48
+ const HEX64_REGEX = /^[0-9a-fA-F]{64}$/;
49
+ const NATIVE_DERO_SCID = '0000000000000000000000000000000000000000000000000000000000000000';
50
+ export const traceTransactionWithContextInputSchema = {
51
+ tx_hash: z
52
+ .string()
53
+ .regex(HEX64_REGEX, 'Expected 64-character hex transaction hash')
54
+ .describe('64-char hex transaction hash'),
55
+ decode: z
56
+ .boolean()
57
+ .optional()
58
+ .describe('Pass decode_as_json=1 to the daemon. Default true. Decoded JSON view is informational; the raw hex always comes back.'),
59
+ include_sc_context: z
60
+ .boolean()
61
+ .optional()
62
+ .describe('When true (default), runs the SC-install surface extraction inline when the tx contains contract code. SC invocation arg decoding is NOT performed in either mode; see module docs.'),
63
+ };
64
+ function classifyConfirmation(tx) {
65
+ if (tx.in_pool === true)
66
+ return 'mempool';
67
+ if (typeof tx.block_height === 'number' && tx.block_height > 0)
68
+ return 'confirmed';
69
+ return 'unknown';
70
+ }
71
+ function classifyKind(tx) {
72
+ if (typeof tx.code === 'string' && tx.code.length > 0)
73
+ return 'sc_install';
74
+ if (typeof tx.reward === 'number' && tx.reward > 0 && (!tx.ring || tx.ring.length === 0)) {
75
+ return 'coinbase';
76
+ }
77
+ if (Array.isArray(tx.ring) && tx.ring.length > 0)
78
+ return 'transfer_or_invocation';
79
+ return 'unknown';
80
+ }
81
+ function ringStats(tx) {
82
+ if (!Array.isArray(tx.ring) || tx.ring.length === 0) {
83
+ return { groups: null, first_group_size: null };
84
+ }
85
+ const groups = tx.ring.length;
86
+ const first = tx.ring[0];
87
+ const firstSize = Array.isArray(first) ? first.length : null;
88
+ return { groups, first_group_size: firstSize };
89
+ }
90
+ function isEmptyTxRecord(tx) {
91
+ if (!tx)
92
+ return true;
93
+ const noBlock = !tx.block_height || tx.block_height === 0;
94
+ const noPool = tx.in_pool !== true;
95
+ const noCode = !tx.code || tx.code.length === 0;
96
+ const noRing = !Array.isArray(tx.ring) || tx.ring.length === 0;
97
+ return noBlock && noPool && noCode && noRing;
98
+ }
99
+ function buildNarrative(txHash, confirmation, kind, blockHeight, scInstallSurface, ringGroups, rawHexLen, scLookupFailed) {
100
+ const parts = [];
101
+ if (confirmation === 'mempool') {
102
+ parts.push(`Tx ${txHash} is in the mempool (not yet confirmed). It may still be reorganized or dropped; treat the result as provisional.`);
103
+ }
104
+ else if (confirmation === 'confirmed') {
105
+ parts.push(`Tx ${txHash} is confirmed at block height ${blockHeight ?? 'unknown'}.`);
106
+ }
107
+ else {
108
+ parts.push(`Tx ${txHash} confirmation status is unknown — the daemon returned a record but did not mark it confirmed or in mempool.`);
109
+ }
110
+ if (kind === 'sc_install') {
111
+ if (scInstallSurface && scInstallSurface.has_code) {
112
+ const fnCount = scInstallSurface.functions.length;
113
+ const sampleFns = scInstallSurface.functions
114
+ .slice(0, 4)
115
+ .map((f) => f.name)
116
+ .join(', ');
117
+ parts.push(`Tx is a smart-contract INSTALL: the tx_hash is the resulting SCID. The deployed source carries ${fnCount} function${fnCount === 1 ? '' : 's'}${sampleFns ? ` (${sampleFns}${fnCount > 4 ? ', …' : ''})` : ''}. The composite parsed the surface inline from the embedded code; no second dero_get_sc call was needed.`);
118
+ }
119
+ else if (scLookupFailed) {
120
+ parts.push('Tx is a smart-contract INSTALL but the surface extractor failed to parse the embedded code. Fall back to dero_get_sc with the tx_hash as SCID for the raw payload.');
121
+ }
122
+ }
123
+ else if (kind === 'coinbase') {
124
+ parts.push('Tx is a coinbase (mining reward) — no ring members, signer is the miner address.');
125
+ }
126
+ else if (kind === 'transfer_or_invocation') {
127
+ parts.push(`Tx is a transfer or SC invocation. ${ringGroups ? `${ringGroups} input ring group${ringGroups === 1 ? '' : 's'} present.` : ''} SC invocation arg decoding is not surfaced by the daemon's JSON response; the ${rawHexLen}-char raw hex blob is available via dero_get_transaction if a wallet-side decoder is needed.`);
128
+ }
129
+ return parts.join(' ');
130
+ }
131
+ export async function traceTransactionWithContext(rpc, args) {
132
+ const decode = args.decode !== false;
133
+ const includeScContext = args.include_sc_context !== false;
134
+ const params = {
135
+ txs_hashes: [args.tx_hash],
136
+ decode_as_json: decode ? 1 : 0,
137
+ };
138
+ const steps = [
139
+ {
140
+ name: 'get_transaction',
141
+ required: true,
142
+ fn: () => rpc('DERO.GetTransaction', params),
143
+ },
144
+ ];
145
+ const chain = await runChain(steps);
146
+ const txResult = stepValue(chain, 'get_transaction');
147
+ const tx = txResult?.txs?.[0];
148
+ const rawHexLen = (txResult?.txs_as_hex?.[0] ?? '').length;
149
+ if (!tx || isEmptyTxRecord(tx)) {
150
+ // Daemon does not error on unknown hashes — it returns an empty record.
151
+ // Throw a classifier-friendly message so withStructuredErrors emits
152
+ // TX_NOT_FOUND.
153
+ throw new Error(`DERO transaction not found: ${args.tx_hash}. The daemon returned an empty record (no block_height, no mempool entry, no code, no ring).`);
154
+ }
155
+ const confirmation = classifyConfirmation(tx);
156
+ const kind = classifyKind(tx);
157
+ const { groups: ringGroups, first_group_size: firstRingSize } = ringStats(tx);
158
+ let scInstallSurface = null;
159
+ let scLookupFailed = false;
160
+ if (includeScContext && kind === 'sc_install') {
161
+ try {
162
+ scInstallSurface = extractScSurface({ code: tx.code });
163
+ }
164
+ catch {
165
+ scLookupFailed = true;
166
+ scInstallSurface = null;
167
+ }
168
+ }
169
+ const narrative = buildNarrative(args.tx_hash, confirmation, kind, typeof tx.block_height === 'number' ? tx.block_height : null, scInstallSurface, ringGroups, rawHexLen, scLookupFailed);
170
+ return attachCitations({
171
+ tx_hash: args.tx_hash,
172
+ confirmation: {
173
+ status: confirmation,
174
+ block_height: typeof tx.block_height === 'number' ? tx.block_height : null,
175
+ valid_block: typeof tx.valid_block === 'string' && tx.valid_block.length > 0 ? tx.valid_block : null,
176
+ invalid_blocks: Array.isArray(tx.invalid_block) ? tx.invalid_block : [],
177
+ in_pool: tx.in_pool === true,
178
+ },
179
+ kind,
180
+ ring: {
181
+ groups: ringGroups,
182
+ first_group_size: firstRingSize,
183
+ },
184
+ reward: typeof tx.reward === 'number' ? tx.reward : null,
185
+ signer_visible: typeof tx.signer === 'string' && tx.signer.length > 0,
186
+ native_balance: {
187
+ scid: NATIVE_DERO_SCID,
188
+ at_tx: typeof tx.balance === 'number' ? tx.balance : null,
189
+ current: typeof tx.balancenow === 'number' ? tx.balancenow : null,
190
+ },
191
+ sc_install: scInstallSurface
192
+ ? {
193
+ scid: args.tx_hash,
194
+ surface: {
195
+ functions: scInstallSurface.functions,
196
+ stringkeys: scInstallSurface.stringkeys,
197
+ uint64keys: scInstallSurface.uint64keys,
198
+ balances: scInstallSurface.balances,
199
+ },
200
+ raw_code_length: scInstallSurface.raw_code_length,
201
+ has_code: scInstallSurface.has_code,
202
+ }
203
+ : null,
204
+ raw_tx_hex_length: rawHexLen,
205
+ narrative,
206
+ _diagnostics: {
207
+ step_latency_ms: stepLatencies(chain),
208
+ total_ms: chain.totalMs,
209
+ halted_at: chain.haltedAt,
210
+ decode_as_json: decode,
211
+ include_sc_context: includeScContext,
212
+ sc_install_surface_attempted: includeScContext && kind === 'sc_install',
213
+ sc_install_surface_failed: scLookupFailed,
214
+ },
215
+ }, 'trace_transaction_with_context');
216
+ }
217
+ //# sourceMappingURL=trace-transaction-with-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-transaction-with-context.js","sourceRoot":"","sources":["../../src/composites/trace-transaction-with-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,SAAS,GAIV,MAAM,cAAc,CAAA;AAErB,MAAM,WAAW,GAAG,mBAAmB,CAAA;AACvC,MAAM,gBAAgB,GAAG,kEAAkE,CAAA;AAE3F,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,O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,QAAQ,EAAE,KAAK,CAAC,OAAO;YACvB,SAAS,EAAE,KAAK,CAAC,QAAQ;YACzB,cAAc,EAAE,MAAM;YACtB,kBAAkB,EAAE,gBAAgB;YACpC,4BAA4B,EAAE,gBAAgB,IAAI,IAAI,KAAK,YAAY;YACvE,yBAAyB,EAAE,cAAc;SAC1C;KACF,EACD,gCAAgC,CACjC,CAAA;AACH,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Baked-in third-party public mainnet daemon. Last-resort fallback so the
3
+ * server works with zero setup, but it is someone else's node — prefer a
4
+ * local derod for privacy and trust.
5
+ */
6
+ export declare const PUBLIC_DAEMON_BASE = "http://82.65.143.182:10102";
7
+ /** A derod running locally on its default RPC bind — the preferred source. */
8
+ export declare const LOCAL_DAEMON_BASE = "http://127.0.0.1:10102";
9
+ export type DaemonSource = 'env' | 'local' | 'public';
10
+ export type DaemonResolution = {
11
+ base: string;
12
+ source: DaemonSource;
13
+ };
14
+ /**
15
+ * Resolve which DERO daemon the server should talk to, local-first:
16
+ *
17
+ * 1. DERO_DAEMON_URL set → honor it verbatim (hosted deploys, custom nodes).
18
+ * 2. else local node up → http://127.0.0.1:10102 (private, no third party).
19
+ * 3. else → baked-in public fallback (works with zero setup).
20
+ *
21
+ * Resolved once at startup. stdio hosts spawn a fresh process per session, so
22
+ * a node started later is picked up on the next launch; a long-running HTTP
23
+ * server re-resolves on restart.
24
+ */
25
+ export declare function resolveDaemonBase(): Promise<DaemonResolution>;
26
+ /** One-line, human-readable description of a resolution for startup logs. */
27
+ export declare function describeDaemonResolution({ base, source }: DaemonResolution): string;
28
+ //# sourceMappingURL=daemon-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daemon-base.d.ts","sourceRoot":"","sources":["../src/daemon-base.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,+BAA+B,CAAA;AAE9D,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,2BAA2B,CAAA;AAEzD,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;AAErD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,YAAY,CAAA;CACrB,CAAA;AA+BD;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAQnE;AAED,6EAA6E;AAC7E,wBAAgB,wBAAwB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,gBAAgB,GAAG,MAAM,CASnF"}
@@ -0,0 +1,62 @@
1
+ import { deroJsonRpc, jsonRpcEndpoint } from './rpc.js';
2
+ /**
3
+ * Baked-in third-party public mainnet daemon. Last-resort fallback so the
4
+ * server works with zero setup, but it is someone else's node — prefer a
5
+ * local derod for privacy and trust.
6
+ */
7
+ export const PUBLIC_DAEMON_BASE = 'http://82.65.143.182:10102';
8
+ /** A derod running locally on its default RPC bind — the preferred source. */
9
+ export const LOCAL_DAEMON_BASE = 'http://127.0.0.1:10102';
10
+ function stripJsonRpc(url) {
11
+ return url.replace(/\/json_rpc\/?$/, '').replace(/\/+$/, '');
12
+ }
13
+ /**
14
+ * Probe a base URL to confirm a real DERO daemon answers there. Calls
15
+ * DERO.GetInfo rather than a bare TCP connect, so an unrelated service
16
+ * squatting on the port is not mistaken for a daemon. A refused connection
17
+ * on localhost rejects almost immediately, so this adds no meaningful
18
+ * startup latency when no node is running.
19
+ */
20
+ async function isDeroDaemon(base, timeoutMs = 1500) {
21
+ try {
22
+ const info = await deroJsonRpc(jsonRpcEndpoint(base), 'DERO.GetInfo', undefined, { timeoutMs });
23
+ return (!!info &&
24
+ typeof info === 'object' &&
25
+ (typeof info.height === 'number' || typeof info.topoheight === 'number'));
26
+ }
27
+ catch {
28
+ return false;
29
+ }
30
+ }
31
+ /**
32
+ * Resolve which DERO daemon the server should talk to, local-first:
33
+ *
34
+ * 1. DERO_DAEMON_URL set → honor it verbatim (hosted deploys, custom nodes).
35
+ * 2. else local node up → http://127.0.0.1:10102 (private, no third party).
36
+ * 3. else → baked-in public fallback (works with zero setup).
37
+ *
38
+ * Resolved once at startup. stdio hosts spawn a fresh process per session, so
39
+ * a node started later is picked up on the next launch; a long-running HTTP
40
+ * server re-resolves on restart.
41
+ */
42
+ export async function resolveDaemonBase() {
43
+ const fromEnv = process.env.DERO_DAEMON_URL?.trim();
44
+ if (fromEnv)
45
+ return { base: stripJsonRpc(fromEnv), source: 'env' };
46
+ if (await isDeroDaemon(LOCAL_DAEMON_BASE)) {
47
+ return { base: LOCAL_DAEMON_BASE, source: 'local' };
48
+ }
49
+ return { base: PUBLIC_DAEMON_BASE, source: 'public' };
50
+ }
51
+ /** One-line, human-readable description of a resolution for startup logs. */
52
+ export function describeDaemonResolution({ base, source }) {
53
+ switch (source) {
54
+ case 'env':
55
+ return `daemon: ${base} (from DERO_DAEMON_URL)`;
56
+ case 'local':
57
+ return `daemon: ${base} (local node detected)`;
58
+ case 'public':
59
+ return `daemon: ${base} (no local node found — public fallback; run your own derod for privacy)`;
60
+ }
61
+ }
62
+ //# sourceMappingURL=daemon-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daemon-base.js","sourceRoot":"","sources":["../src/daemon-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,4BAA4B,CAAA;AAE9D,8EAA8E;AAC9E,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAA;AASzD,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AAC9D,CAAC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,SAAS,GAA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constants and helpers.
3
+ *
4
+ * DERO uses the Pedersen base point `G = HashToPoint(HashtoNumber("DEROG"))`
5
+ * (`cryptography/crypto/algebra_pedersen.go:36`). It is NOT the standard bn254
6
+ * generator. Extracted once from a Go scratch program against the DEROHE
7
+ * Release 142 checkout — see `scripts/extract-g.go` (kept out-of-tree, regen
8
+ * instructions below) — and pinned here so this server does not need to
9
+ * reimplement HashToPoint.
10
+ *
11
+ * Wire format for compressed points (33 bytes, mirrors
12
+ * `cryptography/bn256/changes.go:19-35`):
13
+ *
14
+ * bytes[0..32] X coordinate, big-endian (32 bytes)
15
+ * bytes[32] sign byte:
16
+ * 0x00 if the original Y is the smaller of the two
17
+ * square roots of x^3 + 3 mod P (i.e. Y < P - Y)
18
+ * 0x01 if Y is the larger one
19
+ *
20
+ * To re-extract after a DEROHE update, drop this into
21
+ * `<derohe>/cmd/extract_g/main.go` and `go run ./cmd/extract_g/`:
22
+ *
23
+ * package main
24
+ * import (
25
+ * "fmt"; "math/big"
26
+ * "github.com/deroproject/derohe/cryptography/bn256"
27
+ * "github.com/deroproject/derohe/cryptography/crypto"
28
+ * )
29
+ * func main() {
30
+ * dump := func(l string, p *bn256.G1) { fmt.Printf("%s: %x\n", l, p.EncodeCompressed()) }
31
+ * dump("G", crypto.G)
32
+ * two := new(bn256.G1).Add(crypto.G, crypto.G); dump("2G", two)
33
+ * dump("-G", new(bn256.G1).Neg(crypto.G))
34
+ * dump("G*100000", new(bn256.G1).ScalarMult(crypto.G, new(big.Int).SetUint64(100_000)))
35
+ * }
36
+ */
37
+ /** Pedersen base point G, 33-byte compressed hex (DERO format). */
38
+ export declare const DERO_G_COMPRESSED_HEX = "02eacfbf92b94015c9b0b3d901dae37ec68f74dea7e4484c76d505aade4ad7c001";
39
+ /** bn254 prime field modulus. */
40
+ export declare const BN254_P = 21888242871839275222246405745257275088696311157297823662689037894645226208583n;
41
+ /** bn254 curve order (subgroup order r). */
42
+ export declare const BN254_R = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
43
+ /** Curve equation constant: y^2 = x^3 + B. */
44
+ export declare const BN254_B = 3n;
45
+ /**
46
+ * Cross-implementation verification fixtures — produced by the Go scratch
47
+ * program above and used by the TS bn254 wrapper's self-tests. If the TS
48
+ * implementation cannot reproduce these compressed bytes from the underlying
49
+ * scalar operations, the noble-curves wiring or the DERO compression format
50
+ * is wrong — bail before forging anything.
51
+ */
52
+ export declare const CURVE_FIXTURES: {
53
+ /** G itself. */
54
+ readonly G: "02eacfbf92b94015c9b0b3d901dae37ec68f74dea7e4484c76d505aade4ad7c001";
55
+ /** 2G = G + G. */
56
+ readonly twoG: "1723c9b5c0c573e9d202fea0243d5ffa5ca5e1adcfd50d0c0d53c48e1f190e0b00";
57
+ /** 3G = 2G + G. */
58
+ readonly threeG: "187768b7ba4478fd947490d31d6f10ce393c7429e1166f42a5bbc1d9a487a33600";
59
+ /** -G (negation). */
60
+ readonly negG: "02eacfbf92b94015c9b0b3d901dae37ec68f74dea7e4484c76d505aade4ad7c000";
61
+ /** G * 100_000 (= 1 DERO in atomic units — the smallest "real" forge scalar). */
62
+ readonly gMul1Dero: "1d03a5cf6ceb36e69d4e312d9f3d8413dd463f5f3498a31468bf9b46abbdd2e001";
63
+ /**
64
+ * G * int64(uint64(18446744073709451616)) = G * -100000 — the proof.go:89
65
+ * scalar for the docs-page demo's -1 DERO forge. Verifies the TS
66
+ * uint64→signed-scalar reduction matches Go's int64 cast.
67
+ */
68
+ readonly gMulNeg1DeroAtoms: "1d03a5cf6ceb36e69d4e312d9f3d8413dd463f5f3498a31468bf9b46abbdd2e000";
69
+ /**
70
+ * G * int64(uint64(18446743853709551435)) = G * -220000000181 — the scalar
71
+ * proof.Prove() actually uses for the cited 2022 inflation-claim proof's V.
72
+ * Verifies the TS path reproduces the on-the-wire scalar for the
73
+ * real-world adversarial input.
74
+ */
75
+ readonly gMulCited2022V: "0a5d16be695e5ca24f8f83e6a2f39a1bafe5251b69e182efbb90d41801782d1b00";
76
+ };
77
+ /** Atomic units per DERO. */
78
+ export declare const DERO_ATOMIC = 100000n;
79
+ //# sourceMappingURL=dero-curve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dero-curve.d.ts","sourceRoot":"","sources":["../src/dero-curve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,mEAAmE;AACnE,eAAO,MAAM,qBAAqB,uEACoC,CAAA;AAEtE,iCAAiC;AACjC,eAAO,MAAM,OAAO,iFACiD,CAAA;AAErE,4CAA4C;AAC5C,eAAO,MAAM,OAAO,iFACiD,CAAA;AAErE,8CAA8C;AAC9C,eAAO,MAAM,OAAO,KAAK,CAAA;AAEzB;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;IACzB,gBAAgB;;IAEhB,kBAAkB;;IAElB,mBAAmB;;IAEnB,qBAAqB;;IAErB,iFAAiF;;IAEjF;;;;OAIG;;IAGH;;;;;OAKG;;CAEK,CAAA;AAEV,6BAA6B;AAC7B,eAAO,MAAM,WAAW,UAAW,CAAA"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * DERO bn256 (alt_bn128 / bn254) constants and helpers.
3
+ *
4
+ * DERO uses the Pedersen base point `G = HashToPoint(HashtoNumber("DEROG"))`
5
+ * (`cryptography/crypto/algebra_pedersen.go:36`). It is NOT the standard bn254
6
+ * generator. Extracted once from a Go scratch program against the DEROHE
7
+ * Release 142 checkout — see `scripts/extract-g.go` (kept out-of-tree, regen
8
+ * instructions below) — and pinned here so this server does not need to
9
+ * reimplement HashToPoint.
10
+ *
11
+ * Wire format for compressed points (33 bytes, mirrors
12
+ * `cryptography/bn256/changes.go:19-35`):
13
+ *
14
+ * bytes[0..32] X coordinate, big-endian (32 bytes)
15
+ * bytes[32] sign byte:
16
+ * 0x00 if the original Y is the smaller of the two
17
+ * square roots of x^3 + 3 mod P (i.e. Y < P - Y)
18
+ * 0x01 if Y is the larger one
19
+ *
20
+ * To re-extract after a DEROHE update, drop this into
21
+ * `<derohe>/cmd/extract_g/main.go` and `go run ./cmd/extract_g/`:
22
+ *
23
+ * package main
24
+ * import (
25
+ * "fmt"; "math/big"
26
+ * "github.com/deroproject/derohe/cryptography/bn256"
27
+ * "github.com/deroproject/derohe/cryptography/crypto"
28
+ * )
29
+ * func main() {
30
+ * dump := func(l string, p *bn256.G1) { fmt.Printf("%s: %x\n", l, p.EncodeCompressed()) }
31
+ * dump("G", crypto.G)
32
+ * two := new(bn256.G1).Add(crypto.G, crypto.G); dump("2G", two)
33
+ * dump("-G", new(bn256.G1).Neg(crypto.G))
34
+ * dump("G*100000", new(bn256.G1).ScalarMult(crypto.G, new(big.Int).SetUint64(100_000)))
35
+ * }
36
+ */
37
+ /** Pedersen base point G, 33-byte compressed hex (DERO format). */
38
+ export const DERO_G_COMPRESSED_HEX = '02eacfbf92b94015c9b0b3d901dae37ec68f74dea7e4484c76d505aade4ad7c001';
39
+ /** bn254 prime field modulus. */
40
+ export const BN254_P = 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47n;
41
+ /** bn254 curve order (subgroup order r). */
42
+ export const BN254_R = 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001n;
43
+ /** Curve equation constant: y^2 = x^3 + B. */
44
+ export const BN254_B = 3n;
45
+ /**
46
+ * Cross-implementation verification fixtures — produced by the Go scratch
47
+ * program above and used by the TS bn254 wrapper's self-tests. If the TS
48
+ * implementation cannot reproduce these compressed bytes from the underlying
49
+ * scalar operations, the noble-curves wiring or the DERO compression format
50
+ * is wrong — bail before forging anything.
51
+ */
52
+ export const CURVE_FIXTURES = {
53
+ /** G itself. */
54
+ G: '02eacfbf92b94015c9b0b3d901dae37ec68f74dea7e4484c76d505aade4ad7c001',
55
+ /** 2G = G + G. */
56
+ twoG: '1723c9b5c0c573e9d202fea0243d5ffa5ca5e1adcfd50d0c0d53c48e1f190e0b00',
57
+ /** 3G = 2G + G. */
58
+ threeG: '187768b7ba4478fd947490d31d6f10ce393c7429e1166f42a5bbc1d9a487a33600',
59
+ /** -G (negation). */
60
+ negG: '02eacfbf92b94015c9b0b3d901dae37ec68f74dea7e4484c76d505aade4ad7c000',
61
+ /** G * 100_000 (= 1 DERO in atomic units — the smallest "real" forge scalar). */
62
+ gMul1Dero: '1d03a5cf6ceb36e69d4e312d9f3d8413dd463f5f3498a31468bf9b46abbdd2e001',
63
+ /**
64
+ * G * int64(uint64(18446744073709451616)) = G * -100000 — the proof.go:89
65
+ * scalar for the docs-page demo's -1 DERO forge. Verifies the TS
66
+ * uint64→signed-scalar reduction matches Go's int64 cast.
67
+ */
68
+ gMulNeg1DeroAtoms: '1d03a5cf6ceb36e69d4e312d9f3d8413dd463f5f3498a31468bf9b46abbdd2e000',
69
+ /**
70
+ * G * int64(uint64(18446743853709551435)) = G * -220000000181 — the scalar
71
+ * proof.Prove() actually uses for the cited 2022 inflation-claim proof's V.
72
+ * Verifies the TS path reproduces the on-the-wire scalar for the
73
+ * real-world adversarial input.
74
+ */
75
+ gMulCited2022V: '0a5d16be695e5ca24f8f83e6a2f39a1bafe5251b69e182efbb90d41801782d1b00',
76
+ };
77
+ /** Atomic units per DERO. */
78
+ export const DERO_ATOMIC = 100000n;
79
+ //# sourceMappingURL=dero-curve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dero-curve.js","sourceRoot":"","sources":["../src/dero-curve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,mEAAmE;AACnE,MAAM,CAAC,MAAM,qBAAqB,GAChC,oEAAoE,CAAA;AAEtE,iCAAiC;AACjC,MAAM,CAAC,MAAM,OAAO,GAClB,mEAAmE,CAAA;AAErE,4CAA4C;AAC5C,MAAM,CAAC,MAAM,OAAO,GAClB,mEAAmE,CAAA;AAErE,8CAA8C;AAC9C,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,CAAA;AAEzB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAA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EAAE,MAAM,EAAE,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,CAAC,CAAA;IACV,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,YAAY,EAAE,CAAA;CACtB,CAAA;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD;AAYD,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOrE;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWpE;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAQ1D;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAWlD;AAyCD,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAqC7E;AAED,wBAAsB,mBAAmB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkBrF"}
@@ -90,7 +90,23 @@ async function walkMdxFiles(dir) {
90
90
  function buildCanonicalUrl(product, slug) {
91
91
  if (!slug)
92
92
  return `${DOC_BASE_URLS[product]}/`;
93
- return `${DOC_BASE_URLS[product]}/${slug}`;
93
+ // .md mirror suffix points agents at the LLM-canonical Markdown surface.
94
+ // All four ecosystem sites (derod, tela, hologram, deropay) ship the App
95
+ // Router .md mirror route as of 0.2.4.
96
+ return `${DOC_BASE_URLS[product]}/${slug}.md`;
97
+ }
98
+ /**
99
+ * Normalize a frontmatter-supplied canonical URL so it carries the same
100
+ * `.md` suffix as builder-generated URLs. Without this, any MDX page that
101
+ * declared its own `canonicalUrl` in frontmatter would bypass the suffix
102
+ * and point agents at the HTML version.
103
+ */
104
+ function applyMdSuffix(_product, url) {
105
+ // Don't double-suffix; preserve query/anchor if present.
106
+ const [base, rest = ''] = url.split(/(?=[?#])/);
107
+ if (/\.md$/.test(base) || /\.[a-z0-9]{2,5}$/i.test(base))
108
+ return url;
109
+ return `${base}.md${rest}`;
94
110
  }
95
111
  export async function indexDocsFromRoot(root) {
96
112
  const pages = [];
@@ -112,7 +128,7 @@ export async function indexDocsFromRoot(root) {
112
128
  slug,
113
129
  title: frontmatter.title || safeTitleFromSlug(slug),
114
130
  description: frontmatter.description || null,
115
- canonicalUrl: frontmatter.canonicalUrl || buildCanonicalUrl(product, slug),
131
+ canonicalUrl: applyMdSuffix(product, frontmatter.canonicalUrl || buildCanonicalUrl(product, slug)),
116
132
  sourcePath: path.relative(root, filePath).replace(/\\/g, '/'),
117
133
  headings,
118
134
  plainText: mdxToPlainText(content),
@@ -1 +1 @@
1
- {"version":3,"file":"docs-parse.js","sourceRoot":"","sources":["../src/docs-parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,CAAU,CAAA;AAGlF,MAAM,CAAC,MAAM,aAAa,GAAmC;IAC3D,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,eAAe;IACzB,OAAO,EAAE,cAAc;CACxB,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAmC;IAC3D,KAAK,EAAE,mBAAmB;IAC1B,IAAI,EAAE,wBAAwB;IAC9B,QAAQ,EAAE,4BAA4B;IACtC,OAAO,E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AQ,EAAE,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACpE,OAAO,CAAC,MAAM,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA;IACzD,CAAC;IAED,MAAM,cAAc,GAAG;QACrB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC;QAC3C,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC;KAC/C,CAAA;IAED,KAAK,MAAM,SAAS,IAAI,cAAc,EAAE,CAAC;QACvC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACrE,IAAI,MAAM,UAAU,CAAC,UAAU,CAAC;YAAE,OAAO,SAAS,CAAA;IACpD,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Streamable HTTP transport entry for dero-mcp-server.
3
+ *
4
+ * Same factory (`createDeroMcpServer`) as the stdio entry — just a
5
+ * different transport on top. Enable via `dero-mcp-server --http`
6
+ * or `DERO_MCP_HTTP=1` (see index.ts dispatcher).
7
+ *
8
+ * Stateless by design: each request is independent. No session
9
+ * tracking, no in-memory state across requests, no logs of query
10
+ * payloads. Pairs cleanly with read-only semantics and the
11
+ * privacy-first brand.
12
+ *
13
+ * Environment:
14
+ * DERO_DAEMON_URL — JSON-RPC base. If unset, resolves local-first:
15
+ * a local derod (127.0.0.1:10102) if reachable,
16
+ * else the baked-in public fallback.
17
+ * DERO_MCP_HTTP_PORT — listen port (default: 8787)
18
+ * DERO_MCP_HTTP_HOST — listen address (default: 127.0.0.1)
19
+ * DERO_MCP_AUTH_TOKEN — if set, require `Authorization: Bearer <token>`
20
+ * on /mcp. Constant-time compared. Recommended
21
+ * when binding to a public address; required
22
+ * if behind a reverse proxy without its own auth.
23
+ *
24
+ * Routes:
25
+ * POST /mcp — MCP streamable HTTP endpoint
26
+ * GET /mcp — same (SSE compat for older clients)
27
+ * GET /health — health check {status, version, daemon_url, daemon_source}
28
+ * anything else → 404
29
+ *
30
+ * Reverse-proxy expectations:
31
+ * - TLS handled upstream (Caddy / Cloudflare / etc.) — this server is
32
+ * plain HTTP.
33
+ * - Original client IP can be passed via X-Forwarded-For for logging;
34
+ * we don't log IPs by default but the middleware reads it if present.
35
+ */
36
+ export declare function startHttpServer(): Promise<void>;
37
+ //# sourceMappingURL=http-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-server.d.ts","sourceRoot":"","sources":["../src/http-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAsCH,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CA4ErD"}