diff --git a/4A.md b/4A.md new file mode 100644 index 0000000000..d67bb740c8 --- /dev/null +++ b/4A.md @@ -0,0 +1,55 @@ +NIP-4A +====== + +Event Onion Routing +------------------- + +`draft` `optional` + +This NIP defines a way for a client to indirectly publish events to a relay by onion routing the event through peers willing to route it. This helps preserve the privacy of a client's network metadata. + +``` + --> [Relay-1] --> --> [Relay-2] --> +``` + +Alice wants to send an event to *Bob*, but not reveal her IP address to *Relay-2*. Another client, *Router*, has offered to provide an onion routing service. This allows Alice to encrypt her message to *Router* and send it through *Relay-1*. *Router* decrypts the message and publishes it to *Relay-2* for *Bob*. + +This is not perfect network privacy. There is a chance that the relays are operated by the same party or two colluding parties. Alice may choose to introduce different routers on the path to increase the difficulty of detection, at the cost of performance. + +## Routing an Event + +Kind `2444` and `20444` are onion route request events. They are the exact same except `2444` is regular while `20444` is ephemeral. Regular events give another dimension for the sender to manipulate in order to disrupt time-based deanonymization attempts. + +The event MUST include a `p` tag specifying the router to route the event. The `content` is encrypted for the router using [NIP-44](44.md) encryption. The `content` MUST contain an `event` to publish as well as at least one `relay` to target. + +``` +{ + "kind": 20444, + "content": nip44_encrypt("[ + [ "event", "" ], // required event to publish + [ "relay", "wss://example1.com" ] // required relay to target + ]") + "tags": [ + [ "p", "" ] + ] +} +``` + +Multiple `event`s and `relays` MAY be provided. Every given `event` SHOULD be published to every given `relay`. + +The routing event could use a [NIP-59](59.md) gift wrap to hide that it is a routing request, but the effectiveness would vary depending on if a router's pubkey is well known as an onion router. + +## Router Announcement + +Kind `10690` are replaceable router announcement events which allow routers to be discovered by senders. The `relay` tag is a relay where the router listens for onion routing requests. The event MUST include at least one `relay`. + +``` +{ + "kind": 10690, + "tags": [ + [ "relay", "wss://example1.com" ], + [ "relay", "wss://example2.com" ], + ], + "pubkey": +} +```