-
@ Steven Day
2023-09-06 19:56:10
# Getting Started
## Tools
The use of any tools is not required and may be helpful in getting a hands-on understanding of Nostr events, queries, and interacting with relays.
Here are the tools I will be using in this guide:
[NodeJS](https://nodejs.org/) - The code snippets in this guide will be using javascript. Most of this code will not be specific to Node and may be convenient to use if not writing our javascript for a web browser.
Google Chrome\Chromium - For web scripting, most modern web browsers should be fine. The requirement is that it supports websockets and CORS (Cross-Origin Resource Sharing : [https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS]()). The Chrome dev tools will be used for viewing code output.
[Nostril](https://github.com/jb55/nostril) - Nostril is a utility to create events from the command-line. This will help quickly create new events for testing and it can be downloaded here. I also have a utility written in NodeJS that can be used as a substitute here (Link to Github).
[Websocat](https://github.com/vi/websocat) - Websocat allows a convenient CLI interface to sending data over websockets, which is what relays use for communication. In conjunction with Nostril, you can pipe events and requests to relays and get output.
[Postman](https://www.postman.com/downloads/) - Postman supports websockets and can be used as an alternative for sending events to relays.
# Relays
This guide will be utilizing a relay that supports most of the NIP standards. The only requirement for this guide is that you use a relay you are allowed to write events to. You can also spin up your own relay to test and the setup of a relay is out of scope. You can find a list of relays [here](https://www.nostr.net/).
**Note:** As a matter of courtesy, if using someone else’s relay, is to be respectful of the amount of data sent to the relay. Relays provide an important function and house a lot of nostr events. Spamming, even for testing purposes may result in rate limiting or banning.
As different event kinds are explored the supported NIPs will be highlighted to ensure that a suitable one is used and behavior is as intended in the exercise.
## Test keypair
It’s strongly recommended that any testing of events is done using a throwaway public\private keypair. This will ensure any npub you are using day-to-day doesn’t result in unintended behavior (i.e. spamming of messages to anyone following you) or private keys getting leaked.
## Hello World
### Exercise 1
Let’s start with an obligatory “Hello World” event to get things going. In the next section we will go over Nostr architecture and the anatomy of an event and loop back to this event.
**Ingredients:**
* Nostril
* Websocat
**Steps:**
Step 1: Build an event with a Nostril using the following commandline (You can autogenerate a new private key or use one you generated already)
> ./nostril --envelope --content "Hello World" --sec SECRET_KEY
Step 2: View the event in standard output
![](https://i.nostr.build/zRkM.png)
Step 3: Rerun the command and pipe it out to a relay
![](https://i.nostr.build/Al9R.png)
Step 4: Check for the output from the relay. If successful, copy and paste the ID of the event for later (we will come back to this)
**Congrats you just generated and published an event in the most manual way possible!**
Previous: [Introduction](nostr:naddr1qqxnzd3exvunvve3xg6rqd3sqgsqh933jx4jz6q2vvc84md4pltmqyuje8rtaauu6r8tvay2l308llgrqsqqqa28c28uht) |
Next: TBD