Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Bo
@worldpeaceenginelabs
image.png
Bo
@worldpeaceenginelabs
This message was deleted
9 replies
Gil Fuser
@gilfuser
Hello everyone. Total newbie here. Still trying to make the Gun Docs Learn example from the website work.
I have to say that the Codepen there is not working. Just as this part previewed: If something is no longer working, it means somebody probably trashed the account
and then please tell us on the chatroom so we can fix it.
Bo
@worldpeaceenginelabs
@amark @lexi @rococtz Do i need to encrypt the password when creating the user?
3 replies
Bo
@worldpeaceenginelabs

@gilfuser Welcome to the community.
Some of the interactive tutorials and or third party tutorials seem deprecated. We know. Thanks for telling us.

I just uploaded a GunJS Starter Kit + Quickstart + Artificial Intelligence Pair Programming - which will sure help you a lot advancing your Gun knowledge. Make use of ChatGPT, it safes you a lot of time and you can ask him every part of the code and he will explain to you. https://github.com/amark/gun/wiki/GunJS-Starterkit---Quickstart---Artificial-Intelligence-Pair-Programming

Gil Fuser
@gilfuser
Thank you Bo. I'll take a look
May I ask something really basic that I didn't understand?
Still using the old example in the website, I've made a github pages with it, and I'm running a local copy. They are not connecting. I think this is expected. So, how they can discover each other? Is that in the documentation?
Bo
@worldpeaceenginelabs

@gilfuser
Yes that is in the documentation (look at the documents name 😂)
https://github.com/amark/gun/wiki/GunJS-Starterkit---Quickstart---Artificial-Intelligence-Pair-Programming#gun-relays-gun-works-local-first-even-without-a-relay-but-for-syncing-between-clients-you-need-a-relay

Easiest way to start. Clone Electron-Gun, follow the instructions in the readme and drop the noip address into both clients let gun = Gun('youraddresshere/gun') should look like this: let gun = Gun([https://yournoipdomain.com/gun])
PS: in my example codes i use let db = Gun();, just you dont wonder! The name of your Gun instance is free to choose.

NoIP? Sign-up, download client, drop/extend the above line.
https://github.com/worldpeaceenginelabs/ELECTRON-GUN#make-your-desktop-gun-server-available-from-the-outside-centralized-way-for-development-fallback-or-scaling-eventually

2 replies
Gil Fuser
@gilfuser
Thank you for your patience, Bo!
learek
@learek:matrix.org
[m]
Hi, I have this problem on bitchute

cookielaw.js:1
Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
gun.js:509 Hello wonderful person! :) Thanks for using GUN, please ask for help on http://chat.gun.eco if anything takes you longer than 5min to figure out!
seed154.bitchute.com…/S6BoaCtqfsyP.mp4:1
Failed to load resource: the server responded with a status of 404 (Not Found)
seed154.bitchute.com…/S6BoaCtqfsyP.mp4:1
Failed to load resource: the server responded with a status of 404 (Not Found)
/static/v139/manifest.json:1
Failed to load resource: the server responded with a status of 404 ()
/static/v139/manifest.json:2 Manifest: Line: 2, column: 1, Syntax error.
gun.js:1785 Debugging p2p 'torrent' latency. Disable with localStorage.noTest=1.
manifest.json:1
Failed to load resource: the server responded with a status of 404 ()
videos not playing. Can you help me that I remove this mistake?
Is anybody ther?
there
????
learek
@learek:matrix.org
[m]
@gilfuser I am new here...
Sam
@Sam-Scolari
@amark I've been diving into different p2p tech and I was wondering what your thoughts were on Hypercore (Dat), and some practical differences between the two that you think makes Gun a better solution?
Steven Franssen
@stevenfranssen:matrix.org
[m]
@Sam-Scolari: hypercore was rebranded holepunch
1 reply
holepunch.to
keet.io
Lexi
@Lexi:matrix.org
[m]
amark (Mark Nadal): Hello, you seem to be able to tell which version of GUN a relay runs. How do you do that? I only ever get 0.202 returned back with GUN.version. (You mentioned finding out the version here for example amark/gun#1307)
Steven Franssen
@stevenfranssen:matrix.org
[m]
@Sam-Scolari: it is the company but also the new name for the tech stack, hypercore being one of the modules
i like the name because hypercore was also best at holepunching
Bo
@worldpeaceenginelabs

@amark Hey Mark, what do you think about this? Huge security and availability improvement i think. One could do it with any piece of data that has no time pressure at on-boarding/creation. As soon as its uploaded, its real-time again.

Take a look at the storage 🤯

Pages uploads each file on your site to Cloudflare’s globally distributed network to deliver a low latency experience to every user that visits your site. Cloudflare Pages sites can contain up to 20,000 files. The maximum file size for a single Cloudflare Pages site asset is 25 MiB.

https://github.com/worldpeaceenginelabs/1-MEGABYTE-INFINITY-STORE/edit/main/README.md#a-weird-thought-maybe-but-what-if-we-would-limit-the-on-boarding-sign-up-to-500-times-a-month--16times-a-day--every-15h--

Bo
@worldpeaceenginelabs

@amark

https://github.com/worldpeaceenginelabs/1-MEGABYTE-INFINITY-STORE/edit/main/README.md#a-weird-thought-maybe-but-what-if-we-would-limit-the-on-boarding-sign-up-to-500-times-a-month--16times-a-day--every-15h--

i see here a huge potential for production setups were persistant storage (e.g. AWS S3, SQL, Mongo, CockroachDB, IPFS...) could be completely replaced by edge dropping. Plus security improvements (these 200 edge servers are almost fort knox)

quick691
@quick691:matrix.org
[m]
Hi @amark, First thanks for your amazing work on gun. I'm trying to achieve ACL on gun and checkout your video about it but since secret() method is deprecated, what's the best method to achieve ACL with gun today ? Thanks
3 replies
Bo
@worldpeaceenginelabs
image.png
ok, this seems to work. But it seems that SEA isnt used??? Is it an unencrypted account now? Or is the SEA encryption stuff from the version above integrated into user.create and user.auth maybe? i am sooo confused 🥴
Bo
@worldpeaceenginelabs

user.create(alias, pass, cb, opt)
pass (string) = Passphrase that will be extended with PBKDF2 to make it a secure way to login.

So thats it? Its that simple? Sign-up, Login, Logout in around 10 lines? Encryption included?

7 replies
Bo
@worldpeaceenginelabs

https://github.com/worldpeaceenginelabs/GunJS-AUTH-SIGN-UP-LOGIN-LOGOUT

Gun Auth is a nice template to start your Gun app. It does what the name says and manages your session.
(documentation says passwords are encrypted PBKDF2, still not sure if thats enough security)

@amark Is it enough security this way? Or do we need SEA here? (asking only for sign-up, login!!! NOT data, thats user.get().put() plus SEA.encrpyt/decrypt if we want encrypt/decrypt data)

Lexi
@Lexi:matrix.org
[m]
Mozilla's documentation says there is only one other natively implemented key derivation function but PBKDF2 is supposed to be the only fitting one https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/deriveKey
Bo
@worldpeaceenginelabs

I have thousands of long/lat pairs in my database: example {long: 50.0, lat:14.0}

My user's position is {long: 50.0, lat:14.0}

Now i need all records containing long/lat which are: not more or less than 0.3 of long, and the same for lat

Good: 50.3 / 13.7
Bad: 49.5/ 14.4

Which is faster? Gun's lexical search or typical local searching the data for numbers not higher, lower than 0.3?
I guess lexical is more efficient in the way that it downloads only the results?

3 replies
Bo
@worldpeaceenginelabs
@amark
  1. under which conditions is the user record distributed along the peer network? in terms of how often is a user record in our database replicated? is it stored on other users devices? are we storing their credentials on ours? are they stored also on the relay?
  2. Relay: does it actually store stuff?(is harddisk size of the home or cloud relay a thing?), or does it relay only? If relaying only, does a Gun relay act kind of like a signaling server + Gun special stuff? (from Radata i would say it stores a huge index of everybody)
  3. how does a lexical search for data work in gun? am i searching on the other clients devices and download the matches? or does the relay index all data from all clients? or does it store stuff?
  4. whats faster? lexical search or downloading everything(sync) and then search in local storage?
Mark Nadal
@amark
@JesseTheRobot CRDT integrity is maintained yes, and SEA is default in relays too so verification integrity is also maintained. :+1: @Lexi:matrix.org . @benpreiss:matrix.org You're asking about an application-layer integrity, you'll want to enforce that with a schema :) ajv is a good one & combined with the open extension .open(data => if(!ajv.check(data, 'schema')){ return } // normal code now your code only executes if its operating on your specific application integirty/validity, which is higher order.
@ahg:it-dengler.de please share your library early with/for everyone! Get people to play with it :) . Link link link!
@Sam-Scolari :clap: @Lexi:matrix.org .
@viteorder:matrix.org it will be unordered, purely based on when/how which/what peers reply. This is where RAD comes in, because RAD will store the data lexically organized, so then when you query you'll get back lexical ranges... however this is unstable after the big performance update last year ( @lospringliu correct), and I'm switching from radix trees to binary search to make that faster/more-unified. So it could be some time before that's reliable for you :( I'm sorry, BUT! opportunity! Want to help me & scott & rogowski & norman & others work on this Book code?? :)
@worldpeaceenginelabs woooow I really like chatgpt's rave review of GUN :laughing: :D :D :D . It should be safer and inject "eventually consistency" into its answer :sweat: . Tho the code I've seen it generate gets mixed up with other 6+ year old code, so beware ( ??? do we need to scrub/delete historical docs to prevent this, but then we lose version history.... :/ .)
:clap: @jahs0nb_twitter :pray:
@gilfuser thank you for letting me know! I'll check. Sounds like you got it running locally, which is a good step, does your browser code have your localhost peer listed in it?
@learek:matrix.org hi! the JSON fetch errors are coming from a different system than GUN - so not able to help :( sorry.
@Sam-Scolari @stevenfranssen:matrix.org most of the other dWeb projects use append-only/immutable or content-hashed data structures. GUN can do mutable data AND immutable/etc. so realtime GPS updates is easy & efficient with GUN but could produce a lot of baggage in other systems.
@Lexi:matrix.org default relays deploy GUN as a CDN so you can just do domain.com/gun/package.json or load any other gun repo file, but that'll show you version it is running.
@worldpeaceenginelabs definitely want to make use of cheap services like that, but can't be vendor locked into that. Most storage engines are s3-API compatible, so all those systems are already open/interoperable :thumbsup: . Tho the other dweb/blockchain projects can't handle GUN's thruput even when throttled for storage writes. :/
Edge functions are not a security thing.
so things like geo-search & n-gram (full text search) are not special APIs to GUN, but people have used GUN to build n-gram/etc. features as prototypes on top (years ago tho). So +/- 0.3 lat/lng is gonna require indexing your data in a way that will let you search for that. Historically, I've used leaflet tilemaps indices to index the data, so that way the querying can work the same way mapping software works, and you'd just make slightly larger tilemap queries to have slightly larger space. I can talk about this more if need... examples/move ? or /where was being coded for p2p Uber geo matching.
@quick691:matrix.org :thumbsup: yeah try certify instead?
:fire: @Lexi:matrix.org on the cryptography pbkdf2 :thumbsup:
1 reply
Lexi
@Lexi:matrix.org
[m]
Thanks Mark :-)
Mark Nadal
@amark
@worldpeaceenginelabs
1) whenever you save data, it is attempted to be replicated to peers. It is definitely replicated when someone else queries for your data. People who subscribe to your data store it, or relays store (but maybe not permanently). Wise to always run a dedicated peer that stores stuff.
2) Relays also signal (even browsers will signal, browsers can relay too). A relay might store stuff on disk, but many relays run on emphemeral clouds that wipe their disk, so don't assume relays do store unless they're at-home peers like rasbpi, etc. or that you manually configured the relay to use permanent storage drives.
3) It uses a radix tree or (very similar) binary search. The gif on this page shows what that looks like: https://gun.eco/docs/RAD also, did talk recently on its performance I can send, or watch the https://gun.eco/docs/Porting-GUN talk (30min) where at the end I give a quick explanation of how RAD works. As "across peers" thats more toward DHT which is a bit more complicated, but conceptually the same thing. Happy to talk more about this, maybe better as a podcast.
  1. how big is the data?
Bo
@worldpeaceenginelabs

@amark
ChatGPT: Then maybe next time i will add he should not use code sources older than 2020 or so?

I actually want to leave the geo specific stuff away and just search records by the numbers(which is simple and efficient. 0.01 is 1 km). to search my data for a range n+-0.3 shouldnt be a problem, or is it?
(How big is the data? a post has max 1000 characters + 50.0000000/14.0000000 (7 digits accuracy) = so 1 record is max 1.02kb)

  1. but what is the user-account replication strategy? user.create stores locally and to the relay i guess? but since i am be able to login from every other device on that same relay, user-accounts seem to be somewhat distributed "everywhere"???

  2. What if the relay runs full? any Gun logic already built in?

  3. Would a lexical or binary search from my client, search records on the relay and or other clients, before it decides to sync/download them? or does gun.get('chat').get({'.': {'*': '2019/06/'}}).map().once(cb) first download ALL 'chat' messages and then show only the 2019/06 ones?

RAD is cool. i like the concept of the reusing the same data like in Alex and Alexandria. Is there a number? like if you have 1TB of RAD data, you safe a median of X GB?

@amark

  1. Lets say user A posts a couchsurfing stay. this gets stored in the relay's Radata folder. user a b and c looking up couchsurfing hosts, so they are subscribed like get(hostposts).on(data).
    They look up the post, which gets synced to their local store, so everything's fine.

Meanwile the record gets deleted from our relay, or even the relay is wiped and starts from scratch. Can we receive the post record with get(hostposts).on(data) stored locally at user a b and c now? till their local record is a copy of the original synced data? like a cluster recovery after relay wipe, kind of?

Bo
@worldpeaceenginelabs
PS: user location = 50.0000000/14.0000000
show all records long 49.0900000 - 50.0100000 / lat 14.0900000 - 14.0100000 results in receiving all records in a radius of 1km around the user's location

PS2: Could a relay maybe recover in the way, that since our clients did not receive a delete order, but the relay is empty, the relay starts now to re-sync from the clients local storages again?

Kind of a record could or maybe already does contain data about its sync state related to relay vitality.

If we could identify a relay wipe, this could be also a good mechanism/strategy to re-cover our user account records. since everybody seems to store the whole or big parts of the user accounts data, a wiped relay could re-sync the user accounts by re-chunking from all clients.

5 replies
Bo
@worldpeaceenginelabs

definitely want to make use of cheap services like that, but can't be vendor locked into that. Most storage engines are s3-API compatible, so all those systems are already open/interoperable :thumbsup: . Tho the other dweb/blockchain projects can't handle GUN's thruput even when throttled for storage writes. :/
Edge functions are not a security thing.

its basically a 500gb HTTPS harddrive, distributed around the world.
its like uploading encrypted files to your homepage or ftp server.

You can write only 500-5000 times per month.
But you can read your data with highspeed from 200 locations world-wide.

I dont see the vendor lock: you just upload whatever files to github, github syncs with cloudflare (or any other provider), cloudflare does the build and distributes to the edge network. (it doesnt have to be an app, you can also just upload static folders)

Just an idea: I was thinking about rendering the complete state of actual relays, but static on edge. (like a relay full of frozen spaces maybe?)
Simple method: maybe just dropping the Radata folders of actual relays on edge and register them as peers? (permanent storage?)
Maybe you could drop us a setting like https://gunrelay.com/guns/ (s for static, no inbound syncing) @amark
(or maybe just not using .put on this special relay would already do the job without any modification??? is it possible to specify which relay a .put calls to or rather which to exclude from .put?)

The security is that you can only upload/modify from your secure CI/CD. (mine is highly secure, strong passwords, 2fa, secret encryption, https strict pulls, ddos protect etc.) Definitly not less secure than any other server. You could further restrict the access to the edge page's domain etc. but the private data in radata folders is encrypted anyway.

PS: You can update the data incrementally(on Github), but builds to edge are whole(standard-setting), like wipe and then install new, but seamless.
But incremental cloudflare builds are also supported, but need some settings.

Bo
@worldpeaceenginelabs
Thanks in advance for answering all my questions! I appreciate it! 🙏
Andre
@ahg:it-dengler.de
[m]

Here is latest demo and files:
https://codeberg.org/ahg/gun-demo

Prompts could be ignored if you want test with a generated SEA.pair and without a gun relay.

Testing gun data binding gun to dom and dom to gun. Add and delete persons (demo de-/encrypt persons for the current user.

Persist pair AND current gun relay to localstorage from console is possible: rememberMe()
Current logged in user is user1. jGun instance is variable $

I try to build all the parts needed to create a vanilla JS (without frameworks like AlpineJS or Vue...) Gun application with navigation / router, data binding and de-/encryption out of the box with declarative html and less JS code.
Andre
@ahg:it-dengler.de
[m]
It's a proof of concept and need some clean up and improvement... But it works so far...
Jahson
@jahs0nb_twitter

Are .puts instant for the user since gun is offline-frst? So putting and getting in the following line okay to do? Been using .then() but running into a lot of never-ending awaits and I'm wondering if it's because I'm using them on .puts.

Making unit tests is a lot nicer when you write synchronous code imo

1 reply