# NOSTR over single packet UDP

npub1rmz9gu6de0m0u4ysrn39crrud099ahvfgs6pvasl4hpjr5ud7yus54xv06
hex
0b4a21813832ecece7ef5c1c7ca22c2f68ecb20c4085aab752ee3a1c65c7136fnevent
nevent1qqsqkj3psyur9m8vulh4c8ru5gkz768vkgxyppd2kafwuwsuvhr3xmcprpmhxue69uhhyetvv9ujuem4d36kwatvw5hx6mm9qgspa3z5wdxuhah72jgpecjup37xhjj7mky5gdqkwc06msep6wxlzwgqf8y3qKind-1 (TextNote)
NOSTR over single packet UDP
TLDR
Send a Nostr event as one-way UDP packet instead of using TCP. This one-way send is very censorship resistant compared to the alternatives. I currently have it implemented on my relay and you can test it now on the command line using nc and nostr:npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6's nak. ''' nak event -k 1 -c "I don't shake hands, because Ewwwwww!" | nc -u -w1 laantungir.net 443 '''
The problem:
As far as I know, every circumvention tool [VPN, Tor, Shadowsocks, obfs4] has a handshake. You start off messaging the server, and the server replies before you can send your information. National firewalls detect those handshakes, fingerprint them, probe the handshake, then block the IP or take other action. The handshake is a vulnerability. Every tool plays cat-and-mouse obfuscating it.
For example Tor bridges are vulnerable to active probing. The adversary connects to a suspected bridge and sends data. If the server responds with a valid obfs4 handshake, the adversary knows it is a bridge. This is how many Tor bridges get blocked.
The idea:
UDP Nostr eliminates the handshake entirely. The Nostr event is already signed before it touches the network. The signature replaces the handshake. There is no SYN, no TLS ClientHello, no SNI, no key exchange, no recognizable structure — just a blob of bytes in one UDP packet under 1472 bytes.
The adversary can send a probe, but the relay doesn't respond at all. No handshake to detect. No TCP RST to inject (UDP has no RST). No DNS to poison.
Live example — full zero-config round-trip
My relay has fully implemented UDP Nostr.

command line
# Console 1 - Set up a live watch for the nak default events on the relay
nak req -a 79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 --stream laantungir.net/relay
# Console 2 - Send via UDP (no --sec needed, nak uses the default key)
nak event -k 1 -c "Hello!" | nc -u -w1 laantungir.net 443
Python:
import socket, sys
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.sendto(sys.stdin.buffer.read(), (sys.argv[1], int(sys.argv[2])))
nak event -k 1 -c "Hello!" | python3 send.py laantungir.net 443
JavaScript (Node.js):
const dgram = require("dgram"), s = dgram.createSocket("udp4");
process.stdin.on("data", b => s.send(b, +process.argv[3], process.argv[2]));
nak event -k 1 -c "Hello!" | node send.js laantungir.net 443
An example of largest kind:1 that fits in one packet
With the default nak key, empty tags, and a 10-digit timestamp, the Nostr JSON overhead (structural syntax + hex-expanded id/pubkey/sig) is ~340 bytes, leaving ~1132 characters of content in the 1472-byte UDP budget. Below is an illustrative event at full capacity — its single-line JSON form is exactly 1472 bytes on the wire, one Ethernet frame, unfragmented. (The id and sig shown are placeholders for readability; a real event carries a SHA-256 id and valid Schnorr sig.)
{"id":"426462725f7061636b65745f626f756e646172795f746573745f303030303030",
"pubkey":"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
"created_at":1772019044,
"kind":1,
"tags":[],
"content":"The cypherpunk problem: how do two computers communicate freely when the network between them is controlled by an adversary? The standard approaches are anonymity (hide which computer is talking) and decentralization (make copies everywhere so you can't stop them all). But there is a third approach that is less explored: protocol substrate hardening. Design the communication protocol so that interference requires violating physics or OS-level guarantees. The simplest example: fit your message in a single UDP datagram under 1472 bytes. At this size, your message is exactly one Ethernet frame. The adversary cannot block it without blocking all UDP traffic on that port. They cannot fragment it. They cannot reassemble it. They cannot probe for a handshake because there is no handshake. The Nostr event is self-validating: it carries its own signature. The signature replaces the handshake. This is the key insight. Every other protocol announces itself with a handshake. TCP has SYN. TLS has ClientHello. QUIC has its Initial packet. WireGuard has its handshake initiation. All of these create a pattern that can be fingerprinted and blocked. A Nostr event over UDP has no pattern. It is just bytes on the wire. The receiver validates the signature using only the pubkey in the event. No shared secrets. No session setup. No state. This is the no-handshake property. It is the fundamental advantage of Nostr over every other protocol for censorship resistance. Combine this with the MTU boundary and you have a protocol that cannot be blocked without blocking all UDP traffic. The adversary faces a dilemma: block UDP entirely and break the internet, or let your messages through. This is the asymmetry we exploit.",
"sig":"4b57c22b1797b109530ffe5d04cabac468b1a5942873a5141334ecbc77694fc968a1b941979ba13602fceb1dad8014ab6469c6ae9cef0b5668cc23ad1449e103"}
Future work
I'm currently working on an encryption scheme specifically for this protocol.
https://15.235.3.231/git/laantungir/udp_nostr https://laantungir.net/git/laantungir/udp_nostr https://[2607:5300:203:bb5c:4a46:c3d3:1dc3:fbe8]/git/laantungir/udp_nostr http://kn2jam4kyz6s5wacyozo3do3d2zsvh4to45uh7xliulwdust6zjuvnad.onion/git/laantungir/udp_nostr http://npub1crpldvy49ef8z34wlacwujnfudy4nd7k96aqdx5wgn6ckztz7z8q9t59ud.fips/git/laantungir/udp_nostr
原始 JSON
{
"kind": 1,
"id": "0b4a21813832ecece7ef5c1c7ca22c2f68ecb20c4085aab752ee3a1c65c7136f",
"pubkey": "1ec454734dcbf6fe54901ce25c0c7c6bca5edd89443416761fadc321d38df139",
"created_at": 1786614328,
"tags": [
[
"p",
"3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"
]
],
"content": "# NOSTR over single packet UDP\n\n\n## TLDR\nSend a Nostr event as one-way UDP packet instead of using TCP. This one-way send is very censorship resistant compared to the alternatives. I currently have it implemented on my relay and you can test it now on the command line using nc and nostr:npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6's nak.\n'''\nnak event -k 1 -c \"I don't shake hands, because Ewwwwww!\" | nc -u -w1 laantungir.net 443\n'''\n\n\n## The problem:\n\n\nAs far as I know, every circumvention tool [VPN, Tor, Shadowsocks, obfs4] has a handshake. You start off messaging the server, and the server replies before you can send your information. National firewalls detect those handshakes, fingerprint them, probe the handshake, then block the IP or take other action. The handshake is a vulnerability. Every tool plays cat-and-mouse obfuscating it.\nhttps://blossom.laantungir.net/b63479f895a207fccfbac9323ac7a4bd47cbc20e43ebfcd60f3c54e41bfb1d1d.jpg\nFor example Tor bridges are vulnerable to active probing. The adversary connects to a suspected bridge and sends data. If the server responds with a valid obfs4 handshake, the adversary knows it is a bridge. This is how many Tor bridges get blocked.\n\n\n## The idea:\n\n\nUDP Nostr eliminates the handshake entirely. The Nostr event is already signed before it touches the network. The signature replaces the handshake. There is no SYN, no TLS ClientHello, no SNI, no key exchange, no recognizable structure — just a blob of bytes in one UDP packet under 1472 bytes.\n\n\nThe adversary can send a probe, but the relay doesn't respond at all. No handshake to detect. No TCP RST to inject (UDP has no RST). No DNS to poison.\n\n\n## Live example — full zero-config round-trip\n\n\nMy relay has fully implemented UDP Nostr. \n\n\nhttps://blossom.laantungir.net/5b1c5fc4ddf89b4aec123c7a2a5934e9a22c3271fa641b071cc8f7740a342bbd.png\n\n\n**command line**\n\n\n\n```bash\n# Console 1 - Set up a live watch for the nak default events on the relay\nnak req -a 79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 --stream laantungir.net/relay\n\n\n# Console 2 - Send via UDP (no --sec needed, nak uses the default key)\nnak event -k 1 -c \"Hello!\" | nc -u -w1 laantungir.net 443\n\n\n```\n\n\n**Python:**\n```python\nimport socket, sys\ns = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\ns.sendto(sys.stdin.buffer.read(), (sys.argv[1], int(sys.argv[2])))\n```\n```bash\nnak event -k 1 -c \"Hello!\" | python3 send.py laantungir.net 443\n```\n\n\n**JavaScript (Node.js):**\n```javascript\nconst dgram = require(\"dgram\"), s = dgram.createSocket(\"udp4\");\nprocess.stdin.on(\"data\", b =\u003e s.send(b, +process.argv[3], process.argv[2]));\n```\n```bash\nnak event -k 1 -c \"Hello!\" | node send.js laantungir.net 443\n```\n\n\n## An example of largest kind:1 that fits in one packet\n\n\nWith the default nak key, empty tags, and a 10-digit timestamp, the Nostr JSON overhead (structural syntax + hex-expanded id/pubkey/sig) is ~340 bytes, leaving **~1132 characters of content** in the 1472-byte UDP budget. Below is an illustrative event at full capacity — its single-line JSON form is exactly 1472 bytes on the wire, one Ethernet frame, unfragmented. (The `id` and `sig` shown are placeholders for readability; a real event carries a SHA-256 `id` and valid Schnorr `sig`.)\n\n\n```json\n{\"id\":\"426462725f7061636b65745f626f756e646172795f746573745f303030303030\",\n\"pubkey\":\"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\",\n\"created_at\":1772019044,\n\"kind\":1,\n\"tags\":[],\n\"content\":\"The cypherpunk problem: how do two computers communicate freely when the network between them is controlled by an adversary? The standard approaches are anonymity (hide which computer is talking) and decentralization (make copies everywhere so you can't stop them all). But there is a third approach that is less explored: protocol substrate hardening. Design the communication protocol so that interference requires violating physics or OS-level guarantees. The simplest example: fit your message in a single UDP datagram under 1472 bytes. At this size, your message is exactly one Ethernet frame. The adversary cannot block it without blocking all UDP traffic on that port. They cannot fragment it. They cannot reassemble it. They cannot probe for a handshake because there is no handshake. The Nostr event is self-validating: it carries its own signature. The signature replaces the handshake. This is the key insight. Every other protocol announces itself with a handshake. TCP has SYN. TLS has ClientHello. QUIC has its Initial packet. WireGuard has its handshake initiation. All of these create a pattern that can be fingerprinted and blocked. A Nostr event over UDP has no pattern. It is just bytes on the wire. The receiver validates the signature using only the pubkey in the event. No shared secrets. No session setup. No state. This is the no-handshake property. It is the fundamental advantage of Nostr over every other protocol for censorship resistance. Combine this with the MTU boundary and you have a protocol that cannot be blocked without blocking all UDP traffic. The adversary faces a dilemma: block UDP entirely and break the internet, or let your messages through. This is the asymmetry we exploit.\",\n\"sig\":\"4b57c22b1797b109530ffe5d04cabac468b1a5942873a5141334ecbc77694fc968a1b941979ba13602fceb1dad8014ab6469c6ae9cef0b5668cc23ad1449e103\"}\n```\n\n\n## Future work\n\n\nI'm currently working on an encryption scheme specifically for this protocol.\n\n\n\nhttps://15.235.3.231/git/laantungir/udp_nostr\nhttps://laantungir.net/git/laantungir/udp_nostr\nhttps://[2607:5300:203:bb5c:4a46:c3d3:1dc3:fbe8]/git/laantungir/udp_nostr\nhttp://kn2jam4kyz6s5wacyozo3do3d2zsvh4to45uh7xliulwdust6zjuvnad.onion/git/laantungir/udp_nostr\nhttp://npub1crpldvy49ef8z34wlacwujnfudy4nd7k96aqdx5wgn6ckztz7z8q9t59ud.fips/git/laantungir/udp_nostr",
"sig": "234d782d35e8ac6224ef6acce9fe7aa9765fceb66bceecb88c4d6bbd7447630b422439fb19b795aed90cd978a17abfddda809161b43f7094dff8b73948e92af6"
}