Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proof-of-Work on the phone (Proof of Concept) #212

Closed
maxmoney21m opened this issue Mar 6, 2023 · 11 comments
Closed

Proof-of-Work on the phone (Proof of Concept) #212

maxmoney21m opened this issue Mar 6, 2023 · 11 comments

Comments

@maxmoney21m
Copy link
Contributor

I saw this on the "TODO" list and thought I'd give it a try.

amethyst_pow.mp4

Code is very rough right now, but I think it's a decent proof of concept and should be a good starting point.

maxmoney21m added a commit to maxmoney21m/amethyst that referenced this issue Mar 6, 2023
@Chemaclass
Copy link
Contributor

Sorry, but by looking at the demo I didn't get it. What are we doing with this PoW-thing here? I mean, what's suppose to do?
Screenshot 2023-03-06 at 17 40 06

@maxmoney21m
Copy link
Contributor Author

maxmoney21m commented Mar 6, 2023

Check out NIP-13.

Basically PoW is a way to prove that you spent money (or rather: energy, which amounts to the same thing) on something. It's the same type of PoW as in Bitcoin mining, actually. It's just mining nostr notes.

The basic idea is that notes can have PoW attached, and notes with PoW would be far less likely to be spam since it actually takes a little time to send them. Relays or clients could use PoW as another tool in the chest both for fighting spam and for figuring out how to prioritize notes for display to readers. If someone attached a huge amount of PoW to a note, likely they thought it was important, so maybe you want to read it.

Phones can't do much, but if you don't mind that your note gets sent in 10 seconds or 2 hours, you could still do something. The amount of PoW is configurable, more takes longer of course. But that's why it runs in the background and gets a notification, so you can do other stuff while Amethyst crunches away on the PoW.

To make this usable we would need:

  • A screen which shows an estimate of how long it will take to add N bits of PoW, and a way to set the amount you want (might be different per note, and of course this is an optional feature that you won't use on most notes, so a few extra taps would be OK)
  • Showing the PoW on other notes that have it (most don't)
  • Probably some kind of filter to see only notes with PoW attached, or only above a certain amount

Interestingly, it also gives you a way to cancel sending a note after hitting send. Maybe some people would like to always use 5 seconds worth of PoW, it would give them 5 seconds to cancel sending the note (like in Gmail how you have a about 5 seconds to unsend).

Also, there might be external PoW service providers in the future so you can simply buy it instead of doing it yourself, but it's cool to have the option to do a little bit on your phone directly.

@maxmoney21m
Copy link
Contributor Author

(Fatfingered the close button.)

@Chemaclass
Copy link
Contributor

Thanks for the clarification, now it makes sense. I like it specially for the spam filtering, and I can see the value on those 3 points you remarked 👌🏼

@vitorpamplona
Copy link
Owner

vitorpamplona commented Mar 6, 2023

Nice! Post the video on Nostr. I will boost to see what people think :)

My first reaction is that it should be a screen inside the app (maybe together with the notification?) and we need a better way to display when posts are in the queue to be sent.

@maxmoney21m
Copy link
Contributor Author

There can be a screen in the app which gets LiveData updates from the Worker, but they do need to run in Workers on a background task, with a persistent service notification in order to live through leaving the app and doing other stuff while waiting for it to be sent. So it would be both. The screen should also show the queue since we can only do one at a time, and allow cancelling any item (either discard or send straight away without PoW).

Ideally the notification would show a rough ETA (maybe a range). That should be easy to calculate by doing a 1 second benchmark on app start or something.

Posted the screen recording here note1j7yyvsny2eysnyayjsqlxd6xxa8ne4x9t7g854hjy6tg2zzrfj6snw58an

@maxmoney21m
Copy link
Contributor Author

@3j2009 if you want to do some design mockups for this stuff that would be awesome. I don't know if I'll have time to actually do the full thing because there's still quite a lot of work from this proof of concept. But I imagine whoever does it will appreciate having the designs ready to go!

@3j2009
Copy link

3j2009 commented Mar 7, 2023

quick mockup video below.

Note: For the 2 points you mentioned about identifying notes that have or have not added POW as well as filters we can detail those as separate issues.

Interested to hear your thoughts:

POW.mp4

@3j2009
Copy link

3j2009 commented Mar 7, 2023

Also btw: Changed the "upload image" button to a classic paper clip attachment button to make room in the top toolbar for the POW button.

@maxmoney21m
Copy link
Contributor Author

Looks good. Great idea with the dumbbell icon. I was initially thinking a long press on the post button, but this is better.

@maxmoney21m
Copy link
Contributor Author

Closing in favor of #2

@maxmoney21m maxmoney21m mentioned this issue Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants