From 9d0b5fc3177565299198e30b46d9b160610193ce Mon Sep 17 00:00:00 2001 From: Oscar Merry Date: Sun, 30 Jun 2024 16:05:11 +0100 Subject: [PATCH 1/3] Add Generic Payment Event --- XX.md | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 XX.md diff --git a/XX.md b/XX.md new file mode 100644 index 00000000..695cb8bf --- /dev/null +++ b/XX.md @@ -0,0 +1,85 @@ +NIP-XX +====== + +Generic Payment +------------------------- + +`draft` `optional` + +This NIP defines kind `30090` as a generic payment event that can represent any payment on nostr. + +## Rationale: + +Many applications that use nostr as their social layer have payments as a core part of their functionality which are not necessarily nostr-native in the form of a zap. + +It is still valuable to represent these payments on nostr so they can be shared, rendered, and indexed across different clients. + +To avoid fake payments - the payment events are signed by a semi-trusted provider which in most cases will be the app that the user is posting from. + +The events are parameterized replaceable events so that if the `payer` or `payee` joins nostr after the payment was made the payment events can be updated and assigned to their pubkey. + +## Kind `30090` + +- `["d", ""]` +- `["currency", "BTC"]` - the ISO 4217 (https://en.wikipedia.org/wiki/ISO_4217) currency code of the payment with `BTC` used for bitcoin +- `["amount", "0.001"]` - the payment amount formatted as a string +- `["payer", "", "", ""]` - the entity paying +- `["payee", "", "", ""]` - the entity being paid +- `["metadata": "{}"]` - optional generic metadata + +--- + + +### Examples: + +_An anonymous donation to the human rights foundation with an on-chain bitcoin payment:_ + +```jsonc +{ + "kind": 30090, + "tags": [ + ["d", "867038d3-5648-4f64-ab9d-0a1f38f00b67"], + ["currency", "BTC"], + ["amount", "0.01"], + ["payer", ""], + ["payee", ""], + ["metadata": "{\"program\":\"Bitcoin Development Fund\"}"] + ], + "content": "", +} +``` + + +_An anonymous user donating to a gofundme page in dollars:_ + +```jsonc +{ + "kind": 30090, + "tags": [ + ["d", "64eb241d-d05b-42ba-988a-1e24666a7cab"], + ["currency", "USD"], + ["amount", "1000"], + ["payee", ""], + ], + "content": "", +} +``` + +_A Podcasting 2.0 payment:_ + +```jsonc +{ + "kind": 30090, + "tags": [ + ["d", "f8604a8f-1ad5-4e90-a2f5-3a5e63cd7330"], + ["currency", "BTC"], + ["amount", "0.001"], + ["payer", ""], + ["payee", "", "", "The Joe Rogan Experience"], + ["i", "podcast:guid:123"], + ["i", "podcast:item:guid:123"], + ["metadata", "{\"action\": \"boost\"}"] + ], + "content": "Great episode!", +} +``` \ No newline at end of file From a9875f17a3740b56d52f5827d77e621d811bf6e2 Mon Sep 17 00:00:00 2001 From: Oscar Merry Date: Thu, 15 May 2025 14:46:49 +0100 Subject: [PATCH 2/3] Use Minor Currency Unit --- XX.md | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/XX.md b/XX.md index 695cb8bf..b88d9468 100644 --- a/XX.md +++ b/XX.md @@ -14,15 +14,18 @@ Many applications that use nostr as their social layer have payments as a core p It is still valuable to represent these payments on nostr so they can be shared, rendered, and indexed across different clients. -To avoid fake payments - the payment events are signed by a semi-trusted provider which in most cases will be the app that the user is posting from. +## Generic Payment Events - Kind `30090` -The events are parameterized replaceable events so that if the `payer` or `payee` joins nostr after the payment was made the payment events can be updated and assigned to their pubkey. +Generic payment events are kind `30090` parameterized replaceable events signed by a semi-trusted provider which could be either: -## Kind `30090` +- the app / service the user is sending the payment from +- the receiving users wallet pubkey (similar to zap receipts) + +The events are parameterized replaceable so that if the `payer` or `payee` joins nostr after the payment was made, the payment events can be updated and assigned to their pubkey. - `["d", ""]` - `["currency", "BTC"]` - the ISO 4217 (https://en.wikipedia.org/wiki/ISO_4217) currency code of the payment with `BTC` used for bitcoin -- `["amount", "0.001"]` - the payment amount formatted as a string +- `["amount", "100000"]` - the payment amount in the currency's minor unit (usd cents, btc millisatoshis) formatted as a string - `["payer", "", "", ""]` - the entity paying - `["payee", "", "", ""]` - the entity being paid - `["metadata": "{}"]` - optional generic metadata @@ -32,7 +35,7 @@ The events are parameterized replaceable events so that if the `payer` or `payee ### Examples: -_An anonymous donation to the human rights foundation with an on-chain bitcoin payment:_ +_An anonymous donation to the human rights foundation with an 100,000 satoshi on-chain bitcoin payment:_ ```jsonc { @@ -40,9 +43,9 @@ _An anonymous donation to the human rights foundation with an on-chain bitcoin p "tags": [ ["d", "867038d3-5648-4f64-ab9d-0a1f38f00b67"], ["currency", "BTC"], - ["amount", "0.01"], - ["payer", ""], - ["payee", ""], + ["amount", "100000000"], + ["payer", "", "", "Anonymous"], + ["payee", "f1989a96d75aa386b4c871543626cbb362c03248b220dc9ae53d7cefbcaaf2c1", "wss://purplepag.es", "HRF"], ["metadata": "{\"program\":\"Bitcoin Development Fund\"}"] ], "content": "", @@ -50,22 +53,23 @@ _An anonymous donation to the human rights foundation with an on-chain bitcoin p ``` -_An anonymous user donating to a gofundme page in dollars:_ +_A user named Bob without a nostr profile donating $100 to a donation page in dollars:_ ```jsonc { "kind": 30090, "tags": [ ["d", "64eb241d-d05b-42ba-988a-1e24666a7cab"], - ["currency", "USD"], - ["amount", "1000"], - ["payee", ""], + ["currency", "USD"], + ["amount", "10000"], + ["payer", "", "", "Bob"], + ["payee"], ], "content": "", } ``` -_A Podcasting 2.0 payment:_ +_A a podcast listener supporting the Joe Rogan Experience with a 10,000 satoshi donation:_ ```jsonc { @@ -73,8 +77,8 @@ _A Podcasting 2.0 payment:_ "tags": [ ["d", "f8604a8f-1ad5-4e90-a2f5-3a5e63cd7330"], ["currency", "BTC"], - ["amount", "0.001"], - ["payer", ""], + ["amount", "10000000"], + ["payer"], ["payee", "", "", "The Joe Rogan Experience"], ["i", "podcast:guid:123"], ["i", "podcast:item:guid:123"], From 64ee3c70f4d35fba8c709163592c7451e190a5d8 Mon Sep 17 00:00:00 2001 From: Oscar Merry Date: Thu, 15 May 2025 14:51:59 +0100 Subject: [PATCH 3/3] Typo --- XX.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XX.md b/XX.md index b88d9468..4707d27d 100644 --- a/XX.md +++ b/XX.md @@ -46,7 +46,7 @@ _An anonymous donation to the human rights foundation with an 100,000 satoshi on ["amount", "100000000"], ["payer", "", "", "Anonymous"], ["payee", "f1989a96d75aa386b4c871543626cbb362c03248b220dc9ae53d7cefbcaaf2c1", "wss://purplepag.es", "HRF"], - ["metadata": "{\"program\":\"Bitcoin Development Fund\"}"] + ["metadata", "{\"program\":\"Bitcoin Development Fund\"}"] ], "content": "", }