@odatano/core 2.0.0-rc.41 → 2.0.0-rc.43

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 (47) hide show
  1. package/@cds-models/CardanoIndexerService/index.d.ts +47 -0
  2. package/@cds-models/CardanoIndexerService/index.js +7 -0
  3. package/@cds-models/CardanoODataService/index.d.ts +44 -0
  4. package/@cds-models/CardanoODataService/index.js +4 -0
  5. package/@cds-models/CardanoSignService/index.d.ts +3 -0
  6. package/@cds-models/CardanoTransactionService/index.d.ts +3 -0
  7. package/@cds-models/index.d.ts +3 -0
  8. package/@cds-models/odatano/cardano/index.d.ts +33 -0
  9. package/@cds-models/odatano/cardano/index.js +3 -0
  10. package/README.md +195 -195
  11. package/db/schema.cds +27 -0
  12. package/db/types.cds +421 -409
  13. package/package.json +1 -1
  14. package/srv/blockchain/backends/blockfrost-backend.js +1 -0
  15. package/srv/blockchain/backends/koios-backend.js +19 -0
  16. package/srv/blockchain/backends/ogmios-backend.js +16 -12
  17. package/srv/blockchain/cardano-indexer.js +26 -9
  18. package/srv/blockchain/crawler/credential-backfill.d.ts +37 -0
  19. package/srv/blockchain/crawler/credential-backfill.js +124 -0
  20. package/srv/blockchain/crawler/transaction-backfill.d.ts +3 -2
  21. package/srv/blockchain/crawler/transaction-backfill.js +14 -4
  22. package/srv/blockchain/crawler/utxo-set-import.d.ts +20 -1
  23. package/srv/blockchain/crawler/utxo-set-import.js +71 -3
  24. package/srv/blockchain/ledger-state.d.ts +6 -1
  25. package/srv/blockchain/ledger-state.js +3 -0
  26. package/srv/blockchain/stored-chain.js +9 -1
  27. package/srv/blockchain/transaction-building/buildooor-fee-patch.d.ts +17 -0
  28. package/srv/blockchain/transaction-building/buildooor-fee-patch.js +74 -0
  29. package/srv/blockchain/transaction-building/buildooor-tx.d.ts +10 -1
  30. package/srv/blockchain/transaction-building/buildooor-tx.js +55 -19
  31. package/srv/blockchain/transaction-rows.d.ts +1 -1
  32. package/srv/blockchain/transaction-rows.js +2 -1
  33. package/srv/cardano-indexer-service.cds +30 -3
  34. package/srv/cardano-indexer-service.js +48 -3
  35. package/srv/cardano-service.cds +344 -332
  36. package/srv/cardano-service.js +9 -0
  37. package/srv/cbor/index.d.ts +1 -0
  38. package/srv/cbor/index.js +4 -1
  39. package/srv/cbor/plutus-data-json.d.ts +24 -0
  40. package/srv/cbor/plutus-data-json.js +32 -0
  41. package/srv/utils/agent-grants.js +1 -1
  42. package/srv/utils/db-indexes.js +5 -0
  43. package/srv/utils/mappers.d.ts +6 -2
  44. package/srv/utils/mappers.js +20 -0
  45. package/srv/utils/reference-script.d.ts +37 -0
  46. package/srv/utils/reference-script.js +95 -0
  47. package/srv/utils/types.d.ts +19 -0
package/README.md CHANGED
@@ -1,195 +1,195 @@
1
- <p align="center">
2
- <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/npm/@odatano/brand@1/logos/odatano-core-logo-on-dark.svg">
4
- <img src="https://cdn.jsdelivr.net/npm/@odatano/brand@1/logos/odatano-core-logo.svg" alt="ODATANO CORE" height="84">
5
- </picture>
6
- </p>
7
-
8
- # Enterprise OData Services for the Cardano Blockchain
9
-
10
- Funded by [Cardano Catalyst Fund 14](https://projectcatalyst.io/funds/14/sponsored-by-leftovers/sap-cardano-odata-v4-api-with-cap-and-sap-cardano-sdk) all four milestones completed and approved (April 2026).
11
-
12
- **ODATANO** is an SAP CAP–based service that exposes the Cardano blockchain via a standardized **OData V4** interface, enabling enterprise-grade read and write access with native transaction building.
13
-
14
- [![Tests](https://github.com/ODATANO/ODATANO/actions/workflows/test.yaml/badge.svg)](https://github.com/ODATANO/ODATANO/actions/workflows/test.yaml)
15
- [![Coverage](https://codecov.io/gh/ODATANO/ODATANO/branch/main/graph/badge.svg)](https://codecov.io/gh/ODATANO/ODATANO)
16
- [![npm version](https://img.shields.io/npm/v/@odatano/core?logo=npm)](https://www.npmjs.com/package/@odatano/core)
17
- [![npm downloads](https://img.shields.io/npm/dt/@odatano/core?logo=npm&label=downloads&color=blue)](https://www.npmjs.com/package/@odatano/core)
18
- [![License](https://img.shields.io/badge/license-Apache%202.0-yellow)](LICENSE)
19
-
20
-
21
- ## Quick Start
22
-
23
- ### As CAP Plugin (recommended)
24
-
25
- Add ODATANO to any existing SAP CAP project:
26
-
27
- ```bash
28
- npm install @odatano/core @cap-js/sqlite
29
- ```
30
-
31
- ```json
32
- {
33
- "cds": {
34
- "requires": {
35
- "db": { "kind": "sqlite" },
36
- "odatano-core": {
37
- "network": "preview",
38
- "backends": ["blockfrost"]
39
- }
40
- }
41
- }
42
- }
43
- ```
44
-
45
- Put your API key in a `.env` file in the project root (loaded automatically by `cds serve` / `cds watch`) — don't commit it to `package.json`:
46
-
47
- ```bash
48
- # .env
49
- BLOCKFROST_API_KEY=preview_your_api_key_here
50
- ```
51
-
52
- ```bash
53
- cds deploy --to sqlite
54
- cds serve
55
- ```
56
-
57
- > Config in `cds.requires.odatano-core` takes precedence over environment
58
- > variables; a `blockfrostApiKey` set there would override the `.env` value.
59
-
60
- > **Self-hosted Blockfrost-compatible node?** (Dolos MiniBF, Demeter Self-Hosted)
61
- > Set `blockfrostCustomBackend` to the node's base URL (e.g. `http://localhost:3010/api/v0`).
62
- > When set, `blockfrostApiKey` becomes optional. See the [Backend Configuration Guide](docs/guides/BACKEND_CONFIGURATION.md#self-hosted-blockfrost-compatible-backends).
63
-
64
- ### Standalone
65
-
66
- Run ODATANO as a self-contained service (no host CAP project needed):
67
-
68
- ```bash
69
- git clone https://github.com/ODATANO/ODATANO && cd ODATANO
70
- npm ci
71
- cp .env.example .env # set BLOCKFROST_API_KEY, NETWORK, BACKENDS
72
- cds deploy --to sqlite
73
- cds serve
74
- ```
75
-
76
- Or with Docker — this brings up a local **cardano-node + Ogmios + ODATANO** stack
77
- (Preview), with the service pre-wired to the local Ogmios backend:
78
-
79
- ```bash
80
- docker compose up -d # full stack
81
- docker compose up -d cardano-node ogmios # just the chain backend (pre-sync)
82
- docker compose logs -f ogmios # watch sync (/health: 202 syncing, 200 near tip)
83
- ```
84
-
85
- > First sync from genesis takes hours; the node DB persists in a Docker volume so
86
- > restarts resume. Until Ogmios catches up, historical queries fall back to
87
- > Blockfrost (set `BLOCKFROST_API_KEY`).
88
-
89
- Service available at `http://localhost:4004`. See the [Quick Start Guide](docs/QUICK_START.md#local-ogmios--cardano-node-docker) for the local Ogmios stack and full details.
90
-
91
- ## Dev Mode: Mocked Authentication
92
-
93
- > **Heads-up.** `cds serve` uses CAP's mocked auth: `@requires: 'authenticated-user'` accepts any Basic-Auth header against a mock user (`alice`, `bob`, …) — passwords are not checked. Anonymous requests get 401, but anyone reaching the port can authenticate.
94
- >
95
- > Production needs the `[production]` profile (`NODE_ENV=production`), which switches to `auth: xsuaa`. Don't expose a dev-mode instance. See the [Security Guide](docs/guides/SECURITY_GUIDE.md#authentication-xsuaa).
96
- >
97
- > The Docker image runs `NODE_ENV=production` with HTTP basic auth via `@odatano/cap-auth` (`ODATANO_HTTP_PASSWORD` required, user `ODATANO_HTTP_USER` default `odatano`, roles `ODATANO_HTTP_ROLES` default `Admin`; 20 failed attempts per 15 min per client address and user, then 429). `ODATANO_AUTH=dummy` disables authentication for local testing only. `getLiveness()` and `VerifyDataSignature` stay anonymous.
98
- >
99
- > Database of the image: `ODATANO_DB_URL=postgres://user:pw@host:5432/db` selects PostgreSQL (schema deployed on every boot); otherwise SQLite at `ODATANO_DB_PATH` (default `/data/db.sqlite`). `docker compose run --rm --no-deps odatano migrate --from /data/db.sqlite` copies an existing SQLite file into a freshly deployed PostgreSQL.
100
-
101
- ## Services
102
-
103
- | Service | Path | Purpose |
104
- |---|---|---|
105
- | CardanoODataService | `/odata/v4/cardano/` | Read blockchain data (29 entities, 19 actions) |
106
- | CardanoTransactionService | `/odata/v4/cardano-transaction/` | Build & submit transactions (13 actions) |
107
- | CardanoSignService | `/odata/v4/cardano-sign/` | External signing + HSM (9 actions) |
108
- | CardanoIndexerService | `/odata/v4/cardano-indexer/` | Chain crawler / pre-sync control (v2.0, off by default) |
109
- | CardanoWorkerService | `/odata/v4/cardano-worker/` | Asynchronous wallet jobs (v2.0, off by default) |
110
- | CardanoAgentService | `/odata/v4/cardano-agent/` | Agent grants: scoped bearer tokens for agents (v2.0, off by default) |
111
-
112
- Both v2.0 services also publish **CAP events**, so a consumer can subscribe instead of polling —
113
- in-process, no broker required:
114
-
115
- ```js
116
- (await cds.connect.to('CardanoWorkerService')).on('jobConfirmed', ({ data }) => …)
117
- (await cds.connect.to('CardanoIndexerService')).on('blockIndexed', ({ data }) => …)
118
- ```
119
-
120
- ## Agent grants (v2.0, off by default)
121
-
122
- Hand an agent a **scoped, budgeted token** instead of a user.
123
-
124
- ```bash
125
- AGENT_GRANTS_ENABLED=true # or cds.requires.odatano-core.agentGrants.enabled
126
- AGENT_GRANTS_DELEGATE=mocked # CAP auth kind that keeps authenticating non-token requests (default: configured kind)
127
- AGENT_GRANT_ADMIN_RATE_LIMIT=10 # grant administration calls per principal per hour (or agentGrants.adminRateLimit)
128
- AGENT_TOKEN_CACHE_MS=10000 # a resolved token is reused this long before the row is read again; 0 = off (or agentGrants.tokenCacheMs)
129
- ```
130
-
131
- 1. An **Admin** issues a grant (`POST /odata/v4/cardano-agent/CreateAgentGrant`): an allow list of
132
- actions, optionally a worker `walletId` (required for `SubmitWalletJob`/`CancelJob`), allowed job
133
- kinds, a daily budget and an expiry. The response carries the token `odat_…` **once**; the
134
- server stores only its SHA-256.
135
- 2. The agent sends `x-agent-token: odat_…` on any of the six service paths. It runs as the principal
136
- `agent:<grantId>` with the single role `agent-grant`, never as the operator: every
137
- `@requires: 'Admin'` surface (pause/resume, HSM signing, grant administration) refuses it by
138
- construction. Reads and compute-only actions are always allowed; allow-listed actions each cost
139
- one budget unit per UTC day (a build is the service an agent buys); everything else is 403.
140
- Wallet jobs are pinned to the grant's wallet and visible only to the grant that queued them.
141
- 3. `GET /odata/v4/cardano-agent/GetGrantStatus()` tells the agent what it may do and how much budget
142
- is left; `RevokeAgentGrant` turns the token into an unknown token immediately.
143
- 4. Lifecycle (Admin; the same semantics as the gateway's peer services, so one client drives
144
- them all): `UpdateAgentGrant` changes label, allow list, job kinds, daily budget or expiry
145
- (absent = untouched, explicit `null` = cleared; the wallet binding is immutable, 409
146
- `GRANT_REVOKED` on a revoked grant); `RotateAgentGrantToken` returns a fresh token once, the old
147
- one is unknown from the next request; `GetGrantUsage(grantId, since, until)` lists admitted calls
148
- per service and action over up to 366 days (an Admin for any grant, a token for its own). All
149
- administration calls share the per-principal hourly rate limit above.
150
-
151
- Grantable: `Build*`, `SetCollateral`, `CreateSigningRequest`, `VerifySignature`, `Submit*`,
152
- `CheckSubmissionStatus`, `SubmitWalletJob`, `CancelJob`. Never: `SignWithHsm*`, `Pause*`/`Resume*`,
153
- `pauseCrawler`/`resumeCrawler`, grant administration.
154
-
155
- Programmatic seams for other packages (`@odatano/x402` sells grants against a 402 payment):
156
- `issueAgentGrant()`, `updateAgentGrant()`, `rotateAgentGrantToken()`, `revokeAgentGrantById()`,
157
- `getGrantUsage()`, `registerTransportLane()` from `@odatano/core`.
158
-
159
- ## Liveness probe
160
-
161
- `GET /odata/v4/cardano-indexer/getLiveness()` answers `200 { status: "alive", timestamp, uptime,
162
- version, network }` **without credentials** (`@requires: 'any'`) as long as the process runs — no
163
- backend or DB probe, no secrets. The Docker `HEALTHCHECK`, compose and upstream probes use it
164
- instead of the service document, so a wrong operator password no longer reads as "ODATANO down".
165
- Readiness (crawler, worker, backends) stays authenticated: `getStatus()`, `GetWorkerStatus()`,
166
- `GetNetworkInformation`.
167
-
168
- ## Requirements
169
-
170
- - **Node.js >= 22.5** and **@sap/cds >= 10** (peer dependency). CAP 9 hosts cannot load `@odatano/core@2`.
171
- - Upgrading a consumer from 1.x: run **`cds deploy`**. 2.0 adds six tables (`CardanoSyncState`,
172
- `CardanoReorgLog`, `CardanoWorkerWallets`, `CardanoWalletJobs`, `CardanoAgentGrants`,
173
- `CardanoAgentGrantUsage`) plus a `dedupKey` column; without the redeploy the new services answer
174
- `no such table` while the old ones keep working.
175
-
176
- ## Documentation
177
-
178
- | Guide | Description |
179
- |-------|-------------|
180
- | [Quick Start](docs/QUICK_START.md) | Get running in 5 minutes |
181
- | [User Guide](docs/guides/USER_GUIDE.md) | API usage, entities, and examples |
182
- | [Developer Guide](docs/guides/DEVELOPER_GUIDE.md) | Architecture and development |
183
- | [Transaction Workflow](docs/guides/TRANSACTION_WORKFLOW.md) | Build → Sign → Submit flow |
184
- | [Security Guide](docs/guides/SECURITY_GUIDE.md) | Authentication, signing security, HSM |
185
- | [Docker Deployment](docs/guides/DOCKER_DEPLOYMENT.md) | Container deployment |
186
-
187
- ## License
188
-
189
- Apache License 2.0 - see [LICENSE](LICENSE)
190
-
191
- ## Support
192
-
193
- - **Issues**: [GitHub Issues](https://github.com/ODATANO/ODATANO/issues)
194
- - **Project Lead**: Max Weber
195
- - **Contact**: info@odatano.dev
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/npm/@odatano/brand@1/logos/odatano-core-logo-on-dark.svg">
4
+ <img src="https://cdn.jsdelivr.net/npm/@odatano/brand@1/logos/odatano-core-logo.svg" alt="ODATANO CORE" height="84">
5
+ </picture>
6
+ </p>
7
+
8
+ # Enterprise OData Services for the Cardano Blockchain
9
+
10
+ Funded by [Cardano Catalyst Fund 14](https://projectcatalyst.io/funds/14/sponsored-by-leftovers/sap-cardano-odata-v4-api-with-cap-and-sap-cardano-sdk) all four milestones completed and approved (April 2026).
11
+
12
+ **ODATANO** is an SAP CAP–based service that exposes the Cardano blockchain via a standardized **OData V4** interface, enabling enterprise-grade read and write access with native transaction building.
13
+
14
+ [![Tests](https://github.com/ODATANO/ODATANO/actions/workflows/test.yaml/badge.svg)](https://github.com/ODATANO/ODATANO/actions/workflows/test.yaml)
15
+ [![Coverage](https://codecov.io/gh/ODATANO/ODATANO/branch/main/graph/badge.svg)](https://codecov.io/gh/ODATANO/ODATANO)
16
+ [![npm version](https://img.shields.io/npm/v/@odatano/core?logo=npm)](https://www.npmjs.com/package/@odatano/core)
17
+ [![npm downloads](https://img.shields.io/npm/dt/@odatano/core?logo=npm&label=downloads&color=blue)](https://www.npmjs.com/package/@odatano/core)
18
+ [![License](https://img.shields.io/badge/license-Apache%202.0-yellow)](LICENSE)
19
+
20
+
21
+ ## Quick Start
22
+
23
+ ### As CAP Plugin (recommended)
24
+
25
+ Add ODATANO to any existing SAP CAP project:
26
+
27
+ ```bash
28
+ npm install @odatano/core @cap-js/sqlite
29
+ ```
30
+
31
+ ```json
32
+ {
33
+ "cds": {
34
+ "requires": {
35
+ "db": { "kind": "sqlite" },
36
+ "odatano-core": {
37
+ "network": "preview",
38
+ "backends": ["blockfrost"]
39
+ }
40
+ }
41
+ }
42
+ }
43
+ ```
44
+
45
+ Put your API key in a `.env` file in the project root (loaded automatically by `cds serve` / `cds watch`) — don't commit it to `package.json`:
46
+
47
+ ```bash
48
+ # .env
49
+ BLOCKFROST_API_KEY=preview_your_api_key_here
50
+ ```
51
+
52
+ ```bash
53
+ cds deploy --to sqlite
54
+ cds serve
55
+ ```
56
+
57
+ > Config in `cds.requires.odatano-core` takes precedence over environment
58
+ > variables; a `blockfrostApiKey` set there would override the `.env` value.
59
+
60
+ > **Self-hosted Blockfrost-compatible node?** (Dolos MiniBF, Demeter Self-Hosted)
61
+ > Set `blockfrostCustomBackend` to the node's base URL (e.g. `http://localhost:3010/api/v0`).
62
+ > When set, `blockfrostApiKey` becomes optional. See the [Backend Configuration Guide](docs/guides/BACKEND_CONFIGURATION.md#self-hosted-blockfrost-compatible-backends).
63
+
64
+ ### Standalone
65
+
66
+ Run ODATANO as a self-contained service (no host CAP project needed):
67
+
68
+ ```bash
69
+ git clone https://github.com/ODATANO/ODATANO && cd ODATANO
70
+ npm ci
71
+ cp .env.example .env # set BLOCKFROST_API_KEY, NETWORK, BACKENDS
72
+ cds deploy --to sqlite
73
+ cds serve
74
+ ```
75
+
76
+ Or with Docker — this brings up a local **cardano-node + Ogmios + ODATANO** stack
77
+ (Preview), with the service pre-wired to the local Ogmios backend:
78
+
79
+ ```bash
80
+ docker compose up -d # full stack
81
+ docker compose up -d cardano-node ogmios # just the chain backend (pre-sync)
82
+ docker compose logs -f ogmios # watch sync (/health: 202 syncing, 200 near tip)
83
+ ```
84
+
85
+ > First sync from genesis takes hours; the node DB persists in a Docker volume so
86
+ > restarts resume. Until Ogmios catches up, historical queries fall back to
87
+ > Blockfrost (set `BLOCKFROST_API_KEY`).
88
+
89
+ Service available at `http://localhost:4004`. See the [Quick Start Guide](docs/QUICK_START.md#local-ogmios--cardano-node-docker) for the local Ogmios stack and full details.
90
+
91
+ ## Dev Mode: Mocked Authentication
92
+
93
+ > **Heads-up.** `cds serve` uses CAP's mocked auth: `@requires: 'authenticated-user'` accepts any Basic-Auth header against a mock user (`alice`, `bob`, …) — passwords are not checked. Anonymous requests get 401, but anyone reaching the port can authenticate.
94
+ >
95
+ > Production needs the `[production]` profile (`NODE_ENV=production`), which switches to `auth: xsuaa`. Don't expose a dev-mode instance. See the [Security Guide](docs/guides/SECURITY_GUIDE.md#authentication-xsuaa).
96
+ >
97
+ > The Docker image runs `NODE_ENV=production` with HTTP basic auth via `@odatano/cap-auth` (`ODATANO_HTTP_PASSWORD` required, user `ODATANO_HTTP_USER` default `odatano`, roles `ODATANO_HTTP_ROLES` default `Admin`; 20 failed attempts per 15 min per client address and user, then 429). `ODATANO_AUTH=dummy` disables authentication for local testing only. `getLiveness()` and `VerifyDataSignature` stay anonymous.
98
+ >
99
+ > Database of the image: `ODATANO_DB_URL=postgres://user:pw@host:5432/db` selects PostgreSQL (schema deployed on every boot); otherwise SQLite at `ODATANO_DB_PATH` (default `/data/db.sqlite`). `docker compose run --rm --no-deps odatano migrate --from /data/db.sqlite` copies an existing SQLite file into a freshly deployed PostgreSQL.
100
+
101
+ ## Services
102
+
103
+ | Service | Path | Purpose |
104
+ |---|---|---|
105
+ | CardanoODataService | `/odata/v4/cardano/` | Read blockchain data (32 entities, 21 actions) |
106
+ | CardanoTransactionService | `/odata/v4/cardano-transaction/` | Build & submit transactions (13 actions) |
107
+ | CardanoSignService | `/odata/v4/cardano-sign/` | External signing + HSM (9 actions) |
108
+ | CardanoIndexerService | `/odata/v4/cardano-indexer/` | Chain crawler / pre-sync control (v2.0, off by default) |
109
+ | CardanoWorkerService | `/odata/v4/cardano-worker/` | Asynchronous wallet jobs (v2.0, off by default) |
110
+ | CardanoAgentService | `/odata/v4/cardano-agent/` | Agent grants: scoped bearer tokens for agents (v2.0, off by default) |
111
+
112
+ Both v2.0 services also publish **CAP events**, so a consumer can subscribe instead of polling —
113
+ in-process, no broker required:
114
+
115
+ ```js
116
+ (await cds.connect.to('CardanoWorkerService')).on('jobConfirmed', ({ data }) => …)
117
+ (await cds.connect.to('CardanoIndexerService')).on('blockIndexed', ({ data }) => …)
118
+ ```
119
+
120
+ ## Agent grants (v2.0, off by default)
121
+
122
+ Hand an agent a **scoped, budgeted token** instead of a user.
123
+
124
+ ```bash
125
+ AGENT_GRANTS_ENABLED=true # or cds.requires.odatano-core.agentGrants.enabled
126
+ AGENT_GRANTS_DELEGATE=mocked # CAP auth kind that keeps authenticating non-token requests (default: configured kind)
127
+ AGENT_GRANT_ADMIN_RATE_LIMIT=10 # grant administration calls per principal per hour (or agentGrants.adminRateLimit)
128
+ AGENT_TOKEN_CACHE_MS=10000 # a resolved token is reused this long before the row is read again; 0 = off (or agentGrants.tokenCacheMs)
129
+ ```
130
+
131
+ 1. An **Admin** issues a grant (`POST /odata/v4/cardano-agent/CreateAgentGrant`): an allow list of
132
+ actions, optionally a worker `walletId` (required for `SubmitWalletJob`/`CancelJob`), allowed job
133
+ kinds, a daily budget and an expiry. The response carries the token `odat_…` **once**; the
134
+ server stores only its SHA-256.
135
+ 2. The agent sends `x-agent-token: odat_…` on any of the six service paths. It runs as the principal
136
+ `agent:<grantId>` with the single role `agent-grant`, never as the operator: every
137
+ `@requires: 'Admin'` surface (pause/resume, HSM signing, grant administration) refuses it by
138
+ construction. Reads and compute-only actions are always allowed; allow-listed actions each cost
139
+ one budget unit per UTC day (a build is the service an agent buys); everything else is 403.
140
+ Wallet jobs are pinned to the grant's wallet and visible only to the grant that queued them.
141
+ 3. `GET /odata/v4/cardano-agent/GetGrantStatus()` tells the agent what it may do and how much budget
142
+ is left; `RevokeAgentGrant` turns the token into an unknown token immediately.
143
+ 4. Lifecycle (Admin; the same semantics as the gateway's peer services, so one client drives
144
+ them all): `UpdateAgentGrant` changes label, allow list, job kinds, daily budget or expiry
145
+ (absent = untouched, explicit `null` = cleared; the wallet binding is immutable, 409
146
+ `GRANT_REVOKED` on a revoked grant); `RotateAgentGrantToken` returns a fresh token once, the old
147
+ one is unknown from the next request; `GetGrantUsage(grantId, since, until)` lists admitted calls
148
+ per service and action over up to 366 days (an Admin for any grant, a token for its own). All
149
+ administration calls share the per-principal hourly rate limit above.
150
+
151
+ Grantable: `Build*`, `SetCollateral`, `CreateSigningRequest`, `VerifySignature`, `Submit*`,
152
+ `CheckSubmissionStatus`, `SubmitWalletJob`, `CancelJob`. Never: `SignWithHsm*`, `Pause*`/`Resume*`,
153
+ `pauseCrawler`/`resumeCrawler`, grant administration.
154
+
155
+ Programmatic seams for other packages (`@odatano/x402` sells grants against a 402 payment):
156
+ `issueAgentGrant()`, `updateAgentGrant()`, `rotateAgentGrantToken()`, `revokeAgentGrantById()`,
157
+ `getGrantUsage()`, `registerTransportLane()` from `@odatano/core`.
158
+
159
+ ## Liveness probe
160
+
161
+ `GET /odata/v4/cardano-indexer/getLiveness()` answers `200 { status: "alive", timestamp, uptime,
162
+ version, network }` **without credentials** (`@requires: 'any'`) as long as the process runs — no
163
+ backend or DB probe, no secrets. The Docker `HEALTHCHECK`, compose and upstream probes use it
164
+ instead of the service document, so a wrong operator password no longer reads as "ODATANO down".
165
+ Readiness (crawler, worker, backends) stays authenticated: `getStatus()`, `GetWorkerStatus()`,
166
+ `GetNetworkInformation`.
167
+
168
+ ## Requirements
169
+
170
+ - **Node.js >= 22.5** and **@sap/cds >= 10** (peer dependency). CAP 9 hosts cannot load `@odatano/core@2`.
171
+ - Upgrading a consumer from 1.x: run **`cds deploy`**. 2.0 adds six tables (`CardanoSyncState`,
172
+ `CardanoReorgLog`, `CardanoWorkerWallets`, `CardanoWalletJobs`, `CardanoAgentGrants`,
173
+ `CardanoAgentGrantUsage`) plus a `dedupKey` column; without the redeploy the new services answer
174
+ `no such table` while the old ones keep working.
175
+
176
+ ## Documentation
177
+
178
+ | Guide | Description |
179
+ |-------|-------------|
180
+ | [Quick Start](docs/QUICK_START.md) | Get running in 5 minutes |
181
+ | [User Guide](docs/guides/USER_GUIDE.md) | API usage, entities, and examples |
182
+ | [Developer Guide](docs/guides/DEVELOPER_GUIDE.md) | Architecture and development |
183
+ | [Transaction Workflow](docs/guides/TRANSACTION_WORKFLOW.md) | Build → Sign → Submit flow |
184
+ | [Security Guide](docs/guides/SECURITY_GUIDE.md) | Authentication, signing security, HSM |
185
+ | [Docker Deployment](docs/guides/DOCKER_DEPLOYMENT.md) | Container deployment |
186
+
187
+ ## License
188
+
189
+ Apache License 2.0 - see [LICENSE](LICENSE)
190
+
191
+ ## Support
192
+
193
+ - **Issues**: [GitHub Issues](https://github.com/ODATANO/ODATANO/issues)
194
+ - **Project Lead**: Max Weber
195
+ - **Contact**: info@odatano.dev
package/db/schema.cds CHANGED
@@ -786,6 +786,11 @@ entity Transactions {
786
786
  withdrawals : Composition of many TransactionWithdrawals
787
787
  on withdrawals.tx = $self;
788
788
 
789
+ @title : 'Transaction Datums'
790
+ @description: 'Witness-set datums of the transaction (the datums spent outputs with a datum hash refer to). Filled by the chain crawler on Ogmios chain-sync only; the lazy path leaves it empty.'
791
+ datums : Composition of many TransactionDatums
792
+ on datums.tx = $self;
793
+
789
794
  @title : 'Transaction Has Metadata'
790
795
  @description: 'Indicates if transaction has metadata'
791
796
  hasMetadata : Boolean;
@@ -1153,6 +1158,24 @@ entity TransactionRedeemers {
1153
1158
  policyId : Blake2b224;
1154
1159
  }
1155
1160
 
1161
+ @title : 'Transaction Datums'
1162
+ @description: 'Datums of the transaction witness set as the chain crawler saw them (Ogmios chain-sync), byte for byte. They resolve outputs that carry a datum hash without an inline datum. Not written by the lazy path.'
1163
+ @readonly
1164
+ entity TransactionDatums {
1165
+
1166
+ @title : 'Transaction (key)'
1167
+ @description: 'The transaction whose witness set carries the datum'
1168
+ key tx : Association to Transactions;
1169
+
1170
+ @title : 'Datum Hash (key)'
1171
+ @description: 'Blake2b-256 hash of the datum bytes, as outputs reference it in utxo.dataHash'
1172
+ key dataHash : Blake2b256;
1173
+
1174
+ @title : 'Datum'
1175
+ @description: 'PlutusData CBOR hex, the original bytes of the witness set'
1176
+ datum : LargeString;
1177
+ }
1178
+
1156
1179
  @title : 'Transaction Outputs'
1157
1180
  @description: 'Projection for Transaction Outputs'
1158
1181
  @readonly
@@ -1367,6 +1390,10 @@ entity LedgerProtocolParameters {
1367
1390
  @description: 'The coins per UTxO size parameter for calculating min UTxO value'
1368
1391
  coinsPerUtxoSize : String(32);
1369
1392
 
1393
+ @title : 'Minimum Fee per Reference Script Byte'
1394
+ @description: 'Lovelace per byte of reference script on the inputs and reference inputs of a transaction (Conway); the ledger raises the price by 1.2 for every 25600 bytes'
1395
+ minFeeRefScriptCostPerByte : Decimal(12, 6);
1396
+
1370
1397
  @title : 'Coins Per UTxO Word'
1371
1398
  @description: 'The coins per UTxO word parameter for calculating min UTxO value (alonzo legacy)'
1372
1399
  coinsPerUtxoWord : String(32);