Skip to content

Latest commit

 

History

History
91 lines (72 loc) · 2.29 KB

TESTING.md

File metadata and controls

91 lines (72 loc) · 2.29 KB

Testing the Nostr Geohash Heatmap

What the heatmap displays:

  • Event Kind: 20000 (custom geohash events)
  • Required Tags:
    • g tag with geohash value
    • n tag with nickname (optional)
  • Content: Any message content

Method 1: Using the built-in test script (Recommended)

  1. Make sure the server is running (from your project root):

    npm start
  2. In a new terminal, run the test publisher (from the same project root):

    node test-publisher.js
  3. Open your browser to the address printed by the server (or your deployment URL) and watch the map light up.

Method 2: Using nostril CLI tool

  1. Install nostril:

    go install github.com/fiatjaf/nostril@latest
  2. Generate a test private key:

    nostril --gen-key
  3. Publish a test geohash event:

    nostril \
      --kind 20000 \
      --tag g:dr5regy7 \
      --tag n:TestUser \
      --content "Test geohash event from NYC" \
      --sec YOUR_PRIVATE_KEY_HERE \
      --relay wss://relay.damus.io

    Geohash examples:

    • dr5regy7 = New York City area
    • gcpvj0du = London area
    • xn774c06 = Tokyo area
    • r3gx2f77 = Sydney area

Method 3: Using nostr-tools in your own script

const { generatePrivateKey, getPublicKey, finishEvent, relayInit } = require('nostr-tools');
const ngeohash = require('ngeohash');

const sk = generatePrivateKey();
const pk = getPublicKey(sk);

// Create geohash event
const event = finishEvent({
  kind: 20000,
  created_at: Math.floor(Date.now() / 1000),
  tags: [
    ['g', ngeohash.encode(40.7128, -74.0060, 8)], // NYC coordinates
    ['n', 'MyTestUser']
  ],
  content: 'Hello from the heatmap!'
}, sk);

// Publish to relay
const relay = relayInit('wss://relay.damus.io');
relay.connect().then(() => {
  relay.publish(event);
});

Troubleshooting

  • No events showing up: Check the browser console and server logs for errors
  • Events not validating: Ensure your events have proper signatures and structure
  • Relay connection issues: Try different relays from the list in server.js

Expected Result

After publishing test events, you should see:

  • Points appear on the heatmap at the geohash locations
  • Server logs showing received events
  • Data visible in the web interface