index
id: 7aab769ca418d961d8f2475efccb7e4731a3dd8bf8fd52e6b6a5dbe1d66c4ca3
id (bech32): note1024hd89yrrvkrk8jga00ejm7guc68hvtlr749e4k5hd7r4nvfj3sfplnv0
sig: ab5cf0d1763d9da83bcb5f60628684e995e4849688d6bf49d98a66caf6e6ea4f0f2301d86512745b0e502a86ac41ffd90a89c6f69fe6154e4ebc4a5fb43b3a46
created_at: 2023-08-09 22:43:48 +0900
created_at (unix time): 1691588628
content:
↓実際こういうコード
const relays = [
// "wss://eden.nostr.land",
// "wss://nos.lol",
// "wss://nostr-pub.wellorder.net",
// "wss://nostr-relay.nokotaro.com",
// "wss://nostr.fmt.wiz.biz",
// "wss://nostr.h3z.jp",
// "wss://nostr.holybea.com",
"wss://nostr.orangepill.dev",
// "wss://nostr.wine",
"wss://nrelay.c-stellar.net",
"wss://offchain.pub",
"wss://relay-jp.nostr.wirednet.jp",
"wss://relay.current.fyi",
"wss://relay.damus.io",
"wss://relay.nostr.band",
"wss://relay.snort.social",
"wss://yabu.me",
];
import { getEventHash, getSignature, nip19, SimplePool } from "nostr-tools";
import "websocket-polyfill";
import { readFileSync } from "fs";
const pubkey = "a6f1f450080b65ba75da8ac7328f91c94f8314b2cc4aa719c516852a29388f0b";
const privkey = nip19.decode(readFileSync("./nsec.txt", "utf-8").trim()).data;
const content = readFileSync("content.txt", "utf-8").trim();
const pool = new SimplePool();
const ev = {
kind: 1,
created_at: Math.floor(Date.now() / 1000),
tags: [],
content,
pubkey
};
ev.id = getEventHash(ev);
ev.sig = getSignature(ev, privkey);
pool.publish(relays, ev);
JSON