scientific-protocol 0.1.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.
- package/LICENSE +21 -0
- package/README.md +138 -0
- package/dist/generated/contracts.d.ts +31442 -0
- package/dist/generated/contracts.js +10623 -0
- package/dist/sdk/client.d.ts +376 -0
- package/dist/sdk/client.js +427 -0
- package/dist/sdk/index.d.ts +8 -0
- package/dist/sdk/index.js +7 -0
- package/dist/sdk/rewards.d.ts +42 -0
- package/dist/sdk/rewards.js +84 -0
- package/dist/sdk/types.d.ts +300 -0
- package/dist/sdk/types.js +1 -0
- package/dist/shared/agent-request-envelope.d.ts +40 -0
- package/dist/shared/agent-request-envelope.js +51 -0
- package/dist/shared/artifact-storage-attestations.d.ts +64 -0
- package/dist/shared/artifact-storage-attestations.js +104 -0
- package/dist/shared/artifact-storage-bundles.d.ts +44 -0
- package/dist/shared/artifact-storage-bundles.js +124 -0
- package/dist/shared/artifact-storage-policy.d.ts +38 -0
- package/dist/shared/artifact-storage-policy.js +47 -0
- package/dist/shared/contracts.d.ts +30 -0
- package/dist/shared/contracts.js +46 -0
- package/dist/shared/deployment.d.ts +52 -0
- package/dist/shared/deployment.js +156 -0
- package/dist/shared/secrets.d.ts +6 -0
- package/dist/shared/secrets.js +30 -0
- package/dist/shared/sha256.d.ts +2 -0
- package/dist/shared/sha256.js +4 -0
- package/package.json +103 -0
- package/schemas/artifact-storage-attestation.schema.json +116 -0
- package/schemas/artifact-storage-bundle.schema.json +107 -0
- package/schemas/claim.schema.json +83 -0
- package/schemas/evaluation.schema.json +96 -0
- package/schemas/replication.schema.json +103 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Scientific Protocol contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Scientific Protocol
|
|
2
|
+
|
|
3
|
+
Scientific Protocol is a decentralized protocol for registering scientific claims, binding them
|
|
4
|
+
to evidence, coordinating replication and review, resolving objective outcomes, and rewarding useful
|
|
5
|
+
scientific work.
|
|
6
|
+
|
|
7
|
+
Claims are the atomic objects. Artifacts are content-addressed. Onchain state stays narrow, while
|
|
8
|
+
indexers, APIs, workers, and storage services remain replaceable node infrastructure.
|
|
9
|
+
|
|
10
|
+
## Repository Boundary
|
|
11
|
+
|
|
12
|
+
This repository contains the protocol implementation, canonical payload schemas, SDKs, generated
|
|
13
|
+
contract bindings, and reference modules for nodes and downstream applications. Developers can
|
|
14
|
+
consume those interfaces through package releases, contract metadata, deployment metadata, direct
|
|
15
|
+
chain access, or the reference API.
|
|
16
|
+
|
|
17
|
+
The public command surface is intentionally small: build and test the contracts, regenerate
|
|
18
|
+
bindings, run a local EVM node, and deploy the protocol contracts to a configured RPC endpoint.
|
|
19
|
+
Application hosting, product release automation, and operated-service scheduling belong in
|
|
20
|
+
downstream application or operator repositories.
|
|
21
|
+
|
|
22
|
+
## Protocol Surface
|
|
23
|
+
|
|
24
|
+
- Solidity contracts for claims, artifacts, replication, escrow, reputation checkpoints, rewards,
|
|
25
|
+
governance, and resolution modules
|
|
26
|
+
- JSON Schemas for canonical claim, replication, evaluation, and artifact-storage payloads
|
|
27
|
+
- TypeScript SDK, generated contract bindings, and Python client
|
|
28
|
+
- Reference API, indexer, worker, and read-model modules
|
|
29
|
+
- Source ingress, artifact persistence, review, work routing, and reward settlement primitives
|
|
30
|
+
- Hardhat tests plus Foundry fuzz, invariant, and gas checks
|
|
31
|
+
|
|
32
|
+
## Development
|
|
33
|
+
|
|
34
|
+
Use Node 22 and npm:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install
|
|
38
|
+
forge install foundry-rs/forge-std@v1.9.7 --no-git --shallow
|
|
39
|
+
npm run validate:env
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Initialize the project-local Node 22 wrapper if host commands need it:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm run node:env:init
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Copy `.env.example` to `.env` if you want explicit local values instead of relying on defaults.
|
|
49
|
+
|
|
50
|
+
Run the core checks:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm run lint
|
|
54
|
+
npm run typecheck
|
|
55
|
+
npm test
|
|
56
|
+
npm run test:forge
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Regenerate checked-in contract artifacts after Solidity changes:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm run build
|
|
63
|
+
npm run generate:contracts
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Refresh the gas baseline when contract behavior changes:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm run gas:snapshot
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Local Protocol Stack
|
|
73
|
+
|
|
74
|
+
Start a local Hardhat node:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm run node
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
In another shell, deploy the protocol contracts to that node:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm run deploy
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
To deploy to another EVM RPC endpoint, set the RPC URL and signer key before running the same
|
|
87
|
+
deploy command:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
SP_RPC_URL=https://your-rpc.example \
|
|
91
|
+
SP_PROTOCOL_ADMIN_PRIVATE_KEY=0x... \
|
|
92
|
+
SP_DEPLOYMENT_PATH=/absolute/path/to/deployment.json \
|
|
93
|
+
npm run deploy
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Reference API
|
|
97
|
+
|
|
98
|
+
The reference API exposes health, read-model, signed public-write, signed operator, reward, work,
|
|
99
|
+
source, artifact, governance, and claim routes. Canonical authority remains onchain plus
|
|
100
|
+
content-addressed artifacts.
|
|
101
|
+
|
|
102
|
+
Useful routes include:
|
|
103
|
+
|
|
104
|
+
- `GET /health`
|
|
105
|
+
- `GET /write-config`
|
|
106
|
+
- `GET /reward-config`
|
|
107
|
+
- `GET /claims`
|
|
108
|
+
- `GET /claims/:claimId`
|
|
109
|
+
- `GET /sources`
|
|
110
|
+
- `GET /work/items`
|
|
111
|
+
|
|
112
|
+
Set `SP_API_MODE=read-model-optional` for deployments that expose health and write configuration
|
|
113
|
+
without a configured read-model database.
|
|
114
|
+
|
|
115
|
+
## Repository Map
|
|
116
|
+
|
|
117
|
+
- `contracts/`: protocol, governance, rewards, escrow, and module contracts
|
|
118
|
+
- `foundry-test/`: Solidity fuzz, invariant, and gas-oriented tests
|
|
119
|
+
- `test/`: Hardhat and TypeScript protocol tests
|
|
120
|
+
- `schemas/`: canonical payload schemas
|
|
121
|
+
- `src/sdk/`: TypeScript SDK
|
|
122
|
+
- `src/generated/`: generated contract bindings
|
|
123
|
+
- `src/api/`: reference protocol API
|
|
124
|
+
- `src/indexer/`: chain projection into a read model
|
|
125
|
+
- `src/workers/`: sync, replication, review, and artifact maintenance workers
|
|
126
|
+
- `src/artifacts/`: artifact persistence, audit, repair, and storage attestation logic
|
|
127
|
+
- `src/sources/`: source canonicalization, extraction, and publication services
|
|
128
|
+
- `ops/`: read-model migrations
|
|
129
|
+
- `python/`: Python client and examples
|
|
130
|
+
|
|
131
|
+
## Contributing
|
|
132
|
+
|
|
133
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md). Security-sensitive reports should follow
|
|
134
|
+
[SECURITY.md](./SECURITY.md).
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
MIT. See [LICENSE](./LICENSE).
|