upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpablof7z <p@f7z.io>2023-07-15 12:24:32 +0200
committerpablof7z <p@f7z.io>2023-07-15 12:24:32 +0200
commite9924bdcde2dc516a891c027bd023f487b73a674 (patch)
treee72755f887032f7cd527fa0895b35f5b258bf437
parentdef620e1ce4417a4e78b5012c3a43adbe105f43e (diff)
add optional bolt11
-rw-r--r--vending-machine.md24
1 files changed, 15 insertions, 9 deletions
diff --git a/vending-machine.md b/vending-machine.md
index 8121ffc..1d08bd2 100644
--- a/vending-machine.md
+++ b/vending-machine.md
@@ -72,7 +72,7 @@ The output of processing the data -- published by the Service Provider.
72 [ "e", "<id-of-68001-event>" ], 72 [ "e", "<id-of-68001-event>" ],
73 [ "p", "<Customer's pubkey>" ], 73 [ "p", "<Customer's pubkey>" ],
74 [ "status", "success", "<more-info>" ], 74 [ "status", "success", "<more-info>" ],
75 [ "amount", "requested-payment-amount" ] 75 [ "amount", "requested-payment-amount", "<optional-bolt11>" ]
76 ] 76 ]
77} 77}
78``` 78```
@@ -80,21 +80,27 @@ The output of processing the data -- published by the Service Provider.
80## Job feedback 80## Job feedback
81Both customers and service providers can give feedback about a job. 81Both customers and service providers can give feedback about a job.
82 82
83The result of the job SHOULD be included in the `content` field. If the output is not text, the `content` field SHOULD be empty and an `output` tag should be used instead as described below. 83The result of the job SHOULD be included in the `content` field.
84 84
85* `status` tag: Service Providers MAY indicate errors or extra info about the results by including them in the `status` tag. 85* `status` tag: Service Providers MAY indicate errors or extra info about the results by including them in the `status` tag.
86* `amount`: millisats that the Service Provider is requesting to be paid. 86* `amount`: millisats that the Service Provider is requesting to be paid. An optional third value can be a bolt11 invoice.
87 87
88# Protocol Flow 88# Protocol Flow
89* Customer publishes a job request 89* Customer publishes a job request
90`{ "kind": 68001, "tags": [ [ "j", "speech-to-text" ], ... ] }` 90`{ "kind": 68001, "tags": [ [ "j", "speech-to-text" ], ... ] }`
91* Service Prpvoders can submit `kind:68003` job-feedback events (e.g. `payment-required`, `processing`, `unprocessable-entity`, etc.).
92* Upon completion, the service provider publishes the result of the job with a `kind:68002` job-result event.
93* Upon acceptance, the user zaps the service provider, tagging the job result event with a `kind:7` 👍 reaction.
91 94
92* Service Providers subsribe to the type of jobs they can perform 95`kind:68002` and `kind:68003` events MAY include an `amount` tag, this can be interpreted as a suggestion to pay. Service Providers
93`{"kinds":[68001], "#j": ["speech-to-text", "image-generation", ... ]}` 96SHOULD use the `payment-required` feedback event to signal that a payment must be done before moving on to the next step.
94 97
95* When a job comes in, the Service Providers who opt to attempt to fulfill the request begin processing it, or they can react to it with feedback for the user (e.g. _payment required_, _unprocessable entity_, etc.) 98## Notes about the protocol flow
96* Upon completion, the service provider publishes the result of the job with a `job-result` event. 99The flow is deliverately left ambiguos, allowing vast flexibility for the interaction between customers and service providers so that
97* Upon acceptance, the user zaps the service provider, tagging the job result event. 100service providers can model their behavior based on their own decisions. Some service providers might choose to submit a `payment-required`
101as the first reaction before sending an `processing` or before delivering `kind:68002` results, some might choose to serve partial results
102for the job (e.g. as a sample), send a `payment-required`to deliver the rest of the results, and some service providers might choose to
103assess likelyhood of payment based on an npub's past behavior and thus serve the job results before requesting payment for the best possible UX.
98 104
99# Payment 105# Payment
100Customers SHOULD pay service providers whose job results they accept by zapping the Service Provider and tagging the `kind:68002` job result. 106Customers SHOULD pay service providers whose job results they accept by zapping the Service Provider and tagging the `kind:68002` job result.
@@ -131,7 +137,7 @@ Service Providers might opt to give feedback about a job.
131A user might choose to not accept a job result for any reason. A user can provide feedback via NIP-25 reactions. 137A user might choose to not accept a job result for any reason. A user can provide feedback via NIP-25 reactions.
132The `content` of the `kind:7` event SHOULD include a description of how the user reacted to the job result. 138The `content` of the `kind:7` event SHOULD include a description of how the user reacted to the job result.
133 139
134## Explicitly not addressed in this NIP 140## Not addressed in this NIP
135 141
136### Reputation system 142### Reputation system
137Service providers are at obvious risk of having their results not compensated. Mitigation of this risk is up to service providers to figure out (i.e. building reputation systems, requiring npub "balances", etc, etc). 143Service providers are at obvious risk of having their results not compensated. Mitigation of this risk is up to service providers to figure out (i.e. building reputation systems, requiring npub "balances", etc, etc).