Skip to content

Nostr Relay - Java/Spring/WebSocketSession Implementation

License

Notifications You must be signed in to change notification settings

avlo/superconductor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

███████╗██╗   ██╗██████╗ ███████╗██████╗  ██████╗ ██████╗ ███╗   ██╗██████╗ ██╗   ██╗ ██████╗████████╗ ██████╗ ██████╗
██╔════╝██║   ██║██╔══██╗██╔════╝██╔══██╗██╔════╝██╔═══██╗████╗  ██║██╔══██╗██║   ██║██╔════╝╚══██╔══╝██╔═══██╗██╔══██╗
███████╗██║   ██║██████╔╝█████╗  ██████╔╝██║     ██║   ██║██╔██╗ ██║██║  ██║██║   ██║██║        ██║   ██║   ██║██████╔╝
╚════██║██║   ██║██╔═══╝ ██╔══╝  ██╔══██╗██║     ██║   ██║██║╚██╗██║██║  ██║██║   ██║██║        ██║   ██║   ██║██╔══██╗
███████║╚██████╔╝██║     ███████╗██║  ██║╚██████╗╚██████╔╝██║ ╚████║██████╔╝╚██████╔╝╚██████╗   ██║   ╚██████╔╝██║  ██║
╚══════╝ ╚═════╝ ╚═╝     ╚══════╝╚═╝  ╚═╝ ╚═════╝ ╚═════╝ ╚═╝  ╚═══╝╚═════╝  ╚═════╝  ╚═════╝   ╚═╝    ╚═════╝ ╚═╝  ╚═╝

Java Nostr-Relay Framework & Web Application


NIPS

Supported

In-Progress


Requirements

$ java -version
openjdk version "22" 2024-03-19
OpenJDK Runtime Environment (build 22+36-2370)
OpenJDK 64-Bit Server VM (build 22+36-2370, mixed mode, sharing)
$ mvn -version
Apache Maven 4.0.0-beta-3 (e92f645c2749eb2a4f5a8843cf01e7441e4b559f)
Java version: 22, vendor: Oracle Corporation
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-112-generic", arch: "amd64", family: "unix"

Using Superconductor

Build and install nostr-java dependency library

note: below java22 nostr-java variant (of tcheeric's java19 nostr-java library) supports virtual threads. reversion to his library will occur upon its upgrade to java22.

$ cd <your_git_home_dir>
$ git clone git@github.com:avlo/nostr-java-avlo-fork.git
$ cd nostr-java-avlo-fork
$ git checkout java22
$ mvn clean install

Build and install SuperConductor

$ cd <your_git_home_dir>
$ git clone https://github.com/avlo/superconductor
$ cd superconductor
$ mvn clean install

Run SuperConductor (3 options)

1. run as executable jar
$ cd <your_git_home_dir>/superconductor
$ java -jar target/superconductor-1.6.3.war

2. run using maven spring-boot run target

$ cd <your_git_home_dir>/superconductor
$ mvn spring-boot:run 

3. run using pre-existing application-server container instance

$ cp <your_git_home_dir>/superconductor/target/superconductor-1.6.3.war <your_container/instance/deployment_directory>

for full/debug developer console logging:

$ cd <your_git_home_dir>/superconductor
$ mvn spring-boot:run -Dspring-boot.run.arguments=--logging.level.org.springframework=TRACE

Relay Endpoint for clients

ws://localhost:5555


Default/embedded H2 DB console:

localhost:5555/h2-console/

user: sa
password: // blank

Display all framework table contents (case-sensitive quoted fields/tables when querying):

select id, event_id_string, kind, nip, created_at, pub_key, content from event;
select id, event_id, event_tag_id from "event-event_tag-join";
select id, event_id_string, recommended_relay_url, marker from event_tag;
select id, event_id, pubkey_id from "event-pubkey_tag-join";
select id, public_key, main_relay_url, pet_name from pubkey_tag;
select id, event_id, subject_tag_id from "event-subject_tag-join";
select id, subject from subject_tag;
select id, hashtag_tag from hashtag_tag;
select id, location from geohash_tag;
select id, event_id, geohash_tag_id from "event-geohash_tag-join";
select id, event_id, hash_tag_id from "event-hashtag_tag-join";
select id, event_id, generic_tag_id  FROM "event-generic_tag-join";
select id, code from generic_tag;
select id, generic_tag_id, element_attribute_id from "generic_tag-element_attribute-join";
select id, name, "value" from element_attribute;
select id, event_id, price_tag_id from "event-price_tag-join";
select id, uri from relays_tag;
select id, event_id, relays_id from "event-relays_tag-join";
select id, number, currency, frequency from price_tag;
(Optional Use) bundled web-client URLs for convenience/dev-testing/etc

http://localhost:5555/NIP01.html

http://localhost:5555/NIP57.html

http://localhost:5555/NIP99.html

http://localhost:5555/REQ.html


Adding new/custom events to SuperConductor

For Nostr clients generating canonical Nostr JSON (as defined in NIP01 spec: Basic protocol flow description, Events, Signatures and Tags), SuperConductor will automatically recognize those JSON events- including their database storage, retrieval and subscriber notification. No additional work or customization is necessary.


Adding new/custom tags to SuperConductor

SuperConductor supports any generic tags automatically. Otherwise, if custom tag structure is required, simply implement the TagPlugin interface (an example can be seen here) and your tag will automatically get included by SuperConductor after rebuilding and redeploying.

About

Nostr Relay - Java/Spring/WebSocketSession Implementation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published