Anyone running a relay and has any hints on configuring paid access to avoid spam? Using nostr-rs-relay atm

#asknostr #nostr #relay #whatislife

Reply to this note

Please Login to reply.

Discussion

You'll need to install lnbits to process the payments. Or, use someone else's. I used lnbits.lnwallet.app and then copied the invoice api key to the api_key field below.

Add the following to your config.toml then restart.

nip42_auth = true

[pay_to_relay]

# Enable pay to relay

enabled = true

# The cost to be admitted to relay

admission_cost = 100

# The cost in sats per post

cost_per_event = 0

# Url of lnbits api

node_url = "https://lnbits.lnwallet.app"

# LNBits api secret

api_secret = "1234567890abcdefgh0987654"

Thanks, will try it out. I already have lnbits running for the lnurl for my zaps. This setup you posted is for one time payment, is it also possible to set it up time based, for example pay for one year, then you have to renew the "subscription"?

No, not time based. But, that second setting, you could charge 1 sat per post rather than a single one time payment. People then deposit an amount and top it up after they've used it up.

So far I got stuck on some wierd error, If I enable the payment I just get a crash, with a very useless backtrace in the log, thread main panicked at src/config.rs:263:13, assertion left != right failed... If I comment out the payment settings if works fine... not sure where the issue could be

That error message usually means an error in the config format. Send me your config.toml via DM and I'll have a look.

I went through the code source and found it. The problem was that I had not set the "terms_message =". It works now.

But now next step is trying to wrap my head around how this actually works. So far I found out that most clients don't support this directly (or is there some trick?) So I guess I will have to make a webpage for a user to pay for access. Or it there some smoother way for a nicer user experience?