MakePrisms / bitcoinmints

List, review, and find bitcoin mints.
https://bitcoinmints.com
18 stars 5 forks source link

Fedimints Support - use fedimint-ts service to pull metas to display on bitcoinmints.com #4

Closed Kodylow closed 5 months ago

Kodylow commented 7 months ago

There's a couple more pieces of information we can pull to display on bitcoinmints:

  1. Meta: Federations have a "meta" of arbitrary key/value pairs like federation_icon_url, federation_name, etc that we can display.
  2. List of supported modules: as part of the config, fedimint lists the modules it's running: defaults of lightning, ecash, onchain but other modules like stability pools or social recovery that companies like Fedi built would also show up.
  3. Other guardians: the federation invite code normal has a federationId and a single guardian, you can ping that guardian and get the other guardians.

Will work on a little typescript service for this using fedimint-ts to increase the info available for listed fedimints

TonyGiorgio commented 7 months ago

Or also consider uploading and parsing the content part of the nip87 mint info:

"content": "",

  • content is an optional metadata-like stringified JSON object, as described in NIP-01. This content is useful when the pubkey creating the kind:38173 is not a normal user. If content is empty, the kind:0 of the pubkey should be used to display mint information (e.g. name, picture, web, LUD16, etc.)

Looks like there's at least one fedimint using that and it looks good in mutiny right now.

elsirion commented 7 months ago

I was wondering about how to make the name etc. available too. I built a little service that fetches federation config using the invite code and returns the meta fields as parsed JSON.

There is some JSON in JSON weirdness going on that isn't implemented consistently, I just use a very lenient parsing method that tries to do the right thing even if operators misuse the meta fields a bit.

The relevant API:

All API endpoints are cached in memory right now, so may take a few seconds on first request/after restarts but are very fast afterwards. I'm hosting the API under https://fmo.sirion.io/, but it's also trivial to self-host (provides a nix flake exporting a package).

E.g. https://fmo.sirion.io/config/fed11qgqzk2thwden5te0vejkg6tdd9h8gepwvejkg6tdd9h8gtnxwfjk2er0d4kkjmn59eu8j730qgqjpj2ykt73ullqfj58lxjh67y5ed53zm8vvfjvk5h65ufz3a8v2nxk0lgsxr/meta gives you the following output:

{
  "federation_expiry_timestamp": 1739149200,
  "welcome_message": "welcome to freedom, use at your own risk",
  "federation_name": "freedom one"
}
elsirion commented 7 months ago

Or also consider uploading and parsing the content part of the nip87 mint info:

I think having this data redundantly encoded is very annoying if e.g. the federation name ever changes.