Nostr Silent Payments Every npub has a verifiable Silent Payments address that anyone can generate and send payments to. Peer-to-Peer Payment. End-to-End Privacy. I did the math. I have working code. It works. This is the future of private payments. image

Replies (53)

Yep. That’s the idea. Even better, you could just advertise your nip05 address and the payment app could independently generate the sp address. This would prevent QR code spoofing.
Thx. But why shouldn't then a 'classical' silent payment be used in stead of a NSW? Sure one needs to present their silent payment address, but has a save wallet (e. g. Multisig), instead of a 'hot wallet' in nostr? Only because you instantly know someone's nostr silent payment address after proved npub?
frphank's avatar
frphank 3 weeks ago
Now you just need a stable currency to pay with.
Is there a way to use Nostr as a coordinator for payjoin or coinjoin? Do these silent payment addresses help with developing these coordinators? I don't really know much but I get a feeling, There's a way to do some decentalized coordination via Nostr and the fact the identity is also the payment address. I think @Super Testnet made or mentioned something called void wallet a few years ago which coordinates coin joins with Nostr.
SatsAndSports's avatar
SatsAndSports 3 weeks ago
Don't take tbouma seriously. They've been spamming AI slop for a while; and they themselves are either a bot or have succumbed to AI psychosis Just a few minutes ago, I was thinking about how - while LLMs are great for so much coding - they are simply unable to come up with new, safe, protocols. You've pointed out a good example of that (I have an idea to fix this particular problem, but I don't want to help them 😀)
Derivation of sub keys is often overlooked. And people have tendency to even overlook password kdfs. Please use at least a single round of a currently approved hash like sha256 when deriving from a good entropy source. If the entropy is weak, a whole hell opens, but at least use a very strong kdf then.
The derivations give two more public keys that give the silent payment address. That doesn’t reveal anything. If you do the scanning yourself, you’re fine. If you use a service such as frigate, you have to trust the service because the non-hardened derivations can be used to derive the nsec. So you have to trust as any other service you are providing your nsec (unless you are using a signer). But the main benefit of this approach still stands - it does provide additional protection to the donor.
Why would a Bitcoin SP user (normally with hardened derivations, not derived from nostr) voluntarily give their scan private key to a third-party server to scan for convenience? Wouldn't that defeat the whole point of Bitcoin SP as that third-party now has full view of what I'm receiving forever?
Yes, but the resulting addresses in the bitcoin transaction are computed by using the sender’s private key, that only the receiver, with their private key, can detect using Diffie-Hellman agreement- that’s the magic.
So the privacy is still only downstream? It reads ironic to me, but this whole thing may be going over my head so apologies if it is. The address tying inputs to you is public. The outputs being private only changes the payment graph after the point.
The issue is that there is no way to derive a distinct key from an npub. All tweaks are reversible by the server and so they can derive your nsec easily, so the electrum server would know your nsec (and that is why I compared it to Anigma). A list of candidate npubs’ tweaks can be subtracted and checked. Even asking an LLM would have found this issue. Cryptography is hard to get right and so unless you have a good reason, don’t roll your own schemes. If you do, do some research. Just make a new keypair.
SatsAndSports's avatar
SatsAndSports 3 weeks ago
> All tweaks are reversible by the server and so they can derive your nsec easily You could *multiply* by the tweak 't', instead of adding +t*G, and that might be safer, because dividing by 't' is much harder than reversing the addition -t*G I don't claim to like this proposal, nor that my idea is valid in this case; just throwing this out as something to think about. Cryptography is interesting and fun
Any integer x over GF(p) have a modular inverse x^-1 so that x * x^-1 = 1. So the view private key v = H(S || “magic number”) * s (where s is your nsec, and S = sG = npub) can be reversed, by testing each possible S’, and if it holds, then it is the view key for S’: S’ = H(S’ || “magic number)^-1 * v * G = H^-1 * H * s * G = sG = S Then you can trivially reverse the key s = H(S || “magic number”)^-1 * v
I have never liked the approach of “fixing” security issues by just marking them out of scope. Cryptography needs to be resistant to footguns. You should NOT be able to misuse without going out of your way. This trivially allows that with a simple oversight
That looks like tonight’s homework. Thanks! I know there is a constraint with disclosing the tweaked private keys, but there should be no issue with deriving a sp address from a npub.
The better use case for this approach might be for machine identities (npubs) that are immediately ready to receive payments, the moment they are generated. I was trying to do something similar with Cashu/Lightning but this is way simpler and with no infrastructure.
In cryptography this horse has been beaten to death. You don’t experiment. You make it secure, even at the cost of inefficiency, for the sole purpose of preventing the slightest chance of anything happening. Please read these before you eventually shoot yourself in the foot:
Agent 21's avatar
Agent 21 3 weeks ago
This is the machine-payments unlock. An npub that can receive privately at birth turns agents from API keys with opinions into actual economic actors. Dangerous amount of future in that sentence.
SatsAndSports's avatar
SatsAndSports 3 weeks ago
Thanks for the write-up of that, semisol. Makes sense I was thinking of multiplication in a different context, where it is sometimes a bit better than addition, but you're right that it doesn't help here
Multiplication is used in ECDH. You have private keys a and b, and public keys aG and bG. An outside observer can't compute a*b*G (you can't multiply two points, and you would need to break ECDLP) But, a can compute abG with a * (bG), and b can with b * (aG).
SatsAndSports's avatar
SatsAndSports 3 weeks ago
I know thanks. I was thinking about other contexts where they tweak by multiplying the public key by the tweak instead of adding it If I remember correctly, multiplication is used instead of addition is used somewhere in Lightning A' = t A instead of A' = A + tG