Skip to content

Nostr

I wonder if a Strfry relay only requires websockets proxied to it.

To Sort

Social Media Message Format

For Replies check out "Tags", on The Nostr Protocol

//Normal Messages
let signedEvent = finalizeEvent({
  kind: 1,
  created_at: Math.floor(Date.now() / 1000),
  tags: [],
  content: 'hello',
}, secret_key)


// Normal Message Reply
// 7eb95dc1956ee4fc08956c8948381bdc2361fda9fb32fff9c2d2c2f062b30c65
let signedEvent = finalizeEvent({
  kind: 1,
  created_at: Math.floor(Date.now() / 1000),
  tags: [["e","3d31eb5c11729d19f3e9c613e4aaaeb2e352caa042b07427c3e72056c51f9ab8","","root"],["e","dc8a5f08d3effe321be8447274b98206dbc7d504411e707a532781809ca73808"],["e","7805668e76e0326152989c95f15262904acd002946505d91e901e81233bb6f21","","reply"],["p","6ad3e2a34818b153c81f48c58f44e5199e7b4fc8dbe37810a000dce3c90b7740"],["p","3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"],["p","f901616f00a63f4f9c7881d4871a03df3d4cee7291eafd7adcbeea7c95c58e27"]],
  content: 'hello',
}, secret_key)

// Encrypted
let signedEvent = finalizeEvent({
    kind: 4,
    created_at: Math.floor(Date.now() / 1000),
    tags: [public_key_1],
    content: ciphertext,
  }, secret_key_0)

Example Event


{
  "content": "So then it comes down to resilience vs speed, which either could be more important depending on the situation. ",
  "created_at": 1710865797,
  "id": "dc52df964ad58a08fe563e9f8cc0a9201262e794ae23a631aee2150d1bc56725",
  "kind": 1,
  "pubkey": "c230edd34ca5c8318bf4592ac056cde37519d395c0904c37ea1c650b8ad4a712",
  "sig": "067bf6af3ff17df6d94d3a4966032ee8a3bcafac2c0c77e97710f0a24d18056f58da8ec79abca63d36e3631d6420c89a994f4c6fe351766607162edda1c438c0",
  "tags": [
    [
      "e",
      "5ed5991abe6b3b375a82786e6b3dc215ff22fbb8d9864c1be641100695a9099c",
      "",
      "root"
    ],
    [
      "e",
      "45f52b083573c6651fdc615fca84dd3b94ddee29a9b94dd8d70893485d8e81f4"
    ],
    [
      "e",
      "191de99637d21eef69982a1c1c0337b3edf3e128dc038a8b4c7242fb9d39ab83",
      "",
      "reply"
    ],
    [
      "p",
      "c230edd34ca5c8318bf4592ac056cde37519d395c0904c37ea1c650b8ad4a712"
    ],
    [
      "p",
      "4c800257a588a82849d049817c2bdaad984b25a45ad9f6dad66e47d3b47e3b2f"
    ]
  ]
}

Sources