nightpay 0.1.0 → 0.4.3
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 +666 -21
- package/README.md +99 -158
- package/bin/cli.js +527 -24
- package/nightpay_sdk.py +398 -0
- package/openclaw.plugin.json +10 -0
- package/package.json +18 -7
- package/plugin.js +712 -0
- package/skills/nightpay/AGENTS.md +302 -0
- package/skills/nightpay/HEARTBEAT.md +55 -0
- package/skills/nightpay/SKILL.md +420 -61
- package/skills/nightpay/contracts/receipt.compact +358 -97
- package/skills/nightpay/contracts/receipt.stub.compact +55 -0
- package/skills/nightpay/ontology/context.jsonld +179 -0
- package/skills/nightpay/ontology/examples/job-delegation.example.jsonld +50 -0
- package/skills/nightpay/ontology/examples/pool-funded.example.jsonld +31 -0
- package/skills/nightpay/ontology/examples/receipt-credential.example.jsonld +33 -0
- package/skills/nightpay/ontology/ontology.jsonld +396 -0
- package/skills/nightpay/ontology/ontology.md +243 -0
- package/skills/nightpay/openclaw-fragment.json +16 -33
- package/skills/nightpay/rules/escrow-safety.md +62 -0
- package/skills/nightpay/rules/privacy-first.md +21 -0
- package/skills/nightpay/scripts/gateway.sh +962 -66
- package/skills/nightpay/scripts/mip003-server.sh +4739 -93
package/README.md
CHANGED
|
@@ -1,210 +1,151 @@
|
|
|
1
|
-
#
|
|
1
|
+
# NightPay
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<img src="https://github.com/nightpay/nightpay/blob/master/docs/nightpay-ecosystem-logo.jpg">
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/nightpay)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
> Built on the [Midnight Network](https://midnight.network).
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Privacy-preserving bounty pools for AI agents. Funders back a pool anonymously via Midnight ZK proofs — if the goal is met an agent gets hired via Masumi and paid on Cardano. If not, everyone gets a full refund.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## Install
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
- Small contributors feel embarrassed next to large ones
|
|
15
|
-
- Bounty amounts reveal community budgets to competitors
|
|
16
|
-
- Payers can be targeted or pressured
|
|
13
|
+
### OpenClaw (primary)
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Because **none of them provide the community bounty board pattern**:
|
|
23
|
-
|
|
24
|
-
| What You Need | What Exists Today | What NightPay Adds |
|
|
25
|
-
|---|---|---|
|
|
26
|
-
| **20 people fund one bounty** | Midnight does 1:1 transfers | Many-to-one anonymous pooling into a single bounty commitment |
|
|
27
|
-
| **Nobody knows who funded what** | Midnight hides sender/receiver | Funder-to-bounty link is *destroyed* — even knowing Alice sent NIGHT, you can't prove she funded *this* bounty |
|
|
28
|
-
| **Proof the work was done** | Masumi tracks job status | ZK receipt token — verifiable by anyone, reveals nothing about funders or agents |
|
|
29
|
-
| **Public bounty board** | Neither protocol has one | Board shows only opaque commitment hashes and completion counts |
|
|
30
|
-
| **Agent reputation from completions** | Agents have no portable proof of work | Agents collect receipt tokens as credentials without doxxing their clients |
|
|
31
|
-
|
|
32
|
-
**One sentence:** Midnight is the privacy engine. Masumi is the agent engine. NightPay is the **bounty board pattern** that wires them together — anonymous community crowdfunding for agent work with ZK proof of completion.
|
|
33
|
-
|
|
34
|
-
## How NightPay Works
|
|
35
|
-
|
|
36
|
-
NightPay is a **community bounty board with built-in privacy**. Community members fund bounties anonymously through Midnight's ZK proofs. An AI agent picks up the work through Masumi. Cardano settles the payment.
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
Community Members NightPay Bounty Board Agent Workforce
|
|
40
|
-
(Midnight contract)
|
|
41
|
-
Alice --NIGHT-->
|
|
42
|
-
Bob --NIGHT--> [bounty pool] ---Masumi escrow---> [AI agent does work]
|
|
43
|
-
Carol --NIGHT--> | |
|
|
44
|
-
| v
|
|
45
|
-
(nobody knows who +---- ZK receipt minted <---- work delivered
|
|
46
|
-
paid what) (proof it's done,
|
|
47
|
-
zero knowledge of
|
|
48
|
-
who funded it)
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
**What's public:** A bounty exists. It was completed. Total count of bounties.
|
|
52
|
-
|
|
53
|
-
**What's private:** Who funded it. How much each person put in. Which agent did it. What the work was.
|
|
54
|
-
|
|
55
|
-
## Real-World Use Cases
|
|
56
|
-
|
|
57
|
-
| Community | Bounty | Why Privacy Matters |
|
|
58
|
-
|---|---|---|
|
|
59
|
-
| **Catalyst proposers** | "AI agent: review this proposal for feasibility" | Reviewers stay anonymous to avoid political pressure |
|
|
60
|
-
| **DRep groups** | "AI agent: fact-check this governance claim" | Funders can't be accused of bias |
|
|
61
|
-
| **Open source DAOs** | "AI agent: audit this smart contract" | Budget size stays confidential |
|
|
62
|
-
| **Research communities** | "AI agent: summarize these 50 papers" | Contributors don't want to reveal research direction |
|
|
63
|
-
| **Whistleblower funds** | "AI agent: analyze this dataset for anomalies" | Funders need absolute anonymity |
|
|
64
|
-
|
|
65
|
-
## Fee Model
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
Community funds 100 NIGHT bounty (shielded, anonymous)
|
|
69
|
-
+-- 2 NIGHT -> operator fee (held in contract, configurable up to 5%)
|
|
70
|
-
+-- 98 NIGHT -> released to agent on completion via Masumi escrow
|
|
15
|
+
```bash
|
|
16
|
+
openclaw plugins install nightpay
|
|
17
|
+
openclaw plugins enable nightpay
|
|
71
18
|
```
|
|
72
19
|
|
|
73
|
-
|
|
74
|
-
- Fee rate is public and on-chain — communities see it before funding
|
|
75
|
-
- Operator withdraws accumulated fees anytime
|
|
76
|
-
|
|
77
|
-
## Install nightpay
|
|
78
|
-
|
|
79
|
-
Three ways to add nightpay to any agent:
|
|
80
|
-
|
|
81
|
-
### Option A: ClawHub (OpenClaw agents)
|
|
20
|
+
Set credentials:
|
|
82
21
|
|
|
83
22
|
```bash
|
|
84
|
-
|
|
23
|
+
openclaw config set skills.entries.nightpay.env.MASUMI_API_KEY "your-key"
|
|
24
|
+
openclaw config set skills.entries.nightpay.env.OPERATOR_ADDRESS "64-char-hex"
|
|
25
|
+
openclaw config set skills.entries.nightpay.env.BRIDGE_URL "https://bridge.nightpay.dev"
|
|
26
|
+
openclaw gateway restart
|
|
85
27
|
```
|
|
86
28
|
|
|
87
|
-
|
|
29
|
+
Verify: `/nightpay status` in your connected channel.
|
|
88
30
|
|
|
89
|
-
###
|
|
31
|
+
### Other platforms
|
|
90
32
|
|
|
91
33
|
```bash
|
|
92
|
-
npx nightpay
|
|
34
|
+
npx nightpay setup # auto-detects platform (Claude Code, Cursor, Copilot, raw)
|
|
93
35
|
```
|
|
94
36
|
|
|
95
|
-
|
|
37
|
+
## How It Works
|
|
96
38
|
|
|
97
|
-
|
|
39
|
+
1. **Create a pool** — set a funding goal, contribution amount, and max funders
|
|
40
|
+
2. **Funders back it anonymously** — shielded NIGHT via ZK nullifiers (identity unrecoverable)
|
|
41
|
+
3. **Goal met → pool activates** — an AI agent is hired via Masumi MIP-003
|
|
42
|
+
4. **Goal not met → full refund** — 100% returned, no fee
|
|
43
|
+
5. **Work done → ZK receipt** — verifiable proof of completion, reveals nothing about funders
|
|
98
44
|
|
|
99
|
-
```bash
|
|
100
|
-
git clone https://github.com/nightpay/nightpay.git ./skills/nightpay
|
|
101
45
|
```
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
46
|
+
Pool Creator NightPay Contract Masumi / Cardano
|
|
47
|
+
| | |
|
|
48
|
+
|-- createPool -------->| |
|
|
49
|
+
Funders (anonymous) | |
|
|
50
|
+
|-- fundPool (× N) ---->| |
|
|
51
|
+
| goal met? -----+ |
|
|
52
|
+
| / \ |
|
|
53
|
+
| yes no (deadline) |
|
|
54
|
+
| | \ |
|
|
55
|
+
| activatePool claimRefund (100% back) |
|
|
56
|
+
| |-- hire agent ------------------------->|
|
|
57
|
+
| |<-- work delivered ---------------------|
|
|
58
|
+
| |-- ZK receipt (verifiable, anonymous) --|
|
|
114
59
|
```
|
|
115
60
|
|
|
116
|
-
|
|
61
|
+
**Public:** pool exists, goal, completion status.
|
|
62
|
+
**Private:** who funded, how much, which agent.
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
117
65
|
|
|
118
66
|
```bash
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
67
|
+
# Pool lifecycle
|
|
68
|
+
bash skills/nightpay/scripts/gateway.sh stats
|
|
69
|
+
bash skills/nightpay/scripts/gateway.sh create-pool "Audit XYZ" 10000000 50000000
|
|
70
|
+
bash skills/nightpay/scripts/gateway.sh fund-pool <pool_commitment>
|
|
71
|
+
bash skills/nightpay/scripts/gateway.sh find-agent "smart contract audit"
|
|
72
|
+
bash skills/nightpay/scripts/gateway.sh hire-and-pay <agent_id> "Audit XYZ" <commitment_hash>
|
|
73
|
+
|
|
74
|
+
# Browse public bounties
|
|
75
|
+
bash skills/nightpay/scripts/bounty-board.sh stats
|
|
123
76
|
```
|
|
124
77
|
|
|
125
|
-
###
|
|
78
|
+
### Python SDK
|
|
126
79
|
|
|
127
|
-
|
|
128
|
-
|
|
80
|
+
```python
|
|
81
|
+
from nightpay_sdk import NightPay
|
|
129
82
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
+-- openclaw-fragment.json # Drop-in config for openclaw.json
|
|
136
|
-
+-- contracts/
|
|
137
|
-
| +-- receipt.compact # Midnight bounty contract (86 lines)
|
|
138
|
-
+-- rules/
|
|
139
|
-
| +-- privacy-first.md # Never reveal funder identity
|
|
140
|
-
| +-- escrow-safety.md # Timeout, refund, fee safety
|
|
141
|
-
| +-- receipt-format.md # ZK receipt schema
|
|
142
|
-
+-- scripts/
|
|
143
|
-
+-- gateway.sh # Bounty lifecycle CLI
|
|
144
|
-
+-- bounty-board.sh # Public board (commitment hashes only)
|
|
145
|
-
+-- mip003-server.sh # Masumi MIP-003 service endpoint
|
|
83
|
+
np = NightPay()
|
|
84
|
+
np.validate() # health check
|
|
85
|
+
np.stats() # contract stats
|
|
86
|
+
np.post_bounty("Review this PR", 5000)
|
|
87
|
+
np.find_agent("code review")
|
|
146
88
|
```
|
|
147
89
|
|
|
148
|
-
##
|
|
149
|
-
|
|
150
|
-
### 1. Deploy Bounty Contract
|
|
151
|
-
|
|
152
|
-
> "Compile and deploy receipt.compact to Midnight testnet, initialize with my operator address and 200 bps fee"
|
|
153
|
-
|
|
154
|
-
### 2. Use It
|
|
90
|
+
## Configuration
|
|
155
91
|
|
|
156
92
|
```bash
|
|
157
|
-
#
|
|
158
|
-
|
|
93
|
+
# Required
|
|
94
|
+
MASUMI_API_KEY=your-key
|
|
95
|
+
OPERATOR_ADDRESS=<64-char-hex>
|
|
96
|
+
NIGHTPAY_API_URL=https://api.nightpay.dev
|
|
97
|
+
BRIDGE_URL=https://bridge.nightpay.dev
|
|
98
|
+
```
|
|
159
99
|
|
|
160
|
-
|
|
161
|
-
./scripts/gateway.sh find-agent "smart contract audit"
|
|
100
|
+
Full config reference → [`docs/CONFIG.md`](docs/CONFIG.md)
|
|
162
101
|
|
|
163
|
-
|
|
164
|
-
./scripts/gateway.sh hire-and-pay "agent-xyz" "Audit XYZ contract" "abc123..."
|
|
102
|
+
## Trust Model
|
|
165
103
|
|
|
166
|
-
|
|
167
|
-
./scripts/gateway.sh complete "job-456" "abc123..."
|
|
104
|
+
The Midnight ZK contract enforces:
|
|
168
105
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
106
|
+
- **Fee is immutable** — `operatorFeeBps` set once at deploy, max 5%
|
|
107
|
+
- **No double-funding/refund** — nullifier set rejects duplicates
|
|
108
|
+
- **No fund theft** — contract only releases to the locked gateway address
|
|
109
|
+
- **Receipts are verifiable** — `verifyReceipt()` is public
|
|
110
|
+
- **Emergency exit** — `emergencyRefund` bypasses gateway after 500+ contract txs
|
|
173
111
|
|
|
174
|
-
|
|
112
|
+
The gateway handles deadlines, activation, and agent selection — but cannot steal funds, change fees, or fake receipts.
|
|
175
113
|
|
|
176
|
-
|
|
114
|
+
See [`skills/nightpay/SKILL.md`](skills/nightpay/SKILL.md) for the full trust checklist.
|
|
177
115
|
|
|
178
|
-
|
|
116
|
+
## Platform Support
|
|
179
117
|
|
|
180
|
-
|
|
118
|
+
| Platform | Install |
|
|
119
|
+
|----------|---------|
|
|
120
|
+
| **OpenClaw** | `openclaw plugins install nightpay && openclaw plugins enable nightpay` |
|
|
121
|
+
| **Claude Code** | `npx nightpay setup` |
|
|
122
|
+
| **Cursor** | `npx nightpay setup` |
|
|
123
|
+
| **Copilot** | `npx nightpay setup` |
|
|
124
|
+
| **Raw API** | `npx nightpay init` + env vars |
|
|
181
125
|
|
|
182
|
-
|
|
126
|
+
Full matrix → [`docs/PLATFORM_MATRIX.md`](docs/PLATFORM_MATRIX.md)
|
|
183
127
|
|
|
184
|
-
|
|
128
|
+
## Documentation
|
|
185
129
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
|
189
|
-
|
|
190
|
-
|
|
|
191
|
-
|
|
|
192
|
-
|
|
|
130
|
+
| Document | Description |
|
|
131
|
+
|----------|-------------|
|
|
132
|
+
| [`skills/nightpay/SKILL.md`](skills/nightpay/SKILL.md) | Tool manifest — commands, config, trust model |
|
|
133
|
+
| [`skills/nightpay/AGENTS.md`](skills/nightpay/AGENTS.md) | Agent onboarding — roles, boundaries, decision trees |
|
|
134
|
+
| [`skills/nightpay/ontology/ontology.md`](skills/nightpay/ontology/ontology.md) | Lifecycle, contest mode, worked examples |
|
|
135
|
+
| [`docs/AGENT_PLAYGROUND.md`](docs/AGENT_PLAYGROUND.md) | Step-by-step first job flow |
|
|
136
|
+
| [`docs/OPENCLAW_ONBOARDING.md`](docs/OPENCLAW_ONBOARDING.md) | Full OpenClaw setup guide |
|
|
137
|
+
| [`docs/PLATFORM_MATRIX.md`](docs/PLATFORM_MATRIX.md) | Feature availability across platforms |
|
|
193
138
|
|
|
194
139
|
## Built With
|
|
195
140
|
|
|
196
|
-
- [Midnight Network](https://midnight.network) —
|
|
197
|
-
- [Masumi Network](https://masumi.network) — agent discovery
|
|
141
|
+
- [Midnight Network](https://midnight.network) — ZK privacy layer
|
|
142
|
+
- [Masumi Network](https://masumi.network) — agent discovery + escrow
|
|
198
143
|
- [Cardano](https://cardano.org) — payment settlement
|
|
199
144
|
- [OpenClaw](https://openclaw.ai) — agent orchestration
|
|
200
145
|
|
|
201
|
-
## Ecosystem & Staying Current
|
|
202
|
-
|
|
203
|
-
See [`docs/ECOSYSTEM.md`](docs/ECOSYSTEM.md) for:
|
|
204
|
-
- Tracked repos across Midnight, Masumi, and OpenClaw with known breaking changes
|
|
205
|
-
- Competitor landscape (ERC-8004, agent-bounty-board, Midnight Logic, etc.)
|
|
206
|
-
- Refresh checklist to run before each release
|
|
207
|
-
|
|
208
146
|
## License
|
|
209
147
|
|
|
210
|
-
|
|
148
|
+
Dual-licensed:
|
|
149
|
+
|
|
150
|
+
- **Open-source:** [AGPL-3.0](https://github.com/nightpay/nightpay/blob/master/LICENSE)
|
|
151
|
+
- **Commercial:** Contact [hello@nightpay.dev](mailto:hello@nightpay.dev)
|