Compare commits

...

2 Commits

Author SHA1 Message Date
ac3b5d6cdd Adding settings.json, Adding settings, correcting tag 2024-12-24 18:03:11 -05:00
afe2225fb6 Adding settings.json 2024-12-24 18:02:39 -05:00
2 changed files with 8 additions and 4 deletions

@ -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);

4
settings.json Normal file

@ -0,0 +1,4 @@
{
"secretKey": "",
"relayUri": ""
}