Nostr-PHP

https://nostr-php.dev

A very, very late after summer holidays update

Nostr-PHP

Before my holidays I met with Djuri to discuss establishing a co-maintainership for the Nostr-PHP helper library.

Since June 12th I haven't submitted a commit on the master branch.

Packagist stats show around 30 installs per day, which confirms real-world usage. GitHub stars are also steady, indicating growing interest in the project.

Star History Chart

My OpenSats grant has ended for Nostr-PHP

My OpenSats grant for Nostr-PHP has ended. It began in May 2024 and included a 3-month pause earlier this year; the grant period for building and maintaining the library is finished.  But I’m not quitting. I will carry the responsibility as a maintainer forward. The plan is to apply for a new grant to keep developing the library and the dependent projects. However, with my client backlog right now, I’m not sure I’ll have enough time to devote to Nostr-PHP and the related work.

Operation Kidstr + kubo.watch

In my spare time working on Nostr stuff, this will be the project I focus on most in the coming months. Why? I’ve dropped notes before on ideas for a YouTube Kids alternative (here, here). 

Working with others on it, it’s my responsibility to develop a demo. I’m building the demo with Drupal, using Nostr-PHP to nostrify different types of events. Make sure to read these articles to:

Remote signers (aka bunkers)

There are many unexplored territories in the Nostr ecosystem, and the area around remote signers is one of them. Let me start by listing some remote signers / NIP-46 implementations you can use today.

While working on Kidstr and hashing out ideas with Constant, I can see a few ways we could build smarter remote signers. Yes, it would add some complexity, but most of that is already handled by clients. We all know Nostr isn’t exactly easy to use yet, so maybe we can reduce the complexity by using remote signers that take care of the heavy lifting. So… I’ve got some boiling ideas in my head.

CCNS.news updates

After upgrading Tailwind CSS to the latest major version (from v3.4 to v4.1) I to fixed some minor styling issues.

I’ve integrated Web Push Notifications via the Push Framework Notifications module. This is a module which I started to co-develop two years ago for other projects. 

You can read a full technical deep-dive on my blog A deep-dive into Web Push Notifications with Drupal using Push Framework Notifications.

In the PWA, you can subscribe when new comments are posted under a specific link or bookmark. When someone drops a new comment, you’ll get a push notification. Logged-in users can post comments, but I still need to nostrify these comments by transmitting them as kind 1111 events. Login with your Nostr profile in the PWA isn’t wired up yet. That’s a bigger hurdle, because I’d either need to integrate NIP-46 for remote signing (or, less ideally, fall back to using an nsec, which is a known bad practice).

Stuff building for Drupal

See Ecosystem modules for Nostr.

nostr_event

This module renders Nostr events that are saved in the Drupal database. In the admin area, I also added a route that loads a form where you can copy-paste an event ID, fetch the event, and save it as a Nostr event entity.

nostr_profile

This extends user entities in Drupal with a dedicated Nostr profile. In this profile, you can add or update your Nostr keys and metadata (todo).

nostr_wallet_connect

This integrates the Nostr-PHP-NWC package.

nostr_applesauce

A piece of middleware which you can use to add the AppleSauce SDK (Javascript) to your Drupal website.

Nyves

While this is one of my favorite projects to work on, I won’t have much time to push it forward in the coming months.

So thanks for bearing with me. Hyves coming back via Nostr might have to wait a bit longer ;-).

FOSDEM 2026 is coming

I will just drop this note here.

nostr:nevent1qvzqqqqqqypzqpnrnguxe8qszsshvgkvhn6qjzxy7xsvx03rlrtddr62haj4lrm3qqs99ddnrppvhhkaew4qsvxpj50z9fncllhzgpxdzwft3etfyy9pphsh78qw7

Other stuff

Just another idea: a highlights page showing my kind 9802 and kind 39701 events. You might seen a new menu link on nostrver.se: Highlights. Check it out ;-)

I need to migrate my Nostr infrastructure to a new server, but I haven’t picked a provider yet that can offer a decent VPS.

Tags

Week 12 + 13 updates: NIP-19 in Nostr-PHP

Image
NIP-19

You can follow the work in progress here in this pull request https://github.com/nostrver-se/nostr-php/pull/68 on Github.

Before my 3-month break (Dec/Jan/Feb) working on Nostr-PHP I started with the NIP-19 integration in October '24. Encoding and decoding the simple prefixes (npub, nsec and note) was already done in the first commits.

Learn more about NIP-19 here: https://nips.nostr.com/19 

TLV's

Things were getting more complicated with the other prefixes / identifiers defined in NIP-19:

  • nevent
  • naddr
  • nprofile

This is because these identifiers contain (optional) metadata called Type-Lenght-Value aka TLV's.

When sharing a profile or an event, an app may decide to include relay information and other metadata such that other apps can locate and display these entities more easily.

For these events, the contents are a binary-encoded list of _TLV_ (type-length-value), with _T_ and _L_ being 1 byte each (_uint8_, i.e. a number in the range of 0-255), and _V_ being a sequence of bytes of the size indicated by _L_.

These possible standardized TLV types are:

  • 0: special
    • depends on the bech32 prefix:
      • for nprofile it will be the 32 bytes of the profile public key
      • for nevent it will be the 32 bytes of the event id
      • for naddr, it is the identifier (the "d" tag) of the event being referenced. For normal replaceable events use an empty string.
  • 1: relay
    • for nprofile, nevent and  naddr, optionally, a relay in which the entity (profile or event) is more likely to be found, encoded as ascii
    • this may be included multiple times
  • 2: author
    • for naddr, the 32 bytes of the pubkey of the event
    • for nevent, optionally, the 32 bytes of the pubkey of the event
  • 3: kind
    • for naddr, the 32-bit unsigned integer of the kind, big-endian
    • for nevent, optionally, the 32-bit unsigned integer of the kind, big-endian

These identifiers are formatted as bech32 strings, but are much longer than the package bitwasp/bech32 (used in the library) for can handle for encoding and decoding. The bech32 strings handled by bitwasp/bech32 are limited to a maximum length of 90 characters.

Thanks to the effort of others (nostr:npub1636uujeewag8zv8593lcvdrwlymgqre6uax4anuq3y5qehqey05sl8qpl4 and nostr:npub1efz8l77esdtpw6l359sjvakm7azvyv6mkuxphjdk3vfzkgxkatrqlpf9s4) during my break, some contributions are made (modifiying the bech32 package supporting much longer strings, up to a max of 5000 characters). At this moment, I'm integrating this (mostly copy-pasting the stuff and refactoring the code):

So what's next?

  • NIP-19 code housekeeping + refactoring
  • Prepare a new release with NIP-19 integration
  • Create documentation page how to use NIP-19 on https://nostr-php.dev

Nostr-PHP helper library 90-day OpenSats report #2

Image
OpenSats

1) How did you spend your time?

I continued to write and publish more detailed weekly updates here: https://nostrver.se/blog. These updates are also cross-posted via Nostr as long-form content.

Integrated RelayResponse classes

Pull requests:

Documentation: https://nostr-php.dev/guides/relay-responses

Researched and build a proof of concept of a handling async requests and concurrency

I have published the research outcomes here: https://nostr-php.dev/references/async-concurrent-requests.   I also created a page here https://nostr-php.dev/guides/asynchronous-and-concurrent-requests with more details and a code snippet. The famous Http/Guzzle client is used for handling the requests in combination with a relative new piece of middleware which enables WebSockets. See https://github.com/valtzu/guzzle-websocket-middleware/issues/1 where I reached out for solving an issue with the middleware.

NIP-42 client to relay authentication

Finished, see https://github.com/nostrver-se/nostr-php/pull/67 

NIP-19 bech32-encoded entities

Work in progress, see https://github.com/nostrver-se/nostr-php/pull/68 

2.0.0 pre-release

See https://github.com/nostrver-se/nostr-php/releases/tag/2.0.0-alpha1 

Other stuff

2) What do you plan to work on next quarter?

  • Finish the NIP-19 implementation which will support every bech32 entity
    • note
    • npub
    • nsec
    • nevent
    • naddr
    • nprofile
  • Research how the revolt/event-loop package can be used to serve as a sort of a message bus for handling async and concurrent requests in the library
  • Build a final 2.0.x release
    • By default and full async concurrent requests support
  • Implement NIP-03
  • Implement NIP-45
  • Implement a firehose demo for requesting Nostr events
  • Host the nostr-php.dev website as a static website with Blossom on Nostr. See https://github.com/lez/nsite and https://github.com/hzrd149/nsite-ts

3) How did you make use of the money?

4) Is there anything we could help with?

I would love to see a (closed/private) digital place with other Nostr OpenSats grantees where we can share our experiences and challenges. We could give feedback to each other as a form of encouragement. For example I'm curious how other grantees are explaining the work they to other which are not familiar with FOSS, Nostr and/or Bitcoin.

Tags

Week 38 updates

Here is code snippet: https://gist.github.com/Sebastix/5991b84334c6c7e12bc28b2e703311b6 

Subscribe to Nostr-PHP