nbd-wtf / satdress Goto Github PK
View Code? Open in Web Editor NEWFederated Lightning addresses server.
License: MIT License
Federated Lightning addresses server.
License: MIT License
For LNbits Node Backend Type accept an LNbits LNURLp in the Host field and instead of synthesising the LNURLp parameters directly obtain them from:
LNURL1DP68GURN8GHJ7MRWVF5HGUEWVDHK6TMVDE6HYMRS9ASHQ6F0WCCJ7MRWW4EXCTEHXQUQWSA9LF
aka
https://lnbits.com/lnurlp/api/v1/lnurl/708
Returning
{
"callback": "https://lnbits.com/lnurlp/api/v1/lnurl/cb/708",
"maxSendable": 1337,
"metadata": "[[\"text/plain\", \"Lightning Address LNURLp\"]]",
"minSendable": 1337,
"tag": "payRequest"
}
This gives Lightning Address capability with LNbits configuration, handling and response allowing fixed or different range payments and webhooks.
You could prompt the user to designate min and max sats for payment to the lightning address, as this is configurable according to the spec.
After:
debian@merak-4:~/bin/satdress$ go build
Error:
build github.com/fiatjaf/satdress: cannot find module for path embed
From:
package main
import (
"crypto/hmac"
"crypto/sha256"
_ "embed"
"encoding/hex"
"encoding/json"
Any tips?
Hi! I'm running a Yunohost server with a Norwegian bitcoin forum bitrom forum
is it possible to make a app package to install in the server?
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?
Apparently underscores in the username cause the wrong description hash to be returned.
couldn't make an invoice with the given data: Post "XYZ.onion:9735/v1/invoices": unsupported protocol scheme "XYZ.onion"
Does this mean that the server doesn't have Tor enabled? I tried several of the public servers. All the same.
This runs it:
~/bin$ PORT=17422 DOMAIN=Satdress.BitID.nz SECRET='REDACTED' SITE_OWNER_URL=https://t.me/user21952 SITE_OWNER_NAME=@user21952 SITE_NAME=BitID ./satdress
<nil> DBG listening addr=0.0.0.0:17422
The result is at http://135.125.129.136:17422/
Despite the DOMAIN setting the identifier domain is presented as @BitID.BitID.nz
instead of Satdress.BitID.nz
Tried tType LNbits with the Host being the URL to LNBits local instance landing page (guessing that's a good place to start) and in the Key field I used the wal=
value.
This didn't work, maybe too early. The error was:
couldn't make an invoice with the given data: call to lnbits failed (500): LNbits internal error!
Traceback (most recent call last):
File "/opt/mynode/lnbits/venv/lib/python3.7/site-packages/quart_trio/app.py", line 151, in full_dispatch_request
result = await self.dispatch_request(request_context)
File "/opt/mynode/lnbits/venv/lib/python3.7/site-packages/quart/ap
Perhaps the Host should be an LNURLp link from the account, so that the user can set the range and other results.
The Key field reset it's name to Macaroon
Further attempts resulted in the Host information being ignored and the calls being attempted to the satdress host:
http://135.125.129.136:17422/grab
Looking forward to the next release.
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.
Isn't the description also supposed to be set here?: https://github.com/fiatjaf/satdress/blob/5574a494edb36e88716107361522c8979e63ebac/makeinvoice.go#L67
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.
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
I would like a feature where all addresses require paying a configurable amount of sats first.
I try to connect my self-hosted satdress
to LNbits, using the latest pre-built binary v0.2.1. I use the following settings, for "host" I tried https://lnbits.com
, https://lnbits.com:80
and other settings.
When I click on "Submit", the satdress
application immediately aborts:
satdress@stadicus:~/satdress$ ./satdress
<nil> DBG listening addr=0.0.0.0:17329
<nil> DBG generating invoice backend={"Cert":"","Host":"https://lnbits.com","Key":"02686a9869144bbb9ee8b107be7a77b8"} description_hash=3b9428922ff81dbeb40d8d75d59360ca2b58c597ecbfb04230ff1b02036e6467 msatoshi=1000
satdress: dl-call-libc-early-init.c:37: _dl_call_libc_early_init: Assertion `sym != NULL' failed.
SIGABRT: abort
PC=0xb18212 m=0 sigcode=18446744073709551610
goroutine 0 [idle]:
runtime: unknown pc 0xb18212
stack: frame={sp:0x7ffdfbea4a50, fp:0x0} stack=[0x7ffdfb6a6d08,0x7ffdfbea5d40)
00007ffdfbea4950: 0000000000000000 0000000000b9ede8
00007ffdfbea4960: 0000000000000000 0000000200000000
00007ffdfbea4970: 00007ffd10000000 0000000002da7d90
...
I also tried "host" without the protocol prefix: lnbits.com
or lnbits.com:80
. While the app does not abort, it shows the following error message:
DBG generating invoice backend={"Cert":"","Host":"lnbits.com:80","Key":"02686a9869144bbb9ee8b107be7a77b8"} description_hash=3b9428922ff81dbeb40d8d75d59360ca2b58c597ecbfb04230ff1b02036e6467 msatoshi=1000
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
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
I noticed my satdress lightningaddress can't be added to a bolt.fun profile because the status 200 check their website does is not working because satdress server doesn't return CORS headers with requests.
Thanks very much for the PINvoice (PIN in invoice)!
Note: "[email protected]" rather than substitution of actual values
When there's an error e.g.:
<nil> DBG invoice generation error="Post \"https://lnbits.com/api/v1/payments\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)" backend={"Cert":"","Host":"https://lnbits.com","Key":"83ce983075154a348ffdb9b1490b7be0"} bolt11= msatoshi=1000
and you go back from /grab
the form is not restored.
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
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.
Satdress is a really nice option to deliver lightning addresses to the mass.
But wouldn't it be nice if it's also possible to get the same NIP05 nostr verification for that lightning address?
does satdress support tor?
clearnet setups work
but when i try to setup a onionservice it gives me:
couldn't make an invoice with the given data: call to lnbits failed (501): <html>
<head>
<title>This is a SOCKS Proxy, Not An HTTP Proxy</title>
</head>
<body>
<h1>This is a SOCKs proxy, not an HTTP proxy.</h1>
<p>
It appears you have configured your web browser to use this Tor port as
an HTTP proxy.
</p><p>
This is not correct: This port is configured as a SOCKS proxy, no
this is my docker-compose
version: "3.7"
services:
satdress:
build: .
container_name: satdress
restart: always
environment:
- PORT=17422
- DOMAIN=xyzui.com
- SECRET=qsssdfdxyzjdhokidfdfdwaslpoz
- SITE_OWNER_URL=https://t.me/fdf
- SITE_OWNER_NAME=@dfdf
- SITE_NAME=Satdress
- TOR_PROXY_URL=socks5h://tor:9050
ports:
- 17422:17422
volumes:
- satdressData:/satdress.com
networks:
- proxy
tor:
container_name: tor
image: dperson/torproxy
ports:
- 9050:9050
restart: always
ports:
- 9050:9050
networks:
- proxy
networks:
proxy:
name: root_proxy
external: true
volumes:
satdressData:
name: satdressData
Would be a great idea to make this a 2 step solution. You click the deploy button on the readme and it will spin up an instance of satdress for you given certain criteria (aka domain). Something for the future, but putting there so we don't forget. Could be Herkou as well!
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.
I suggest to integrate LNC (from Lightning Labs) into satdress
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}
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.
Request to pay [email protected] (valid according to https://lightningdecoder.com/[email protected]) from LNbits.com (and local instance) responds with
invalid lnurl
400
The satdress
output is:
<nil> INF got lnurl request username=iceland
<nil> DBG {iceland lnbits https://lnbits.net/ [KEY] }
The LNURLp data returned from:
https://merak-4.bitid.nz/.well-known/lnurlp/iceland
is:
{"status":"OK","callback":"https://merak-4.BitID.nz/.well-known/lnurlp/iceland","tag":"payRequest","maxSendable":100000000,"minSendable":1000,"metadata":"[[\"text/identifier\",\"[email protected]\"],[\"text/plain\",\"Satoshis to [email protected]."]]","commentAllowed":0}
Meanwhile
/send 1337 [email protected]
has this satdress
output (but there is no route to settle payment of invoice)
<nil> INF got lnurl request username=iceland
<nil> DBG generating invoice backend={"Cert":"","Host":"https://lnbits.net/","Key":"[KEY]"} description_hash=b0624c1bbcad92bc3d9ac9820a05b869b6a7c93af52d6b31e0779c92a5903e08 msatoshi=1337000
Using
DOMAIN=merak-4.BitID.nz
Resulted in issues for SBW, #akumaigorodski/wallet#59.
Working around that until the patch is released seemed possible by altering the value to
DOMAIN=merak-4.bitid.nz
satdress
promptly, and perhaps reasonably, created a new database directory, merak-4.bitid.nz
along side the existing merak-4.BitID.nz
Removing the new directory and renaming the existing directory worked as hoped.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.