import { finalizeEvent, getEventHash, getPublicKey } from 'nostr-tools' const skHex = 'e8913a0b983c8678e3cce83a45ace14f6656bd06ff98803a38d72a5567e7e105' const event = { kind: 1, created_at: Math.floor(Date.now() / 1000), tags: [], content: 'Hello world! Welcome to SC24!', pubkey: getPublicKey(skHex) } event.id = getEventHash(event) event.sig = finalizeEvent(event, skHex) const signedEvent = ['EVENT', event] function getCircularReplacer() { const seen = new WeakSet(); return (key, value) => { if (typeof value === "object" && value !== null) { if (seen.has(value)) { return; //zyklische Referenzen lassen sich nicht anzeigen } seen.add(value); } return value; }; } console.log( JSON.stringify(signedEvent, getCircularReplacer(), 2) // 2 für schönere Einrückung )