diff --git a/main.js b/main.js index 27feb48..d0caf35 100644 --- a/main.js +++ b/main.js @@ -3,13 +3,13 @@ const crypto = require('crypto'); const elliptic = require('elliptic'); const Buffer = require('safe-buffer').Buffer const schnorr = require('bip-schnorr'); - +const settings = require('./settings.json'); // Use elliptic for ECDSA signing const EC = elliptic.ec; const ecdsa = new EC('secp256k1'); // Your Nostr private key (replace with your own) -const privateKeyHex = ''; // Use your actual private key here +const privateKeyHex = settings.secretKey; // Use your actual private key here // Ensure private key is a valid 32-byte hex string if (!/^([0-9a-fA-F]{64})$/.test(privateKeyHex)) { @@ -52,7 +52,7 @@ ws.on('message', function incoming(message) { pubkey: publicKeyHex, // 32-byte public key created_at: timestamp, kind: 31892, // Note (you can change this based on your event type) - tags: [['d','BTCUSD'],['n', 'BTC'],['n','USD'],['value',lastPrice]], // Optional tag (you can customize this) + tags: [['d','BTCUSD'],['n', 'BTC','USD'],['value', 'lastPrice']], // Optional tag (you can customize this) content: eventContent, sig: '' // Initialize sig here, it will be added after content }; @@ -120,7 +120,7 @@ function signEvent(privateKeyHex, serializedEvent, eventID) { // Function to send the event to a Nostr relay function sendToRelay(event) { // Example relay URL (replace with the actual Nostr relay URL) - const relayUrl = ''; // Replace with your relay URL + const relayUrl = settings.relayUri; // Replace with your relay URL // Create a WebSocket connection to the relay const relayWs = new WebSocket(relayUrl);