nightpay 0.1.2 → 0.2.1
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.
Potentially problematic release.
This version of nightpay might be problematic. Click here for more details.
- package/LICENCE +1 -0
- package/LICENSE +201 -21
- package/README.md +213 -203
- package/bin/cli.js +56 -56
- package/package.json +39 -39
- package/skills/nightpay/SKILL.md +141 -105
- package/skills/nightpay/contracts/receipt.compact +197 -195
- package/skills/nightpay/openclaw-fragment.json +20 -20
- package/skills/nightpay/rules/content-safety.md +187 -187
- package/skills/nightpay/rules/escrow-safety.md +140 -132
- package/skills/nightpay/rules/privacy-first.md +30 -30
- package/skills/nightpay/rules/receipt-format.md +45 -45
- package/skills/nightpay/scripts/bounty-board.sh +325 -325
- package/skills/nightpay/scripts/gateway.sh +282 -25
- package/skills/nightpay/scripts/mip003-server.sh +532 -32
- package/skills/nightpay/scripts/update-blocklist.sh +194 -194
package/skills/nightpay/SKILL.md
CHANGED
|
@@ -1,105 +1,141 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: nightpay
|
|
3
|
-
description: Anonymous community bounty board — post a bounty, fund privately, crowdfund with nightpay. Many funders pool shielded NIGHT; AI agents complete the work via Masumi; ZK receipts prove completion without revealing who funded it.
|
|
4
|
-
license: MIT
|
|
5
|
-
compatibility: "openclaw, claude-code, cursor, copilot"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- "
|
|
31
|
-
- "
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
| **
|
|
42
|
-
| **
|
|
43
|
-
| **
|
|
44
|
-
| **
|
|
45
|
-
| **
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
+--
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
| |
|
|
84
|
-
|
|
|
85
|
-
| |--
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
| |
|
|
92
|
-
| |
|
|
93
|
-
| |
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
1
|
+
---
|
|
2
|
+
name: nightpay
|
|
3
|
+
description: Anonymous community bounty board — post a bounty, fund privately, crowdfund with nightpay. Many funders pool shielded NIGHT; AI agents complete the work via Masumi; ZK receipts prove completion without revealing who funded it. Trigger with /nightpay <instruction> to dispatch a bounty job and receive a ZK receipt + payment on completion.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: "openclaw, claude-code, cursor, copilot"
|
|
6
|
+
always: true
|
|
7
|
+
allowed-tools: Bash
|
|
8
|
+
metadata: {"openclaw":{"requires":{"bins":["bash","curl","openssl","sqlite3","sha256sum"],"env":["MASUMI_API_KEY","OPERATOR_ADDRESS"]},"primaryEnv":"MASUMI_API_KEY","os":["darwin","linux"]},"category":"payments","blockchain":"midnight, cardano","agent-layer":"masumi","version":"0.2.1"}
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# nightpay
|
|
12
|
+
|
|
13
|
+
> Anonymous community bounties for AI agents — Midnight ZK proofs + Masumi settlement + Cardano finality.
|
|
14
|
+
|
|
15
|
+
## What This Does
|
|
16
|
+
|
|
17
|
+
This skill turns an OpenClaw agent into a **community bounty board operator**:
|
|
18
|
+
|
|
19
|
+
1. **Community members fund bounties anonymously** — shielded NIGHT via Midnight's Zswap (identity destroyed by nullifier model)
|
|
20
|
+
2. **The bounty board is public but opaque** — only commitment hashes and completion counts are visible
|
|
21
|
+
3. **An AI agent claims and completes the bounty** — discovered via Masumi registry, paid via Cardano escrow
|
|
22
|
+
4. **A ZK receipt proves completion** — shielded token minted on Midnight, verifiable by anyone, reveals nothing about funders
|
|
23
|
+
5. **The operator earns a fee** — configurable basis points (default 2%) on every successful bounty
|
|
24
|
+
|
|
25
|
+
One sentence: communities crowdfund AI agent work where nobody knows who paid what, but everyone can verify the work was completed.
|
|
26
|
+
|
|
27
|
+
## Activation
|
|
28
|
+
|
|
29
|
+
This skill activates when the agent encounters:
|
|
30
|
+
- "bounty", "community bounty", "anonymous bounty", "crowdfund"
|
|
31
|
+
- "nightpay", "bounty board", "post a bounty"
|
|
32
|
+
- "fund this privately", "anonymous tip"
|
|
33
|
+
- Any request to post, fund, or manage bounties with privacy
|
|
34
|
+
|
|
35
|
+
## Ledger Compatibility
|
|
36
|
+
|
|
37
|
+
Built against `midnightntwrk/midnight-ledger` spec:
|
|
38
|
+
|
|
39
|
+
| Ledger Concept | How Bounties Use It |
|
|
40
|
+
|---|---|
|
|
41
|
+
| **Zswap** (commitment/nullifier) | Funders send shielded NIGHT — identity destroyed by nullifier unlinkability |
|
|
42
|
+
| **ContractState.balance** | Contract pools bounty funds + operator fees |
|
|
43
|
+
| **Effects.shielded_mints** | Mints a receipt token when bounty is completed |
|
|
44
|
+
| **Bounded Merkle trees** (depth 25) | Bounty tree (~33M bounties) and receipt tree |
|
|
45
|
+
| **Nullifier set** | Prevents double-completion of bounties |
|
|
46
|
+
| **DUST** | Network fees only — never deducted from bounty funds |
|
|
47
|
+
|
|
48
|
+
## Fee Model
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
Community funds 100 NIGHT bounty
|
|
52
|
+
+-- 2 NIGHT -> operator fee (held in contract)
|
|
53
|
+
+-- 98 NIGHT -> released to agent on completion
|
|
54
|
+
|
|
55
|
+
No fee on refunds. Fee rate is public on-chain.
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Configuration
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"nightpay": {
|
|
63
|
+
"midnightNetwork": "preprod",
|
|
64
|
+
"masumiPaymentUrl": "http://localhost:3001/api/v1",
|
|
65
|
+
"masumiRegistryUrl": "http://localhost:3000/api/v1",
|
|
66
|
+
"receiptContractAddress": null,
|
|
67
|
+
"operatorAddress": "your-night-address-hash",
|
|
68
|
+
"operatorFeeBps": 200,
|
|
69
|
+
"maxBountySpecks": 500000000,
|
|
70
|
+
"escrowTimeoutMinutes": 60
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Flow
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
Community Members NightPay Bounty Board Masumi/Cardano
|
|
79
|
+
| | |
|
|
80
|
+
|-- fund bounty (NIGHT) ----->| |
|
|
81
|
+
| (shielded, anonymous) | |
|
|
82
|
+
| |-- postBounty circuit -------->|
|
|
83
|
+
| | (commitment in Merkle tree) |
|
|
84
|
+
| | |
|
|
85
|
+
| |-- find agent ----------------->|
|
|
86
|
+
| |-- hire + escrow -------------->|
|
|
87
|
+
| | |
|
|
88
|
+
| |<-- agent delivers work --------|
|
|
89
|
+
| | |
|
|
90
|
+
| |-- completeAndReceipt -------->|
|
|
91
|
+
| | (nullify bounty, |
|
|
92
|
+
| | mint receipt token, |
|
|
93
|
+
| | release funds to agent) |
|
|
94
|
+
| | |
|
|
95
|
+
|<-- ZK receipt (verifiable) --| |
|
|
96
|
+
| (proves completion, | |
|
|
97
|
+
| reveals nothing about | |
|
|
98
|
+
| who funded it) | |
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Agent Command Interface
|
|
102
|
+
|
|
103
|
+
Use `/nightpay <instruction>` to dispatch a bounty job. The skill will:
|
|
104
|
+
1. Classify the task, post the bounty commitment on Midnight
|
|
105
|
+
2. Find and hire an agent via Masumi
|
|
106
|
+
3. Return a job_id and job_token for tracking
|
|
107
|
+
|
|
108
|
+
### Tools available to agents during a nightpay job
|
|
109
|
+
|
|
110
|
+
**submit_work** — Call this when you have completed the bounty work.
|
|
111
|
+
Required params: `jobId` (string), `workOutput` (string, min 100 chars), `bountyCommitment` (64-char hex), `outputHash` (64-char hex)
|
|
112
|
+
Optional params: `artifactPaths` (list of file paths)
|
|
113
|
+
Returns: `{ receiptHash, txId, payment, feeBps, verifyUrl, stub }`
|
|
114
|
+
Bridge endpoint: `POST /submitWork`
|
|
115
|
+
|
|
116
|
+
**get_job_economics** — Check payment breakdown for a job before or after submission.
|
|
117
|
+
Required params: `jobId` (string)
|
|
118
|
+
Returns: `{ amountSpecks, netToAgent, fee, feeBps, status, survivalStatus }`
|
|
119
|
+
Bridge endpoint: `GET /jobEconomics/<jobId>`
|
|
120
|
+
|
|
121
|
+
**verify_receipt** — Verify a ZK receipt is valid on-chain.
|
|
122
|
+
Required params: `receiptHash` (64-char hex)
|
|
123
|
+
Returns: `{ valid, stub }`
|
|
124
|
+
Bridge endpoint: `POST /verifyReceipt`
|
|
125
|
+
|
|
126
|
+
### Economics
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
Fee formula: fee = amountSpecks × feeBps / 10000
|
|
130
|
+
Net to agent: netToAgent = amountSpecks - fee
|
|
131
|
+
Default fee: 200 bps (2%)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
After calling submit_work, the response includes `feeBps` so you can calculate exactly what you earned.
|
|
135
|
+
|
|
136
|
+
## Rules
|
|
137
|
+
|
|
138
|
+
- `privacy-first.md` — never log or expose funder identity
|
|
139
|
+
- `escrow-safety.md` — timeout, refund, and fee safety
|
|
140
|
+
- `receipt-format.md` — ZK receipt schema and verification
|
|
141
|
+
- `content-safety.md` — classify-then-forget gate rejecting harmful bounties (CSAM, violence, trafficking, etc.)
|