Federated Lightning addresses server.

Satdress

Federated Lightning Address Server

How to run

  1. Download the binary from the releases page (or compile with go build or go get)
  2. Set the following environment variables somehow (using example values from bitmia.com):
PORT=17422
DOMAIN=bitmia.com
SECRET=askdbasjdhvakjvsdjasd
SITE_OWNER_URL=https://t.me/qecez
SITE_OWNER_NAME=@qecez
SITE_NAME=Bitmia
  1. Start the app with ./satdress
  2. Serve the app to the world on your domain using whatever technique you're used to

Get help

Maybe ask for help on https://t.me/lnurl if you're in trouble.

Owner
fiatjaf
vocês não têm nível
fiatjaf
Comments
  • Suggestion: Display test invoice with PIN embedded on /grab response page

    Suggestion: Display test invoice with PIN embedded on /grab response page

    Minor niggle but the unsettled 1 sat invoices generated during the testing of the registration are annoying.

    Further, could the test invoice include the PIN, and be displayed so that the registrant can pay it and receive a notice of the PIN in their transaction history.

  • Feature request:  commando: support rune rate limiting

    Feature request: commando: support rune rate limiting

    Im using cln 0.11.2 When i craft the rune like this: lightning-cli commando-rune restrictions='["method=invoice","rate=30"]' I get an error after hitting submit: couldn't make an invoice with the given data: Not authorized: rate: is missing

    Without the rate part i get a different unrelated error as seen in #33 which makes me think satdress doesn't support rate limiting.

  • Allow multiple comma-separated domains

    Allow multiple comma-separated domains

    The idea is that if you just upgrade to this version everything should work as before. However instead of just one domain you can now include a comma-seperated list in DOMAIN.

    Actually this is a group effort - I'd like to thank @aljazceru for the initiative and testing and @zwx00 for the CSS improvements (my change used to have a suffix-hack class).

  • docker-compose.yml so it's super easy to deploy on server or test locally

    docker-compose.yml so it's super easy to deploy on server or test locally

    Not sure if this is needed, but I wrote this for deploying on my server so maybe someone else will find it helpful as well. It neatly bundles all the necessary configuration options and also persists the database in a docker volume.

  • Building docker image fails

    Building docker image fails

    Building the docker image results in an error:

    # github.com/fiatjaf/satdress
    ./main.go:54:3: undefined: makeinvoice
    The command '/bin/sh -c go get' returned a non-zero code: 2
    

    Complete log

    Step 1/17 : FROM golang:1.16.0-alpine AS builder
     ---> 696265badec1
    Step 2/17 : WORKDIR /opt/buid
     ---> Using cache
     ---> af91638ee08c
    Step 3/17 : COPY ./*.go ./*.html ./go.mod ./go.sum ./
     ---> bb45ddd60d2f
    Step 4/17 : COPY static ./static
     ---> cc33c258279e
    Step 5/17 : RUN apk add gcc musl-dev linux-headers
     ---> Running in 94cb0e11fce2
    fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
    fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
    (1/14) Upgrading musl (1.2.2-r0 -> 1.2.2-r1)
    (2/14) Installing libgcc (10.2.1_pre1-r3)
    (3/14) Installing libstdc++ (10.2.1_pre1-r3)
    (4/14) Installing binutils (2.35.2-r1)
    (5/14) Installing libgomp (10.2.1_pre1-r3)
    (6/14) Installing libatomic (10.2.1_pre1-r3)
    (7/14) Installing libgphobos (10.2.1_pre1-r3)
    (8/14) Installing gmp (6.2.1-r0)
    (9/14) Installing isl22 (0.22-r0)
    (10/14) Installing mpfr4 (4.1.0-r0)
    (11/14) Installing mpc1 (1.2.0-r0)
    (12/14) Installing gcc (10.2.1_pre1-r3)
    (13/14) Installing linux-headers (5.7.8-r0)
    (14/14) Installing musl-dev (1.2.2-r1)
    Executing busybox-1.32.1-r3.trigger
    OK: 134 MiB in 28 packages
    Removing intermediate container 94cb0e11fce2
     ---> fa6aca3099c4
    Step 6/17 : RUN go get
     ---> Running in b2917668ad00
    go: downloading github.com/cockroachdb/pebble v0.0.0-20210812144839-61318a019370
    go: downloading github.com/fiatjaf/go-lnurl v1.4.0
    go: downloading github.com/fiatjaf/makeinvoice v1.3.0
    go: downloading github.com/gorilla/mux v1.8.0
    go: downloading github.com/kelseyhightower/envconfig v1.4.0
    go: downloading github.com/lib/pq v1.10.2
    go: downloading github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
    go: downloading github.com/rs/zerolog v1.23.0
    go: downloading github.com/tidwall/sjson v1.1.7
    go: downloading github.com/btcsuite/btcd v0.20.1-beta.0.20200515232429-9f0179fd2c46
    go: downloading github.com/tidwall/gjson v1.8.1
    go: downloading github.com/fiatjaf/eclair-go v0.2.1
    go: downloading github.com/fiatjaf/lightningd-gjson-rpc v1.4.0
    go: downloading github.com/lnpay/lnpay-go v1.1.0
    go: downloading github.com/tidwall/match v1.0.3
    go: downloading github.com/tidwall/pretty v1.1.0
    go: downloading github.com/gorilla/websocket v1.4.2
    go: downloading github.com/fiatjaf/ln-decodepay v1.0.0
    go: downloading github.com/lightningnetwork/lnd v0.10.1-beta
    go: downloading golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
    go: downloading github.com/imroc/req v0.3.0
    go: downloading github.com/cockroachdb/errors v1.8.1
    go: downloading github.com/cockroachdb/redact v1.0.8
    go: downloading github.com/btcsuite/btcutil v1.0.2
    go: downloading github.com/davecgh/go-spew v1.1.1
    go: downloading github.com/go-errors/errors v1.0.1
    go: downloading github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2
    go: downloading github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f
    go: downloading golang.org/x/exp v0.0.0-20200513190911-00229845015e
    go: downloading github.com/DataDog/zstd v1.4.5
    go: downloading github.com/cespare/xxhash v1.1.0
    go: downloading github.com/cespare/xxhash/v2 v2.1.1
    go: downloading github.com/golang/snappy v0.0.3
    go: downloading github.com/klauspost/compress v1.11.7
    go: downloading golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4
    go: downloading github.com/miekg/dns v0.0.0-20171125082028-79bfde677fa8
    go: downloading golang.org/x/net v0.0.0-20201021035429-f5854403a974
    go: downloading github.com/gogo/protobuf v1.3.1
    go: downloading github.com/kr/pretty v0.1.0
    go: downloading github.com/pkg/errors v0.9.1
    go: downloading github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
    go: downloading github.com/btcsuite/btcwallet v0.11.1-0.20200515224913-e0e62245ecbe
    go: downloading github.com/btcsuite/btcwallet/walletdb v1.3.1
    go: downloading github.com/kr/text v0.1.0
    go: downloading github.com/btcsuite/btcwallet/wallet/txauthor v1.0.0
    go: downloading github.com/btcsuite/btcwallet/wallet/txrules v1.0.0
    go: downloading github.com/btcsuite/btcwallet/wtxmgr v1.1.1-0.20200515224913-e0e62245ecbe
    go: downloading github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf
    go: downloading github.com/lightninglabs/neutrino v0.11.1-0.20200316235139-bffc52e8f200
    go: downloading github.com/btcsuite/btcwallet/wallet/txsizes v1.0.0
    go: downloading github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd
    go: downloading github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792
    go: downloading github.com/aead/siphash v1.0.1
    go: downloading github.com/kkdai/bstream v0.0.0-20181106074824-b3251f7901ec
    go: downloading github.com/lightningnetwork/lnd/queue v1.0.3
    go: downloading github.com/lightningnetwork/lnd/ticker v1.0.0
    # github.com/fiatjaf/satdress
    ./main.go:54:3: undefined: makeinvoice
    The command '/bin/sh -c go get' returned a non-zero code: 2
    
    
  • Bad payload sent to lnbits

    Bad payload sent to lnbits

    I am already using a satdress on a domain that I don't manage with my lnbits, I tried to make use satdress on my own domain but I get different payload sent to lnbits

    On my satdress instance, LNbits returns a HTTP 400 bad request at the moment where invoice should be created, HTTP exchange below :

    POST /api/v1/payments HTTP/1.1
    Host: localhost:5000
    User-Agent: Go-http-client/1.1
    Content-Length: 148
    Content-Type: application/json
    X-Api-Key: [REDACTED]
    Accept-Encoding: gzip
    
    {"amount":1150,"out":false,"unhashed_description":"[[\"text/identifier\",\"ben@[REDACTED]\"],[\"text/plain\",\"Satoshis to ben@[REDACTED].\"]]"}
    
    
    HTTP/1.1 400 Bad Request
    date: Sat, 10 Sep 2022 22:11:22 GMT
    server: uvicorn
    content-length: 62
    content-type: application/json
    
    {"detail":"'unhashed_description' must be a valid hex string"}
    

    Please note that I tried to put the remote API URL instead of the localhost one, the problem still remains.

    Satdress logs that with the following line

    <nil> DBG invoice generation error="call to lnbits failed (400): {\"detail\":\"'unhashed_description' must be a valid hex string\"}" backend={"Cert":"","Host":"https://[REDACTED]","Key":"[REDACTED]"} bolt11= msatoshi=1500000
    

    Here a working exchange with another satdress instance (I don't manage that other satdress instance)

    POST /api/v1/payments HTTP/1.0
    Host: [REDACTED]
    X-Forwarded-Proto: https
    X-Real-IP: [REDACTED]
    X-Forwarded-For: [REDACTED]
    Connection: close
    Content-Length: 113
    User-Agent: Go-http-client/1.1
    Content-Type: application/json
    X-Api-Key: [REDACTED]
    Accept-Encoding: gzip
    
    {"amount":1050,"out":false,"description_hash":"781eecd7a3a4aa7671dee05687a4d1e8ecc6e7bf2f02cca2c54b43aba369ef52"}
    
    
    HTTP/1.1 201 Created
    date: Sat, 10 Sep 2022 22:11:51 GMT
    server: uvicorn
    content-length: 603
    content-type: application/json
    connection: close
    {"payment_hash":"1bf71b3220ed6fe71ae28705b2922f478cea731f0a7f9633da445beb14db57a9","payment_request":"[REDACTED]","checking_id":"[REDACTED]","lnurl_response":null}
    

    It can be noticed that the payloads contain different objects description_hash for the one that works, and unhashed_description about the one that fails.

    Using LNbits version 6f9ad06449739f4ad9ed22174e26cd7a6c59e1c2

  • commando: unknown parameter amount_msat

    commando: unknown parameter amount_msat

    Im trying out the new commando backend. Im using cln 0.11.2. I made the rune with lightning-cli commando-rune restrictions='["method=invoice"]' But i get this error after hitting submit: couldn't make an invoice with the given data: unknown parameter: amount_msat, this may be caused by a failure to autodetect key=value-style parameters. Please try using the -k flag and explicit key=value pairs of parameters.

  • JSON API

    JSON API

    Small JSON API with POST, GET, PUT and DELETE operations, that allows to programmatically claim, update and delete a (federated) Lightning Address on a satdress server. Down below are some example requests done with curl.

    Claiming a username:

    curl --request POST \
    --url https://satdress.com/api/v1/claim \
    --data '{
        "name": "satoshi",
        "kind": "lnd",
        "host": "https://lnd.satdress.com:8080",
        "key": "invoicemacaroonkgCumHVZaeOCS+R",
        "pak": "",
        "waki": "",
        "pin": "",
        "minSendable": "1000",
        "maxSendable": "100000000"
    }'
    

    Response:

    {
        "ok": true,
        "message": "claimed [email protected]",
        "data": {
            "name": "satoshi",
            "pin": "49203e7b92a805daf7da74b1a39c0a7b02627c2cce523f4d26742c3539433238",
            "invoice": "lnbc10n1........"
        }
    }
    
    

    Authenticated request on an existing user:

    curl --request GET \
    --url https://satdress.com/api/v1/users/satoshi \
    --header 'X-Pin: 49203e7b92a805daf7da74b1a39c0a7b02627c2cce523f4d26742c3539433238'
    

    Response:

    {
        "ok": true,
        "message": "[email protected] found",
        "data": {
            "name": "satoshi",
            "kind": "lnd",
            "host": "https://lnd.satdress.com:8080",
            "key": "invoicemacaroonkgCumHVZaeOCS+R",
            "pak": "",
            "waki": "",
            "pin": "49203e7b92a805daf7da74b1a39c0a7b02627c2cce523f4d26742c3539433238'",
            "minSendable": "1000",
            "maxSendable": "100000000"
        }
    }
    

    The /api/v1/claim endpoint does not need any authentication (pin) but a /api/v1/users/{name} request has to be authenticated through a custom header (X-Pin). Would probably be cool to use JWTs here instead and put those in the Authentication header but I didn't want to change too much of the existing code base.

    This is my first try at writing a JSON API so I'm not sure about if I chose the correct data formats, if the authentication method I used is secure or if there are some other fatal flaws. For that reason I don't expect this to get merged but I would greatly appreciate any kind of feedback (positive or negative).

    What I find interesting about federated Lightning Address servers is that now anyone with a cool domain name could sell/rent out addresses. An API could make it easier to seamlessly integrate that feature into other wallets.

  • API endpoint

    API endpoint

    It would be great if the exact same form that is sent through the UI in order to claim a Lightning Address, could also be sent over a very simple JSON api. Something like "/api/v1/claim" or whatever you want to call it. This would allow services and wallets to program this on behalf of the customers/users.

  • text/identifier and text/plain missing username

    text/identifier and text/plain missing username

    The json object seems to be missing the actual username: {"status":"OK","callback":"https://ln.fitti.io/.well-known/lnurlp/fitti","tag":"payRequest","maxSendable":100000000,"minSendable":1000,"metadata":"[[\"text/identifier\",\"@ln.fitti.io\"],[\"text/plain\",\"Satoshis to @ln.fitti.io.\"]]","commentAllowed":0}

  • Upper case in

    Upper case in "Desired Username" means they cannot be found later.

    After creating User21952 it couldn't be found (though creating user21952 was blocked.)

    :~/bin/satdress$ PORT=17422 DOMAIN=merak-4.BitID.nz SECRET='SECRET' SITE_OWNER_URL=https://t.me/user21952 SITE_OWNER_NAME=@user21952 SITE_NAME=BitID ./satdress
    <nil> DBG listening addr=0.0.0.0:17422
    <nil> DBG generating invoice backend={"Cert":"","Host":"https://lnbits.com","Key":"[]"} description_hash=[] msatoshi=1000
    <nil> DBG &{ lnbits https://lnbits.com []}
    <nil> DBG {"Name":"","Kind":"lnbits","Host":"https://lnbits.com","Key":"[]","Pak":"","Waki":""}
    <nil> ERR failed to get name error="pebble: not found" name=user21952
    
    

    This behaviour seems to depend on the payer's wallet.

    https://lightningdecoder.com/[email protected] fails but

    /send 1337 [email protected]

    succeeds:

    payaddress.co says:
    Payment received!
    

    However

    /send 1337 [email protected]

    fails payaddress.co lnurl error: failed to get name paywallstuff

  • build fails when cross compiling for openbsd

    build fails when cross compiling for openbsd

    Seems to be an issue with pebble:

    GOOS=openbsd GOARCH=amd64 go build
    # github.com/cockroachdb/pebble/vfs
    ../../../../go/pkg/mod/github.com/cockroachdb/[email protected]/vfs/disk_usage_unix.go:17:27: stat.Bsize undefined (type unix.Statfs_t has no field or method Bsize)
    ../../../../go/pkg/mod/github.com/cockroachdb/[email protected]/vfs/disk_usage_unix.go:17:48: stat.Bfree undefined (type unix.Statfs_t has no field or method Bfree)
    ../../../../go/pkg/mod/github.com/cockroachdb/[email protected]/vfs/disk_usage_unix.go:18:28: stat.Bsize undefined (type unix.Statfs_t has no field or method Bsize)
    ../../../../go/pkg/mod/github.com/cockroachdb/[email protected]/vfs/disk_usage_unix.go:18:49: stat.Bavail undefined (type unix.Statfs_t has no field or method Bavail)
    ../../../../go/pkg/mod/github.com/cockroachdb/[email protected]/vfs/disk_usage_unix.go:19:28: stat.Bsize undefined (type unix.Statfs_t has no field or method Bsize)
    ../../../../go/pkg/mod/github.com/cockroaGOOS=openbsd: exit 2
    chdb/[email protected]/vfs/disk_usage_unix.go:19:49: stat.Blocks undefined (type unix.Statfs_t has no field or method Blocks)
    

    I tried setting pebble to a newer version in go.mod but got the same error.

  • Add optional support to hide node pubkey with lnproxy

    Add optional support to hide node pubkey with lnproxy

    As suggested in https://github.com/nbd-wtf/satdress/issues/41 and https://github.com/lnproxy/lnproxy/issues/7

    This PR adds a config option to allow the address bridge server to hide node pubkeys by first wrapping all invoices with lnproxy (see README here: https://github.com/lnproxy/lnproxy).

  • Suggestion: Check into combining LNProxy with satdress

    Suggestion: Check into combining LNProxy with satdress

    By combining the LNProxy wrapped invoices with satdress, the bridge could serve as an automatic proxy for every transaction, routed through the LN address server node.

    Easy private wrapped invoices with simple UX, just share a LNaddress.

    Here's the link to LNProxy: https://github.com/lnproxy/lnproxy

  • .env parameters

    .env parameters

    PORT=17422 DOMAIN=bitmia.com SECRET=askdbasjdhvakjvsdjasd SITE_OWNER_URL=https://t.me/qecez SITE_OWNER_NAME=@qecez SITE_NAME=Bitmia

    What does SECRET means here? How do I find this secret?

  • Setting description in invoice params

    Setting description in invoice params

    Isn't the description also supposed to be set here?: https://github.com/fiatjaf/satdress/blob/5574a494edb36e88716107361522c8979e63ebac/makeinvoice.go#L67

a simple http server as replacement of python -m http.server

ser a simple http server as replacement of python -m http.server

Dec 5, 2022
OpenAPI specs for your Go server, generated at server runtime. No CLI, no code generation, and no HTTP

Overview "oas" is short for "OpenAPI Spec". Go package for generating OpenAPI docs at runtime. Non-features: No code generation. No CLI. No magic comm

Dec 3, 2021
A Language Server Protocol (LSP) server for Jsonnet

Jsonnet Language Server A Language Server Protocol (LSP) server for Jsonnet. Features Jump to definition self-support.mp4 dollar-support.mp4 Error/War

Dec 14, 2022
Go web server - A web server that can accept a GET request and serve a response.

go_web_server A web server that can accept a GET request and serve a response. Go is a great language for creating simple yet efficient web servers an

Jan 3, 2022
:tophat: Small self-contained pure-Go web server with Lua, Markdown, HTTP/2, QUIC, Redis and PostgreSQL support
:tophat: Small self-contained pure-Go web server with Lua, Markdown, HTTP/2, QUIC, Redis and PostgreSQL support

Web server with built-in support for QUIC, HTTP/2, Lua, Markdown, Pongo2, HyperApp, Amber, Sass(SCSS), GCSS, JSX, BoltDB (built-in, stores the databas

Jan 1, 2023
Fast, multi-platform web server with automatic HTTPS
Fast, multi-platform web server with automatic HTTPS

a project Every site on HTTPS Caddy is an extensible server platform that uses TLS by default. Releases · Documentation · Get Help Menu Features Insta

Jan 1, 2023
A simple SHOUTcast server.

DudelDu DudelDu is a simple audio/video streaming server using the SHOUTcast protocol. Features Supports various streaming clients: VLC, ServeStream,

Nov 20, 2022
A feature flag solution, with only a YAML file in the backend (S3, GitHub, HTTP, local file ...), no server to install, just add a file in a central system and refer to it. 🎛️
A feature flag solution, with only a YAML file in the backend (S3, GitHub, HTTP, local file ...), no server to install, just add a file in a central system and refer to it. 🎛️

??️ go-feature-flag A feature flag solution, with YAML file in the backend (S3, GitHub, HTTP, local file ...). No server to install, just add a file i

Dec 29, 2022
An XMPP server written in Go (Golang).

jackal An XMPP server written in Go. About jackal is a free, open-source, high performance XMPP server which aims to be known for its stability, simpl

Dec 29, 2022
A proxy server than converts JSON request bodies to protocol buffers
A proxy server than converts JSON request bodies to protocol buffers

Welcome to Protoxy ?? What is Protoxy? Protoxy allows you to test your REST APIs that use Protocol Buffer serialization through Postman and other API

Nov 1, 2022
High-performance PHP application server, load-balancer and process manager written in Golang
High-performance PHP application server, load-balancer and process manager written in Golang

[RR2-BETA] RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports runnin

Jan 4, 2023
Fully featured and highly configurable SFTP server with optional FTP/S and WebDAV support - S3, Google Cloud Storage, Azure Blob

SFTPGo Fully featured and highly configurable SFTP server with optional FTP/S and WebDAV support, written in Go. Several storage backends are supporte

Jan 9, 2023
A RTP -> WebRTC broadcast server for Project Lightspeed.

Project Lightspeed WebRTC A RTP -> WebRTC server based on Pion written in Go. This server accepts RTP packets on port 65535 and broadcasts them via We

Sep 1, 2022
Heart 💜A high performance Lua web server with a simple, powerful API
Heart 💜A high performance Lua web server with a simple, powerful API

Heart ?? A high performance Lua web server with a simple, powerful API. See the full documentation here. Overview Heart combines Go's fasthttp with Lu

Aug 31, 2022
The Galène videoconferencing server

The Galène videoconferencing server

Dec 28, 2022
A push notification server written in Go (Golang).
A push notification server written in Go (Golang).

A push notification micro server using Gin framework written in Go (Golang)

Jan 9, 2023
KissLists is a very simple shared lists server
KissLists is a very simple shared lists server

KissLists is a very simple shared lists server. with mobile optimised design basic theme support websockets messages sqlite database but no

Nov 30, 2022
⚡ A fast, lightweight, and secure chat protocol, client and server, written in Go.

⚡ A fast, lightweight, and secure chat protocol, client and server, written in Go.

Oct 27, 2022
Demonstration of a browser connecting to Pion WebRTC without a signaling server.
Demonstration of a browser connecting to Pion WebRTC without a signaling server.

Offline Browser Sync WebRTC without a signaling server! This repo demonstrates how you can connect two WebRTC proccesses without signaling. No configu

Dec 29, 2022